From cc44385858ed5849a63c090af3452ccb96496d1c Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 29 Jan 2024 10:18:21 +0000 Subject: [PATCH] CodeGen from PR 27385 in Azure/azure-rest-api-specs Merge f80aff1fe36eef9d797841d8da2e420da9309134 into 86a89f22f5e18449a3fde7c00a416f18c19b70f9 --- .../migrate/armmigrate/CHANGELOG.md | 759 + .../migrate/armmigrate/README.md | 6 +- .../armmigrate/assessedmachines_client.go | 208 - .../assessedmachines_client_example_test.go | 267 - .../migrate/armmigrate/assessments_client.go | 513 - .../assessments_client_example_test.go | 511 - .../migrate/armmigrate/autorest.md | 6 +- .../migrate/armmigrate/client_factory.go | 320 +- .../migrate/armmigrate/constants.go | 1962 ++- .../dependencymapcontroller_client.go | 449 + .../fake/assessedmachines_server.go | 175 - .../armmigrate/fake/assessments_server.go | 370 - .../fake/dependencymapcontroller_server.go | 343 + .../migrate/armmigrate/fake/groups_server.go | 314 - .../fake/hypervclustercontroller_server.go | 271 + .../fake/hypervcollectors_server.go | 258 - .../hypervdependencymapcontroller_server.go | 399 + .../fake/hypervhostcontroller_server.go | 284 + .../armmigrate/fake/hypervjobs_server.go | 156 + .../fake/hypervjobscontroller_server.go | 156 + .../fake/hypervmachinescontroller_server.go | 308 + ...hypervoperationsstatuscontroller_server.go | 104 + .../hypervrunasaccountscontroller_server.go | 156 + .../armmigrate/fake/hypervsites_server.go | 149 + .../fake/hypervsitescontroller_server.go | 507 + ...ervsoftwareinventoriescontroller_server.go | 170 + .../iiswebapplicationscontroller_server.go | 255 + .../fake/iiswebserverscontroller_server.go | 204 + .../fake/importcollectors_server.go | 258 - .../fake/importjobscontroller_server.go | 432 + .../fake/importmachinescontroller_server.go | 239 + .../fake/importsitescontroller_server.go | 447 + .../migrate/armmigrate/fake/internal.go | 27 + .../armmigrate/fake/machines_server.go | 159 - .../fake/machinescontroller_server.go | 364 + .../fake/mastersitescontroller_server.go | 383 + ...rsitesoperationsstatuscontroller_server.go | 104 + .../armmigrate/fake/operations_server.go | 6 +- .../fake/privateendpointconnection_server.go | 252 - ...vateendpointconnectioncontroller_server.go | 250 + .../fake/privatelinkresource_server.go | 149 - .../privatelinkresourcescontroller_server.go | 156 + .../armmigrate/fake/projects_server.go | 431 - .../fake/runasaccountscontroller_server.go | 156 + .../migrate/armmigrate/fake/server_factory.go | 444 +- .../fake/servercollectors_server.go | 258 - .../serverdependencymapcontroller_server.go | 343 + .../fake/serverjobscontroller_server.go | 156 + ...serveroperationsstatuscontroller_server.go | 104 + .../serverrunasaccountscontroller_server.go | 156 + .../fake/serverscontroller_server.go | 286 + .../fake/serversitescontroller_server.go | 767 ++ ...versoftwareinventoriescontroller_server.go | 170 + .../armmigrate/fake/sitescontroller_server.go | 650 + .../sqlavailabilitygroupscontroller_server.go | 204 + .../fake/sqldatabasescontroller_server.go | 204 + ...iscoverysitedatasourcecontroller_server.go | 275 + .../fake/sqljobscontroller_server.go | 164 + .../sqloperationsstatuscontroller_server.go | 108 + .../fake/sqlrunasaccountscontroller_server.go | 164 + .../fake/sqlserverscontroller_server.go | 255 + .../fake/sqlsitescontroller_server.go | 580 + .../tomcatwebapplicationscontroller_server.go | 255 + .../fake/tomcatwebserverscontroller_server.go | 204 + .../fake/vcentercontroller_server.go | 271 + .../fake/vmwarecollectors_server.go | 258 - .../fake/vmwarehostcontroller_server.go | 156 + .../fake/vmwareoperationsstatus_server.go | 104 + .../fake/vmwarepropertiescontroller_server.go | 287 + ...aresoftwareinventoriescontroller_server.go | 170 + ...scoverysitedatasourcescontroller_server.go | 288 + ...webappextendedmachinescontroller_server.go | 204 + .../fake/webapplicationscontroller_server.go | 156 + .../fake/webapppropertiescontroller_server.go | 123 + .../webapprunasaccountscontroller_server.go | 164 + .../fake/webappsitescontroller_server.go | 533 + .../fake/webserverscontroller_server.go | 156 + sdk/resourcemanager/migrate/armmigrate/go.mod | 14 +- sdk/resourcemanager/migrate/armmigrate/go.sum | 19 - .../migrate/armmigrate/groups_client.go | 416 - .../armmigrate/groups_client_example_test.go | 204 - .../hypervclustercontroller_client.go | 328 + .../armmigrate/hypervcollectors_client.go | 332 - .../hypervcollectors_client_example_test.go | 188 - .../hypervdependencymapcontroller_client.go | 530 + .../armmigrate/hypervhostcontroller_client.go | 350 + .../migrate/armmigrate/hypervjobs_client.go | 178 + .../armmigrate/hypervjobscontroller_client.go | 179 + .../hypervmachinescontroller_client.go | 347 + ...hypervoperationsstatuscontroller_client.go | 114 + .../hypervrunasaccountscontroller_client.go | 179 + .../migrate/armmigrate/hypervsites_client.go | 159 + .../hypervsitescontroller_client.go | 745 + ...ervsoftwareinventoriescontroller_client.go | 189 + .../iiswebapplicationscontroller_client.go | 281 + .../iiswebserverscontroller_client.go | 202 + .../armmigrate/importcollectors_client.go | 332 - .../importcollectors_client_example_test.go | 146 - .../armmigrate/importjobscontroller_client.go | 584 + .../importmachinescontroller_client.go | 252 + .../importsitescontroller_client.go | 633 + .../migrate/armmigrate/machines_client.go | 185 - .../machines_client_example_test.go | 174 - .../armmigrate/machinescontroller_client.go | 429 + .../mastersitescontroller_client.go | 510 + ...rsitesoperationsstatuscontroller_client.go | 114 + .../migrate/armmigrate/models.go | 5183 ++++++- .../migrate/armmigrate/models_serde.go | 11437 ++++++++++++++-- .../migrate/armmigrate/operations_client.go | 26 +- .../operations_client_example_test.go | 66 - .../migrate/armmigrate/options.go | 1313 +- .../privateendpointconnection_client.go | 336 - ...eendpointconnection_client_example_test.go | 156 - ...vateendpointconnectioncontroller_client.go | 322 + .../armmigrate/privatelinkresource_client.go | 186 - ...privatelinkresource_client_example_test.go | 85 - .../privatelinkresourcescontroller_client.go | 179 + .../migrate/armmigrate/projects_client.go | 583 - .../projects_client_example_test.go | 1968 --- .../migrate/armmigrate/response_types.go | 1509 +- .../runasaccountscontroller_client.go | 179 + .../armmigrate/servercollectors_client.go | 332 - .../servercollectors_client_example_test.go | 188 - .../serverdependencymapcontroller_client.go | 449 + .../armmigrate/serverjobscontroller_client.go | 179 + ...serveroperationsstatuscontroller_client.go | 114 + .../serverrunasaccountscontroller_client.go | 179 + .../armmigrate/serverscontroller_client.go | 326 + .../serversitescontroller_client.go | 1102 ++ ...versoftwareinventoriescontroller_client.go | 189 + .../armmigrate/sitescontroller_client.go | 938 ++ .../sqlavailabilitygroupscontroller_client.go | 202 + .../sqldatabasescontroller_client.go | 202 + ...iscoverysitedatasourcecontroller_client.go | 345 + .../armmigrate/sqljobscontroller_client.go | 188 + .../sqloperationsstatuscontroller_client.go | 119 + .../sqlrunasaccountscontroller_client.go | 189 + .../armmigrate/sqlserverscontroller_client.go | 281 + .../armmigrate/sqlsitescontroller_client.go | 809 ++ .../tomcatwebapplicationscontroller_client.go | 281 + .../tomcatwebserverscontroller_client.go | 202 + .../armmigrate/vcentercontroller_client.go | 327 + .../armmigrate/vmwarecollectors_client.go | 332 - .../vmwarecollectors_client_example_test.go | 188 - .../armmigrate/vmwarehostcontroller_client.go | 179 + .../vmwareoperationsstatus_client.go | 114 + .../vmwarepropertiescontroller_client.go | 368 + ...aresoftwareinventoriescontroller_client.go | 189 + ...scoverysitedatasourcescontroller_client.go | 367 + ...webappextendedmachinescontroller_client.go | 202 + .../webapplicationscontroller_client.go | 127 + .../webapppropertiescontroller_client.go | 130 + .../webapprunasaccountscontroller_client.go | 189 + .../webappsitescontroller_client.go | 746 + .../armmigrate/webserverscontroller_client.go | 127 + 155 files changed, 50227 insertions(+), 14023 deletions(-) delete mode 100644 sdk/resourcemanager/migrate/armmigrate/assessedmachines_client.go delete mode 100644 sdk/resourcemanager/migrate/armmigrate/assessedmachines_client_example_test.go delete mode 100644 sdk/resourcemanager/migrate/armmigrate/assessments_client.go delete mode 100644 sdk/resourcemanager/migrate/armmigrate/assessments_client_example_test.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/dependencymapcontroller_client.go delete mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/assessedmachines_server.go delete mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/assessments_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/dependencymapcontroller_server.go delete mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/groups_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/hypervclustercontroller_server.go delete mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/hypervcollectors_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/hypervdependencymapcontroller_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/hypervhostcontroller_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/hypervjobs_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/hypervjobscontroller_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/hypervmachinescontroller_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/hypervoperationsstatuscontroller_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/hypervrunasaccountscontroller_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/hypervsites_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/hypervsitescontroller_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/hypervsoftwareinventoriescontroller_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/iiswebapplicationscontroller_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/iiswebserverscontroller_server.go delete mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/importcollectors_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/importjobscontroller_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/importmachinescontroller_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/importsitescontroller_server.go delete mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/machines_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/machinescontroller_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/mastersitescontroller_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/mastersitesoperationsstatuscontroller_server.go delete mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/privateendpointconnection_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/privateendpointconnectioncontroller_server.go delete mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/privatelinkresource_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/privatelinkresourcescontroller_server.go delete mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/projects_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/runasaccountscontroller_server.go delete mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/servercollectors_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/serverdependencymapcontroller_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/serverjobscontroller_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/serveroperationsstatuscontroller_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/serverrunasaccountscontroller_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/serverscontroller_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/serversitescontroller_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/serversoftwareinventoriescontroller_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/sitescontroller_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/sqlavailabilitygroupscontroller_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/sqldatabasescontroller_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/sqldiscoverysitedatasourcecontroller_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/sqljobscontroller_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/sqloperationsstatuscontroller_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/sqlrunasaccountscontroller_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/sqlserverscontroller_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/sqlsitescontroller_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/tomcatwebapplicationscontroller_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/tomcatwebserverscontroller_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/vcentercontroller_server.go delete mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/vmwarecollectors_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/vmwarehostcontroller_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/vmwareoperationsstatus_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/vmwarepropertiescontroller_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/vmwaresoftwareinventoriescontroller_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/webappdiscoverysitedatasourcescontroller_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/webappextendedmachinescontroller_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/webapplicationscontroller_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/webapppropertiescontroller_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/webapprunasaccountscontroller_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/webappsitescontroller_server.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/fake/webserverscontroller_server.go delete mode 100644 sdk/resourcemanager/migrate/armmigrate/groups_client.go delete mode 100644 sdk/resourcemanager/migrate/armmigrate/groups_client_example_test.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/hypervclustercontroller_client.go delete mode 100644 sdk/resourcemanager/migrate/armmigrate/hypervcollectors_client.go delete mode 100644 sdk/resourcemanager/migrate/armmigrate/hypervcollectors_client_example_test.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/hypervdependencymapcontroller_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/hypervhostcontroller_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/hypervjobs_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/hypervjobscontroller_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/hypervmachinescontroller_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/hypervoperationsstatuscontroller_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/hypervrunasaccountscontroller_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/hypervsites_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/hypervsitescontroller_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/hypervsoftwareinventoriescontroller_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/iiswebapplicationscontroller_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/iiswebserverscontroller_client.go delete mode 100644 sdk/resourcemanager/migrate/armmigrate/importcollectors_client.go delete mode 100644 sdk/resourcemanager/migrate/armmigrate/importcollectors_client_example_test.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/importjobscontroller_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/importmachinescontroller_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/importsitescontroller_client.go delete mode 100644 sdk/resourcemanager/migrate/armmigrate/machines_client.go delete mode 100644 sdk/resourcemanager/migrate/armmigrate/machines_client_example_test.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/machinescontroller_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/mastersitescontroller_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/mastersitesoperationsstatuscontroller_client.go delete mode 100644 sdk/resourcemanager/migrate/armmigrate/operations_client_example_test.go delete mode 100644 sdk/resourcemanager/migrate/armmigrate/privateendpointconnection_client.go delete mode 100644 sdk/resourcemanager/migrate/armmigrate/privateendpointconnection_client_example_test.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/privateendpointconnectioncontroller_client.go delete mode 100644 sdk/resourcemanager/migrate/armmigrate/privatelinkresource_client.go delete mode 100644 sdk/resourcemanager/migrate/armmigrate/privatelinkresource_client_example_test.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/privatelinkresourcescontroller_client.go delete mode 100644 sdk/resourcemanager/migrate/armmigrate/projects_client.go delete mode 100644 sdk/resourcemanager/migrate/armmigrate/projects_client_example_test.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/runasaccountscontroller_client.go delete mode 100644 sdk/resourcemanager/migrate/armmigrate/servercollectors_client.go delete mode 100644 sdk/resourcemanager/migrate/armmigrate/servercollectors_client_example_test.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/serverdependencymapcontroller_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/serverjobscontroller_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/serveroperationsstatuscontroller_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/serverrunasaccountscontroller_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/serverscontroller_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/serversitescontroller_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/serversoftwareinventoriescontroller_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/sitescontroller_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/sqlavailabilitygroupscontroller_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/sqldatabasescontroller_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/sqldiscoverysitedatasourcecontroller_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/sqljobscontroller_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/sqloperationsstatuscontroller_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/sqlrunasaccountscontroller_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/sqlserverscontroller_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/sqlsitescontroller_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/tomcatwebapplicationscontroller_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/tomcatwebserverscontroller_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/vcentercontroller_client.go delete mode 100644 sdk/resourcemanager/migrate/armmigrate/vmwarecollectors_client.go delete mode 100644 sdk/resourcemanager/migrate/armmigrate/vmwarecollectors_client_example_test.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/vmwarehostcontroller_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/vmwareoperationsstatus_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/vmwarepropertiescontroller_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/vmwaresoftwareinventoriescontroller_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/webappdiscoverysitedatasourcescontroller_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/webappextendedmachinescontroller_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/webapplicationscontroller_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/webapppropertiescontroller_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/webapprunasaccountscontroller_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/webappsitescontroller_client.go create mode 100644 sdk/resourcemanager/migrate/armmigrate/webserverscontroller_client.go diff --git a/sdk/resourcemanager/migrate/armmigrate/CHANGELOG.md b/sdk/resourcemanager/migrate/armmigrate/CHANGELOG.md index b243725c65cf..d7ddc74f7ba9 100644 --- a/sdk/resourcemanager/migrate/armmigrate/CHANGELOG.md +++ b/sdk/resourcemanager/migrate/armmigrate/CHANGELOG.md @@ -1,5 +1,764 @@ # Release History +## 2.0.0-beta.1 (2024-01-29) +### Breaking Changes + +- Type of `Operation.Origin` has been changed from `*string` to `*Origin` +- Type of `PrivateEndpointConnection.Properties` has been changed from `*PrivateEndpointConnectionProperties` to `*PrivateEndpointConnectionPropertiesV2` +- `ProvisioningStateAccepted`, `ProvisioningStateCreating`, `ProvisioningStateDeleting`, `ProvisioningStateMoving` from enum `ProvisioningState` has been removed +- Enum `AssessmentSizingCriterion` has been removed +- Enum `AssessmentStage` has been removed +- Enum `AssessmentStatus` has been removed +- Enum `AzureDiskSize` has been removed +- Enum `AzureDiskSuitabilityDetail` has been removed +- Enum `AzureDiskSuitabilityExplanation` has been removed +- Enum `AzureDiskType` has been removed +- Enum `AzureHybridUseBenefit` has been removed +- Enum `AzureLocation` has been removed +- Enum `AzureNetworkAdapterSuitabilityDetail` has been removed +- Enum `AzureNetworkAdapterSuitabilityExplanation` has been removed +- Enum `AzureOfferCode` has been removed +- Enum `AzurePricingTier` has been removed +- Enum `AzureStorageRedundancy` has been removed +- Enum `AzureVMFamily` has been removed +- Enum `AzureVMSize` has been removed +- Enum `AzureVMSuitabilityDetail` has been removed +- Enum `AzureVMSuitabilityExplanation` has been removed +- Enum `CloudSuitability` has been removed +- Enum `Currency` has been removed +- Enum `GroupStatus` has been removed +- Enum `GroupUpdateOperation` has been removed +- Enum `MachineBootType` has been removed +- Enum `Percentile` has been removed +- Enum `PrivateEndpointConnectionPropertiesProvisioningState` has been removed +- Enum `ProjectStatus` has been removed +- Enum `ReservedInstance` has been removed +- Enum `TimeRange` has been removed +- Function `NewAssessedMachinesClient` has been removed +- Function `*AssessedMachinesClient.Get` has been removed +- Function `*AssessedMachinesClient.NewListByAssessmentPager` has been removed +- Function `NewAssessmentsClient` has been removed +- Function `*AssessmentsClient.Create` has been removed +- Function `*AssessmentsClient.Delete` has been removed +- Function `*AssessmentsClient.Get` has been removed +- Function `*AssessmentsClient.GetReportDownloadURL` has been removed +- Function `*AssessmentsClient.NewListByGroupPager` has been removed +- Function `*AssessmentsClient.NewListByProjectPager` has been removed +- Function `*ClientFactory.NewAssessedMachinesClient` has been removed +- Function `*ClientFactory.NewAssessmentsClient` has been removed +- Function `*ClientFactory.NewGroupsClient` has been removed +- Function `*ClientFactory.NewHyperVCollectorsClient` has been removed +- Function `*ClientFactory.NewImportCollectorsClient` has been removed +- Function `*ClientFactory.NewMachinesClient` has been removed +- Function `*ClientFactory.NewPrivateEndpointConnectionClient` has been removed +- Function `*ClientFactory.NewPrivateLinkResourceClient` has been removed +- Function `*ClientFactory.NewProjectsClient` has been removed +- Function `*ClientFactory.NewServerCollectorsClient` has been removed +- Function `*ClientFactory.NewVMwareCollectorsClient` has been removed +- Function `NewGroupsClient` has been removed +- Function `*GroupsClient.Create` has been removed +- Function `*GroupsClient.Delete` has been removed +- Function `*GroupsClient.Get` has been removed +- Function `*GroupsClient.NewListByProjectPager` has been removed +- Function `*GroupsClient.UpdateMachines` has been removed +- Function `NewHyperVCollectorsClient` has been removed +- Function `*HyperVCollectorsClient.Create` has been removed +- Function `*HyperVCollectorsClient.Delete` has been removed +- Function `*HyperVCollectorsClient.Get` has been removed +- Function `*HyperVCollectorsClient.NewListByProjectPager` has been removed +- Function `NewImportCollectorsClient` has been removed +- Function `*ImportCollectorsClient.Create` has been removed +- Function `*ImportCollectorsClient.Delete` has been removed +- Function `*ImportCollectorsClient.Get` has been removed +- Function `*ImportCollectorsClient.NewListByProjectPager` has been removed +- Function `NewMachinesClient` has been removed +- Function `*MachinesClient.Get` has been removed +- Function `*MachinesClient.NewListByProjectPager` has been removed +- Function `NewPrivateEndpointConnectionClient` has been removed +- Function `*PrivateEndpointConnectionClient.Delete` has been removed +- Function `*PrivateEndpointConnectionClient.Get` has been removed +- Function `*PrivateEndpointConnectionClient.ListByProject` has been removed +- Function `*PrivateEndpointConnectionClient.Update` has been removed +- Function `NewPrivateLinkResourceClient` has been removed +- Function `*PrivateLinkResourceClient.Get` has been removed +- Function `*PrivateLinkResourceClient.ListByProject` has been removed +- Function `NewProjectsClient` has been removed +- Function `*ProjectsClient.AssessmentOptions` has been removed +- Function `*ProjectsClient.NewAssessmentOptionsListPager` has been removed +- Function `*ProjectsClient.Create` has been removed +- Function `*ProjectsClient.Delete` has been removed +- Function `*ProjectsClient.Get` has been removed +- Function `*ProjectsClient.NewListBySubscriptionPager` has been removed +- Function `*ProjectsClient.NewListPager` has been removed +- Function `*ProjectsClient.Update` has been removed +- Function `NewServerCollectorsClient` has been removed +- Function `*ServerCollectorsClient.Create` has been removed +- Function `*ServerCollectorsClient.Delete` has been removed +- Function `*ServerCollectorsClient.Get` has been removed +- Function `*ServerCollectorsClient.NewListByProjectPager` has been removed +- Function `NewVMwareCollectorsClient` has been removed +- Function `*VMwareCollectorsClient.Create` has been removed +- Function `*VMwareCollectorsClient.Delete` has been removed +- Function `*VMwareCollectorsClient.Get` has been removed +- Function `*VMwareCollectorsClient.NewListByProjectPager` has been removed +- Struct `AssessedDisk` has been removed +- Struct `AssessedMachine` has been removed +- Struct `AssessedMachineProperties` has been removed +- Struct `AssessedMachineResultList` has been removed +- Struct `AssessedNetworkAdapter` has been removed +- Struct `Assessment` has been removed +- Struct `AssessmentOptions` has been removed +- Struct `AssessmentOptionsProperties` has been removed +- Struct `AssessmentOptionsResultList` has been removed +- Struct `AssessmentProperties` has been removed +- Struct `AssessmentResultList` has been removed +- Struct `CollectorAgentProperties` has been removed +- Struct `CollectorBodyAgentSpnProperties` has been removed +- Struct `CollectorProperties` has been removed +- Struct `Disk` has been removed +- Struct `DownloadURL` has been removed +- Struct `Group` has been removed +- Struct `GroupBodyProperties` has been removed +- Struct `GroupProperties` has been removed +- Struct `GroupResultList` has been removed +- Struct `HyperVCollector` has been removed +- Struct `HyperVCollectorList` has been removed +- Struct `ImportCollector` has been removed +- Struct `ImportCollectorList` has been removed +- Struct `ImportCollectorProperties` has been removed +- Struct `Machine` has been removed +- Struct `MachineProperties` has been removed +- Struct `MachineResultList` has been removed +- Struct `NetworkAdapter` has been removed +- Struct `OperationResultList` has been removed +- Struct `PrivateEndpointConnectionCollection` has been removed +- Struct `PrivateEndpointConnectionProperties` has been removed +- Struct `PrivateLinkResourceCollection` has been removed +- Struct `Project` has been removed +- Struct `ProjectProperties` has been removed +- Struct `ProjectResultList` has been removed +- Struct `ServerCollector` has been removed +- Struct `ServerCollectorList` has been removed +- Struct `UpdateGroupBody` has been removed +- Struct `VMFamily` has been removed +- Struct `VMUptime` has been removed +- Struct `VMwareCollector` has been removed +- Struct `VMwareCollectorList` has been removed +- Field `OperationResultList` of struct `OperationsClientListResponse` has been removed +- Field `ETag` of struct `PrivateEndpointConnection` has been removed + +### Features Added + +- New value `ProvisioningStateCanceled`, `ProvisioningStateCompleted`, `ProvisioningStateCreated`, `ProvisioningStateRunning`, `ProvisioningStateUpdated` added to enum type `ProvisioningState` +- New enum type `ActionType` with values `ActionTypeInternal` +- New enum type `ApplicationDiscoveryScopeStatus` with values `ApplicationDiscoveryScopeStatusDisabled`, `ApplicationDiscoveryScopeStatusDiscoveryFailed`, `ApplicationDiscoveryScopeStatusDiscoveryInProgress`, `ApplicationDiscoveryScopeStatusDiscoveryNotStarted`, `ApplicationDiscoveryScopeStatusDiscoveryPartiallySucceded`, `ApplicationDiscoveryScopeStatusDiscoverySucceeded`, `ApplicationDiscoveryScopeStatusDiscoverySucceededAtleastOnce`, `ApplicationDiscoveryScopeStatusRunAsAccountNotAssociated` +- New enum type `CreatedByType` with values `CreatedByTypeApplication`, `CreatedByTypeKey`, `CreatedByTypeManagedIdentity`, `CreatedByTypeUser` +- New enum type `Default` with values `DefaultDefault` +- New enum type `DefaultAutoGenerated` with values `DefaultAutoGeneratedDefault` +- New enum type `DefaultValues` with values `DefaultValuesDefault` +- New enum type `DeleteImportedMachinesJobPropertiesJobState` with values `DeleteImportedMachinesJobPropertiesJobStateCompleted`, `DeleteImportedMachinesJobPropertiesJobStateFailed`, `DeleteImportedMachinesJobPropertiesJobStateUnknown`, `DeleteImportedMachinesJobPropertiesJobStateVerified`, `DeleteImportedMachinesJobPropertiesJobStateVerifiedWithErrors` +- New enum type `DependencyMapDiscoveryScopeStatus` with values `DependencyMapDiscoveryScopeStatusDisabled`, `DependencyMapDiscoveryScopeStatusDiscoveryFailed`, `DependencyMapDiscoveryScopeStatusDiscoveryInProgress`, `DependencyMapDiscoveryScopeStatusDiscoveryNotStarted`, `DependencyMapDiscoveryScopeStatusDiscoveryPartiallySucceded`, `DependencyMapDiscoveryScopeStatusDiscoverySucceeded`, `DependencyMapDiscoveryScopeStatusDiscoverySucceededAtleastOnce`, `DependencyMapDiscoveryScopeStatusRunAsAccountNotAssociated` +- New enum type `DiscoveryScopeStatus` with values `DiscoveryScopeStatusDisabled`, `DiscoveryScopeStatusDiscoveryFailed`, `DiscoveryScopeStatusDiscoveryInProgress`, `DiscoveryScopeStatusDiscoveryNotStarted`, `DiscoveryScopeStatusDiscoveryPartiallySucceded`, `DiscoveryScopeStatusDiscoverySucceeded`, `DiscoveryScopeStatusDiscoverySucceededAtleastOnce`, `DiscoveryScopeStatusRunAsAccountNotAssociated` +- New enum type `DiscoveryScopes` with values `DiscoveryScopesAppsAndRoles`, `DiscoveryScopesDependencyMap`, `DiscoveryScopesSQLServerConnectionInfo`, `DiscoveryScopesStaticData` +- New enum type `EsuStatus` with values `EsuStatusActive`, `EsuStatusInActive`, `EsuStatusUnknown` +- New enum type `EsuYear` with values `EsuYearFirstYear`, `EsuYearSecondYear`, `EsuYearThirdYear`, `EsuYearUnknown`, `EsuYearUpgradeYear` +- New enum type `ExportMachineErrorsProperties` with values `ExportMachineErrorsPropertiesAppsAndRoles`, `ExportMachineErrorsPropertiesDependencyMap`, `ExportMachineErrorsPropertiesSQLServerConnectionInfo`, `ExportMachineErrorsPropertiesStaticData` +- New enum type `FCIInstanceState` with values `FCIInstanceStateFailed`, `FCIInstanceStateInherited`, `FCIInstanceStateInitializing`, `FCIInstanceStateOffline`, `FCIInstanceStateOfflinePending`, `FCIInstanceStateOnline`, `FCIInstanceStateOnlinePending`, `FCIInstanceStatePending`, `FCIInstanceStateUnknown` +- New enum type `FileType` with values `FileTypeFilestream`, `FileTypeFulltext`, `FileTypeLog`, `FileTypeNotSupported`, `FileTypeRows` +- New enum type `HealthErrorDetailsDiscoveryScope` with values `HealthErrorDetailsDiscoveryScopeAppsAndRoles`, `HealthErrorDetailsDiscoveryScopeDependencyMap`, `HealthErrorDetailsDiscoveryScopeDiscoveryTargets`, `HealthErrorDetailsDiscoveryScopeSQLServerConnectionInfo`, `HealthErrorDetailsDiscoveryScopeStaticData` +- New enum type `HealthErrorDetailsSource` with values `HealthErrorDetailsSourceRefreshFabricLayout`, `HealthErrorDetailsSourceRefreshFabricLayoutDependencyMap`, `HealthErrorDetailsSourceRefreshFabricLayoutGuest` +- New enum type `HighAvailability` with values `HighAvailabilityNo`, `HighAvailabilityUnknown`, `HighAvailabilityYes` +- New enum type `HighAvailabilityValues` with values `HighAvailabilityValuesNo`, `HighAvailabilityValuesUnknown`, `HighAvailabilityValuesYes` +- New enum type `ImportTypeValues` with values `ImportTypeValuesAzureMigrateCSV`, `ImportTypeValuesRVToolsXlsx` +- New enum type `JobResult` with values `JobResultCompleted`, `JobResultCompletedWithErrors`, `JobResultCompletedWithWarnings`, `JobResultFailed`, `JobResultInProgress`, `JobResultUnknown`, `JobResultWaitingForBlobUpload` +- New enum type `MasterSitePropertiesPublicNetworkAccess` with values `MasterSitePropertiesPublicNetworkAccessDisabled`, `MasterSitePropertiesPublicNetworkAccessEnabled`, `MasterSitePropertiesPublicNetworkAccessNotSpecified` +- New enum type `MicrosoftAzureFDSWebRoleHealthErrorDetailsSource` with values `MicrosoftAzureFDSWebRoleHealthErrorDetailsSourceRefreshFabricLayout`, `MicrosoftAzureFDSWebRoleHealthErrorDetailsSourceRefreshFabricLayoutDependencyMap`, `MicrosoftAzureFDSWebRoleHealthErrorDetailsSourceRefreshFabricLayoutGuest` +- New enum type `Origin` with values `OriginSystem`, `OriginUser`, `OriginUserSystem` +- New enum type `SQLAvailabilityGroupPropertiesAvailabilityGroupType` with values `SQLAvailabilityGroupPropertiesAvailabilityGroupTypeDistributed`, `SQLAvailabilityGroupPropertiesAvailabilityGroupTypeTraditional`, `SQLAvailabilityGroupPropertiesAvailabilityGroupTypeUnknown` +- New enum type `SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaCommitMode` with values `SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaCommitModeAsynchronous`, `SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaCommitModeSynchronous`, `SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaCommitModeUnknown` +- New enum type `SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaReadMode` with values `SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaReadModeNone`, `SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaReadModeReadOnly`, `SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaReadModeReadWrite`, `SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaReadModeUnknown` +- New enum type `SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSeedMode` with values `SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSeedModeAutomatic`, `SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSeedModeManual`, `SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSeedModeUnknown` +- New enum type `SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaState` with values `SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaStatePrimary`, `SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaStateSecondary`, `SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaStateUnknown` +- New enum type `SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSyncStatus` with values `SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSyncStatusSynchronized`, `SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSyncStatusUnknown`, `SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSyncStatusUnsynchronized` +- New enum type `SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaType` with values `SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaTypeAvailabilityGroupReplica`, `SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaTypeDatabaseReplica`, `SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaTypeUnknown` +- New enum type `SQLAvailabilityReplicaOverviewReplicaState` with values `SQLAvailabilityReplicaOverviewReplicaStatePrimary`, `SQLAvailabilityReplicaOverviewReplicaStateSecondary`, `SQLAvailabilityReplicaOverviewReplicaStateUnknown` +- New enum type `SQLDiscoveryScopeStatus` with values `SQLDiscoveryScopeStatusDisabled`, `SQLDiscoveryScopeStatusDiscoveryFailed`, `SQLDiscoveryScopeStatusDiscoveryInProgress`, `SQLDiscoveryScopeStatusDiscoveryNotStarted`, `SQLDiscoveryScopeStatusDiscoveryPartiallySucceded`, `SQLDiscoveryScopeStatusDiscoverySucceeded`, `SQLDiscoveryScopeStatusDiscoverySucceededAtleastOnce`, `SQLDiscoveryScopeStatusRunAsAccountNotAssociated` +- New enum type `SQLMachineOverviewFciRole` with values `SQLMachineOverviewFciRoleActiveNode`, `SQLMachineOverviewFciRoleNotApplicable`, `SQLMachineOverviewFciRolePossibleOwnerNode`, `SQLMachineOverviewFciRoleUnknown` +- New enum type `SQLMetadataDiscoveryPipe` with values `SQLMetadataDiscoveryPipeCIM`, `SQLMetadataDiscoveryPipeOther`, `SQLMetadataDiscoveryPipePowerShell`, `SQLMetadataDiscoveryPipeSSH`, `SQLMetadataDiscoveryPipeUnknown`, `SQLMetadataDiscoveryPipeVMware` +- New enum type `SQLServerStatus` with values `SQLServerStatusContinuePending`, `SQLServerStatusPausePending`, `SQLServerStatusPaused`, `SQLServerStatusRunning`, `SQLServerStatusStartPending`, `SQLServerStatusStopPending`, `SQLServerStatusStopped`, `SQLServerStatusUnknown` +- New enum type `SQLSitePropertiesDiscoveryScenario` with values `SQLSitePropertiesDiscoveryScenarioDR`, `SQLSitePropertiesDiscoveryScenarioMigrate` +- New enum type `ShallowDiscoveryStatus` with values `ShallowDiscoveryStatusDisabled`, `ShallowDiscoveryStatusDiscoveryFailed`, `ShallowDiscoveryStatusDiscoveryInProgress`, `ShallowDiscoveryStatusDiscoveryNotStarted`, `ShallowDiscoveryStatusDiscoveryPartiallySucceded`, `ShallowDiscoveryStatusDiscoverySucceeded`, `ShallowDiscoveryStatusDiscoverySucceededAtleastOnce`, `ShallowDiscoveryStatusRunAsAccountNotAssociated` +- New enum type `SiteHealthSummaryFabricLayoutUpdateSourcesItem` with values `SiteHealthSummaryFabricLayoutUpdateSourcesItemRefreshFabricLayout`, `SiteHealthSummaryFabricLayoutUpdateSourcesItemRefreshFabricLayoutDependencyMap`, `SiteHealthSummaryFabricLayoutUpdateSourcesItemRefreshFabricLayoutGuest` +- New enum type `StaticDiscoveryScopeStatus` with values `StaticDiscoveryScopeStatusDisabled`, `StaticDiscoveryScopeStatusDiscoveryFailed`, `StaticDiscoveryScopeStatusDiscoveryInProgress`, `StaticDiscoveryScopeStatusDiscoveryNotStarted`, `StaticDiscoveryScopeStatusDiscoveryPartiallySucceded`, `StaticDiscoveryScopeStatusDiscoverySucceeded`, `StaticDiscoveryScopeStatusDiscoverySucceededAtleastOnce`, `StaticDiscoveryScopeStatusRunAsAccountNotAssociated` +- New enum type `SupportStatus` with values `SupportStatusExtended`, `SupportStatusMainstream`, `SupportStatusUnknown` +- New enum type `VMwareDatastoreType` with values `VMwareDatastoreTypeCifs`, `VMwareDatastoreTypeNFS`, `VMwareDatastoreTypeNFS41`, `VMwareDatastoreTypePmem`, `VMwareDatastoreTypeUnknown`, `VMwareDatastoreTypeVffs`, `VMwareDatastoreTypeVmfs`, `VMwareDatastoreTypeVsan`, `VMwareDatastoreTypeVvol` +- New enum type `Versions` with values `VersionsV20180501Preview`, `VersionsV20190501Preview`, `VersionsV20200101`, `VersionsV20200101Preview`, `VersionsV20200201`, `VersionsV20200707`, `VersionsV20200710`, `VersionsV20200801Preview`, `VersionsV20201111Preview`, `VersionsV20221027`, `VersionsV20230606`, `VersionsV20231001Preview` +- New enum type `WebAppSitePropertiesDiscoveryScenario` with values `WebAppSitePropertiesDiscoveryScenarioDR`, `WebAppSitePropertiesDiscoveryScenarioMigrate` +- New function `*ClientFactory.NewDependencyMapControllerClient() *DependencyMapControllerClient` +- New function `*ClientFactory.NewHypervClusterControllerClient() *HypervClusterControllerClient` +- New function `*ClientFactory.NewHypervDependencyMapControllerClient() *HypervDependencyMapControllerClient` +- New function `*ClientFactory.NewHypervHostControllerClient() *HypervHostControllerClient` +- New function `*ClientFactory.NewHypervJobsClient() *HypervJobsClient` +- New function `*ClientFactory.NewHypervJobsControllerClient() *HypervJobsControllerClient` +- New function `*ClientFactory.NewHypervMachinesControllerClient() *HypervMachinesControllerClient` +- New function `*ClientFactory.NewHypervOperationsStatusControllerClient() *HypervOperationsStatusControllerClient` +- New function `*ClientFactory.NewHypervRunAsAccountsControllerClient() *HypervRunAsAccountsControllerClient` +- New function `*ClientFactory.NewHypervSitesClient() *HypervSitesClient` +- New function `*ClientFactory.NewHypervSitesControllerClient() *HypervSitesControllerClient` +- New function `*ClientFactory.NewHypervSoftwareInventoriesControllerClient() *HypervSoftwareInventoriesControllerClient` +- New function `*ClientFactory.NewIisWebApplicationsControllerClient() *IisWebApplicationsControllerClient` +- New function `*ClientFactory.NewIisWebServersControllerClient() *IisWebServersControllerClient` +- New function `*ClientFactory.NewImportJobsControllerClient() *ImportJobsControllerClient` +- New function `*ClientFactory.NewImportMachinesControllerClient() *ImportMachinesControllerClient` +- New function `*ClientFactory.NewImportSitesControllerClient() *ImportSitesControllerClient` +- New function `*ClientFactory.NewMachinesControllerClient() *MachinesControllerClient` +- New function `*ClientFactory.NewMasterSitesControllerClient() *MasterSitesControllerClient` +- New function `*ClientFactory.NewMasterSitesOperationsStatusControllerClient() *MasterSitesOperationsStatusControllerClient` +- New function `*ClientFactory.NewPrivateEndpointConnectionControllerClient() *PrivateEndpointConnectionControllerClient` +- New function `*ClientFactory.NewPrivateLinkResourcesControllerClient() *PrivateLinkResourcesControllerClient` +- New function `*ClientFactory.NewRunAsAccountsControllerClient() *RunAsAccountsControllerClient` +- New function `*ClientFactory.NewSQLAvailabilityGroupsControllerClient() *SQLAvailabilityGroupsControllerClient` +- New function `*ClientFactory.NewSQLDatabasesControllerClient() *SQLDatabasesControllerClient` +- New function `*ClientFactory.NewSQLDiscoverySiteDataSourceControllerClient() *SQLDiscoverySiteDataSourceControllerClient` +- New function `*ClientFactory.NewSQLJobsControllerClient() *SQLJobsControllerClient` +- New function `*ClientFactory.NewSQLOperationsStatusControllerClient() *SQLOperationsStatusControllerClient` +- New function `*ClientFactory.NewSQLRunAsAccountsControllerClient() *SQLRunAsAccountsControllerClient` +- New function `*ClientFactory.NewSQLServersControllerClient() *SQLServersControllerClient` +- New function `*ClientFactory.NewSQLSitesControllerClient() *SQLSitesControllerClient` +- New function `*ClientFactory.NewServerDependencyMapControllerClient() *ServerDependencyMapControllerClient` +- New function `*ClientFactory.NewServerJobsControllerClient() *ServerJobsControllerClient` +- New function `*ClientFactory.NewServerOperationsStatusControllerClient() *ServerOperationsStatusControllerClient` +- New function `*ClientFactory.NewServerRunAsAccountsControllerClient() *ServerRunAsAccountsControllerClient` +- New function `*ClientFactory.NewServerSitesControllerClient() *ServerSitesControllerClient` +- New function `*ClientFactory.NewServerSoftwareInventoriesControllerClient() *ServerSoftwareInventoriesControllerClient` +- New function `*ClientFactory.NewServersControllerClient() *ServersControllerClient` +- New function `*ClientFactory.NewSitesControllerClient() *SitesControllerClient` +- New function `*ClientFactory.NewTomcatWebApplicationsControllerClient() *TomcatWebApplicationsControllerClient` +- New function `*ClientFactory.NewTomcatWebServersControllerClient() *TomcatWebServersControllerClient` +- New function `*ClientFactory.NewVcenterControllerClient() *VcenterControllerClient` +- New function `*ClientFactory.NewVmwareHostControllerClient() *VmwareHostControllerClient` +- New function `*ClientFactory.NewVmwareOperationsStatusClient() *VmwareOperationsStatusClient` +- New function `*ClientFactory.NewVmwarePropertiesControllerClient() *VmwarePropertiesControllerClient` +- New function `*ClientFactory.NewVmwareSoftwareInventoriesControllerClient() *VmwareSoftwareInventoriesControllerClient` +- New function `*ClientFactory.NewWebAppDiscoverySiteDataSourcesControllerClient() *WebAppDiscoverySiteDataSourcesControllerClient` +- New function `*ClientFactory.NewWebAppExtendedMachinesControllerClient() *WebAppExtendedMachinesControllerClient` +- New function `*ClientFactory.NewWebAppPropertiesControllerClient() *WebAppPropertiesControllerClient` +- New function `*ClientFactory.NewWebAppRunAsAccountsControllerClient() *WebAppRunAsAccountsControllerClient` +- New function `*ClientFactory.NewWebAppSitesControllerClient() *WebAppSitesControllerClient` +- New function `*ClientFactory.NewWebApplicationsControllerClient() *WebApplicationsControllerClient` +- New function `*ClientFactory.NewWebServersControllerClient() *WebServersControllerClient` +- New function `NewDependencyMapControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*DependencyMapControllerClient, error)` +- New function `*DependencyMapControllerClient.BeginClientGroupMembers(context.Context, string, string, DependencyMapServiceMapextensionsClientGroupMembersRequest, *DependencyMapControllerClientBeginClientGroupMembersOptions) (*runtime.Poller[DependencyMapControllerClientClientGroupMembersResponse], error)` +- New function `*DependencyMapControllerClient.BeginExportDependencies(context.Context, string, string, DependencyMapServiceMapextensionsExportDependenciesRequest, *DependencyMapControllerClientBeginExportDependenciesOptions) (*runtime.Poller[DependencyMapControllerClientExportDependenciesResponse], error)` +- New function `*DependencyMapControllerClient.BeginGenerateCoarseMap(context.Context, string, string, DependencyMapServiceMapextensionsScopeMapRequest, *DependencyMapControllerClientBeginGenerateCoarseMapOptions) (*runtime.Poller[DependencyMapControllerClientGenerateCoarseMapResponse], error)` +- New function `*DependencyMapControllerClient.BeginGenerateDetailedMap(context.Context, string, string, DependencyMapServiceMapextensionsSingleMachineDetailedMapRequest, *DependencyMapControllerClientBeginGenerateDetailedMapOptions) (*runtime.Poller[DependencyMapControllerClientGenerateDetailedMapResponse], error)` +- New function `*DependencyMapControllerClient.BeginServerGroupMembers(context.Context, string, string, DependencyMapServiceMapextensionsServerGroupMembersRequest, *DependencyMapControllerClientBeginServerGroupMembersOptions) (*runtime.Poller[DependencyMapControllerClientServerGroupMembersResponse], error)` +- New function `NewHypervClusterControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*HypervClusterControllerClient, error)` +- New function `*HypervClusterControllerClient.BeginCreateCluster(context.Context, string, string, string, HypervCluster, *HypervClusterControllerClientBeginCreateClusterOptions) (*runtime.Poller[HypervClusterControllerClientCreateClusterResponse], error)` +- New function `*HypervClusterControllerClient.Delete(context.Context, string, string, string, *HypervClusterControllerClientDeleteOptions) (HypervClusterControllerClientDeleteResponse, error)` +- New function `*HypervClusterControllerClient.GetCluster(context.Context, string, string, string, *HypervClusterControllerClientGetClusterOptions) (HypervClusterControllerClientGetClusterResponse, error)` +- New function `*HypervClusterControllerClient.NewListByHypervSitePager(string, string, *HypervClusterControllerClientListByHypervSiteOptions) *runtime.Pager[HypervClusterControllerClientListByHypervSiteResponse]` +- New function `NewHypervDependencyMapControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*HypervDependencyMapControllerClient, error)` +- New function `*HypervDependencyMapControllerClient.BeginClientGroupMembers(context.Context, string, string, DependencyMapServiceMapextensionsClientGroupMembersRequest, *HypervDependencyMapControllerClientBeginClientGroupMembersOptions) (*runtime.Poller[HypervDependencyMapControllerClientClientGroupMembersResponse], error)` +- New function `*HypervDependencyMapControllerClient.BeginExportDependencies(context.Context, string, string, DependencyMapServiceMapextensionsExportDependenciesRequest, *HypervDependencyMapControllerClientBeginExportDependenciesOptions) (*runtime.Poller[HypervDependencyMapControllerClientExportDependenciesResponse], error)` +- New function `*HypervDependencyMapControllerClient.BeginGenerateCoarseMap(context.Context, string, string, DependencyMapServiceMapextensionsScopeMapRequest, *HypervDependencyMapControllerClientBeginGenerateCoarseMapOptions) (*runtime.Poller[HypervDependencyMapControllerClientGenerateCoarseMapResponse], error)` +- New function `*HypervDependencyMapControllerClient.BeginGenerateDetailedMap(context.Context, string, string, DependencyMapServiceMapextensionsSingleMachineDetailedMapRequest, *HypervDependencyMapControllerClientBeginGenerateDetailedMapOptions) (*runtime.Poller[HypervDependencyMapControllerClientGenerateDetailedMapResponse], error)` +- New function `*HypervDependencyMapControllerClient.BeginServerGroupMembers(context.Context, string, string, DependencyMapServiceMapextensionsServerGroupMembersRequest, *HypervDependencyMapControllerClientBeginServerGroupMembersOptions) (*runtime.Poller[HypervDependencyMapControllerClientServerGroupMembersResponse], error)` +- New function `*HypervDependencyMapControllerClient.BeginUpdateDependencyMapStatus(context.Context, string, string, UpdateMachineDepMapStatus, *HypervDependencyMapControllerClientBeginUpdateDependencyMapStatusOptions) (*runtime.Poller[HypervDependencyMapControllerClientUpdateDependencyMapStatusResponse], error)` +- New function `NewHypervHostControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*HypervHostControllerClient, error)` +- New function `*HypervHostControllerClient.BeginCreate(context.Context, string, string, string, HypervHost, *HypervHostControllerClientBeginCreateOptions) (*runtime.Poller[HypervHostControllerClientCreateResponse], error)` +- New function `*HypervHostControllerClient.BeginDelete(context.Context, string, string, string, *HypervHostControllerClientBeginDeleteOptions) (*runtime.Poller[HypervHostControllerClientDeleteResponse], error)` +- New function `*HypervHostControllerClient.Get(context.Context, string, string, string, *HypervHostControllerClientGetOptions) (HypervHostControllerClientGetResponse, error)` +- New function `*HypervHostControllerClient.NewListByHypervSitePager(string, string, *HypervHostControllerClientListByHypervSiteOptions) *runtime.Pager[HypervHostControllerClientListByHypervSiteResponse]` +- New function `NewHypervJobsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*HypervJobsClient, error)` +- New function `*HypervJobsClient.Get(context.Context, string, string, string, *HypervJobsClientGetOptions) (HypervJobsClientGetResponse, error)` +- New function `*HypervJobsClient.NewListByHypervSitePager(string, string, *HypervJobsClientListByHypervSiteOptions) *runtime.Pager[HypervJobsClientListByHypervSiteResponse]` +- New function `NewHypervJobsControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*HypervJobsControllerClient, error)` +- New function `*HypervJobsControllerClient.Get(context.Context, string, string, string, *HypervJobsControllerClientGetOptions) (HypervJobsControllerClientGetResponse, error)` +- New function `*HypervJobsControllerClient.NewListByVmwareSitePager(string, string, *HypervJobsControllerClientListByVmwareSiteOptions) *runtime.Pager[HypervJobsControllerClientListByVmwareSiteResponse]` +- New function `NewHypervMachinesControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*HypervMachinesControllerClient, error)` +- New function `*HypervMachinesControllerClient.Get(context.Context, string, string, string, *HypervMachinesControllerClientGetOptions) (HypervMachinesControllerClientGetResponse, error)` +- New function `*HypervMachinesControllerClient.NewListByHypervSitePager(string, string, *HypervMachinesControllerClientListByHypervSiteOptions) *runtime.Pager[HypervMachinesControllerClientListByHypervSiteResponse]` +- New function `*HypervMachinesControllerClient.Update(context.Context, string, string, string, HypervMachineUpdate, *HypervMachinesControllerClientUpdateOptions) (HypervMachinesControllerClientUpdateResponse, error)` +- New function `*HypervMachinesControllerClient.BeginUpdateProperties(context.Context, string, string, MachineMetadataCollection, *HypervMachinesControllerClientBeginUpdatePropertiesOptions) (*runtime.Poller[HypervMachinesControllerClientUpdatePropertiesResponse], error)` +- New function `NewHypervOperationsStatusControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*HypervOperationsStatusControllerClient, error)` +- New function `*HypervOperationsStatusControllerClient.GetHypervOperationsStatus(context.Context, string, string, string, *HypervOperationsStatusControllerClientGetHypervOperationsStatusOptions) (HypervOperationsStatusControllerClientGetHypervOperationsStatusResponse, error)` +- New function `NewHypervRunAsAccountsControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*HypervRunAsAccountsControllerClient, error)` +- New function `*HypervRunAsAccountsControllerClient.Get(context.Context, string, string, string, *HypervRunAsAccountsControllerClientGetOptions) (HypervRunAsAccountsControllerClientGetResponse, error)` +- New function `*HypervRunAsAccountsControllerClient.NewListByHypervSitePager(string, string, *HypervRunAsAccountsControllerClientListByHypervSiteOptions) *runtime.Pager[HypervRunAsAccountsControllerClientListByHypervSiteResponse]` +- New function `NewHypervSitesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*HypervSitesClient, error)` +- New function `*HypervSitesClient.NewListByResourceGroupPager(string, *HypervSitesClientListByResourceGroupOptions) *runtime.Pager[HypervSitesClientListByResourceGroupResponse]` +- New function `*HypervSitesClient.NewListBySubscriptionPager(*HypervSitesClientListBySubscriptionOptions) *runtime.Pager[HypervSitesClientListBySubscriptionResponse]` +- New function `NewHypervSitesControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*HypervSitesControllerClient, error)` +- New function `*HypervSitesControllerClient.ComputeErrorSummary(context.Context, string, string, any, *HypervSitesControllerClientComputeErrorSummaryOptions) (HypervSitesControllerClientComputeErrorSummaryResponse, error)` +- New function `*HypervSitesControllerClient.Computeusage(context.Context, string, string, any, *HypervSitesControllerClientComputeusageOptions) (HypervSitesControllerClientComputeusageResponse, error)` +- New function `*HypervSitesControllerClient.Create(context.Context, string, string, HypervSite, *HypervSitesControllerClientCreateOptions) (HypervSitesControllerClientCreateResponse, error)` +- New function `*HypervSitesControllerClient.Delete(context.Context, string, string, *HypervSitesControllerClientDeleteOptions) (HypervSitesControllerClientDeleteResponse, error)` +- New function `*HypervSitesControllerClient.BeginExportApplications(context.Context, string, string, any, *HypervSitesControllerClientBeginExportApplicationsOptions) (*runtime.Poller[HypervSitesControllerClientExportApplicationsResponse], error)` +- New function `*HypervSitesControllerClient.BeginExportMachineErrors(context.Context, string, string, ExportMachineErrorsRequest, *HypervSitesControllerClientBeginExportMachineErrorsOptions) (*runtime.Poller[HypervSitesControllerClientExportMachineErrorsResponse], error)` +- New function `*HypervSitesControllerClient.Get(context.Context, string, string, *HypervSitesControllerClientGetOptions) (HypervSitesControllerClientGetResponse, error)` +- New function `*HypervSitesControllerClient.ListHealthSummary(context.Context, string, string, *HypervSitesControllerClientListHealthSummaryOptions) (HypervSitesControllerClientListHealthSummaryResponse, error)` +- New function `*HypervSitesControllerClient.Summary(context.Context, string, string, *HypervSitesControllerClientSummaryOptions) (HypervSitesControllerClientSummaryResponse, error)` +- New function `*HypervSitesControllerClient.Update(context.Context, string, string, HypervSiteUpdate, *HypervSitesControllerClientUpdateOptions) (HypervSitesControllerClientUpdateResponse, error)` +- New function `NewHypervSoftwareInventoriesControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*HypervSoftwareInventoriesControllerClient, error)` +- New function `*HypervSoftwareInventoriesControllerClient.GetMachineSoftwareInventory(context.Context, string, string, string, Default, *HypervSoftwareInventoriesControllerClientGetMachineSoftwareInventoryOptions) (HypervSoftwareInventoriesControllerClientGetMachineSoftwareInventoryResponse, error)` +- New function `*HypervSoftwareInventoriesControllerClient.NewListByHypervMachinePager(string, string, string, *HypervSoftwareInventoriesControllerClientListByHypervMachineOptions) *runtime.Pager[HypervSoftwareInventoriesControllerClientListByHypervMachineResponse]` +- New function `NewIisWebApplicationsControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*IisWebApplicationsControllerClient, error)` +- New function `*IisWebApplicationsControllerClient.Get(context.Context, string, string, string, string, *IisWebApplicationsControllerClientGetOptions) (IisWebApplicationsControllerClientGetResponse, error)` +- New function `*IisWebApplicationsControllerClient.NewListByWebAppSitePager(string, string, string, *IisWebApplicationsControllerClientListByWebAppSiteOptions) *runtime.Pager[IisWebApplicationsControllerClientListByWebAppSiteResponse]` +- New function `*IisWebApplicationsControllerClient.Update(context.Context, string, string, string, string, IisWebApplicationsUpdate, *IisWebApplicationsControllerClientUpdateOptions) (IisWebApplicationsControllerClientUpdateResponse, error)` +- New function `NewIisWebServersControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*IisWebServersControllerClient, error)` +- New function `*IisWebServersControllerClient.Get(context.Context, string, string, string, string, *IisWebServersControllerClientGetOptions) (IisWebServersControllerClientGetResponse, error)` +- New function `*IisWebServersControllerClient.NewListByWebAppSitePager(string, string, string, *IisWebServersControllerClientListByWebAppSiteOptions) *runtime.Pager[IisWebServersControllerClientListByWebAppSiteResponse]` +- New function `NewImportJobsControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ImportJobsControllerClient, error)` +- New function `*ImportJobsControllerClient.Get(context.Context, string, string, string, *ImportJobsControllerClientGetOptions) (ImportJobsControllerClientGetResponse, error)` +- New function `*ImportJobsControllerClient.GetDeletejob(context.Context, string, string, string, *ImportJobsControllerClientGetDeletejobOptions) (ImportJobsControllerClientGetDeletejobResponse, error)` +- New function `*ImportJobsControllerClient.GetExportjob(context.Context, string, string, string, *ImportJobsControllerClientGetExportjobOptions) (ImportJobsControllerClientGetExportjobResponse, error)` +- New function `*ImportJobsControllerClient.GetImportjob(context.Context, string, string, string, *ImportJobsControllerClientGetImportjobOptions) (ImportJobsControllerClientGetImportjobResponse, error)` +- New function `*ImportJobsControllerClient.NewListByImportSitePager(string, string, *ImportJobsControllerClientListByImportSiteOptions) *runtime.Pager[ImportJobsControllerClientListByImportSiteResponse]` +- New function `*ImportJobsControllerClient.NewListDeletejobsPager(string, string, *ImportJobsControllerClientListDeletejobsOptions) *runtime.Pager[ImportJobsControllerClientListDeletejobsResponse]` +- New function `*ImportJobsControllerClient.NewListExportjobsPager(string, string, *ImportJobsControllerClientListExportjobsOptions) *runtime.Pager[ImportJobsControllerClientListExportjobsResponse]` +- New function `*ImportJobsControllerClient.NewListImportjobsPager(string, string, *ImportJobsControllerClientListImportjobsOptions) *runtime.Pager[ImportJobsControllerClientListImportjobsResponse]` +- New function `NewImportMachinesControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ImportMachinesControllerClient, error)` +- New function `*ImportMachinesControllerClient.Delete(context.Context, string, string, string, *ImportMachinesControllerClientDeleteOptions) (ImportMachinesControllerClientDeleteResponse, error)` +- New function `*ImportMachinesControllerClient.Get(context.Context, string, string, string, *ImportMachinesControllerClientGetOptions) (ImportMachinesControllerClientGetResponse, error)` +- New function `*ImportMachinesControllerClient.NewListByImportSitePager(string, string, *ImportMachinesControllerClientListByImportSiteOptions) *runtime.Pager[ImportMachinesControllerClientListByImportSiteResponse]` +- New function `NewImportSitesControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ImportSitesControllerClient, error)` +- New function `*ImportSitesControllerClient.Create(context.Context, string, string, ImportSite, *ImportSitesControllerClientCreateOptions) (ImportSitesControllerClientCreateResponse, error)` +- New function `*ImportSitesControllerClient.Delete(context.Context, string, string, *ImportSitesControllerClientDeleteOptions) (ImportSitesControllerClientDeleteResponse, error)` +- New function `*ImportSitesControllerClient.DeleteImportedMachines(context.Context, string, string, any, *ImportSitesControllerClientDeleteImportedMachinesOptions) (ImportSitesControllerClientDeleteImportedMachinesResponse, error)` +- New function `*ImportSitesControllerClient.ExportURI(context.Context, string, string, SasURIResponse, *ImportSitesControllerClientExportURIOptions) (ImportSitesControllerClientExportURIResponse, error)` +- New function `*ImportSitesControllerClient.Get(context.Context, string, string, *ImportSitesControllerClientGetOptions) (ImportSitesControllerClientGetResponse, error)` +- New function `*ImportSitesControllerClient.ImportURI(context.Context, string, string, SasURIResponse, *ImportSitesControllerClientImportURIOptions) (ImportSitesControllerClientImportURIResponse, error)` +- New function `*ImportSitesControllerClient.NewListByResourceGroupPager(string, *ImportSitesControllerClientListByResourceGroupOptions) *runtime.Pager[ImportSitesControllerClientListByResourceGroupResponse]` +- New function `*ImportSitesControllerClient.NewListBySubscriptionPager(*ImportSitesControllerClientListBySubscriptionOptions) *runtime.Pager[ImportSitesControllerClientListBySubscriptionResponse]` +- New function `*ImportSitesControllerClient.Update(context.Context, string, string, ImportSiteUpdate, *ImportSitesControllerClientUpdateOptions) (ImportSitesControllerClientUpdateResponse, error)` +- New function `NewMachinesControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*MachinesControllerClient, error)` +- New function `*MachinesControllerClient.Get(context.Context, string, string, string, *MachinesControllerClientGetOptions) (MachinesControllerClientGetResponse, error)` +- New function `*MachinesControllerClient.NewListByVmwareSitePager(string, string, *MachinesControllerClientListByVmwareSiteOptions) *runtime.Pager[MachinesControllerClientListByVmwareSiteResponse]` +- New function `*MachinesControllerClient.BeginStart(context.Context, string, string, string, *MachinesControllerClientBeginStartOptions) (*runtime.Poller[MachinesControllerClientStartResponse], error)` +- New function `*MachinesControllerClient.BeginStop(context.Context, string, string, string, *MachinesControllerClientBeginStopOptions) (*runtime.Poller[MachinesControllerClientStopResponse], error)` +- New function `*MachinesControllerClient.Update(context.Context, string, string, string, MachineResourceUpdate, *MachinesControllerClientUpdateOptions) (MachinesControllerClientUpdateResponse, error)` +- New function `NewMasterSitesControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*MasterSitesControllerClient, error)` +- New function `*MasterSitesControllerClient.BeginCreate(context.Context, string, string, MasterSite, *MasterSitesControllerClientBeginCreateOptions) (*runtime.Poller[MasterSitesControllerClientCreateResponse], error)` +- New function `*MasterSitesControllerClient.Delete(context.Context, string, string, *MasterSitesControllerClientDeleteOptions) (MasterSitesControllerClientDeleteResponse, error)` +- New function `*MasterSitesControllerClient.ErrorSummary(context.Context, string, string, ErrorSummaryRequest, *MasterSitesControllerClientErrorSummaryOptions) (MasterSitesControllerClientErrorSummaryResponse, error)` +- New function `*MasterSitesControllerClient.Get(context.Context, string, string, *MasterSitesControllerClientGetOptions) (MasterSitesControllerClientGetResponse, error)` +- New function `*MasterSitesControllerClient.NewListByResourceGroupPager(string, *MasterSitesControllerClientListByResourceGroupOptions) *runtime.Pager[MasterSitesControllerClientListByResourceGroupResponse]` +- New function `*MasterSitesControllerClient.NewListBySubscriptionPager(*MasterSitesControllerClientListBySubscriptionOptions) *runtime.Pager[MasterSitesControllerClientListBySubscriptionResponse]` +- New function `*MasterSitesControllerClient.BeginUpdate(context.Context, string, string, MasterSiteUpdate, *MasterSitesControllerClientBeginUpdateOptions) (*runtime.Poller[MasterSitesControllerClientUpdateResponse], error)` +- New function `NewMasterSitesOperationsStatusControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*MasterSitesOperationsStatusControllerClient, error)` +- New function `*MasterSitesOperationsStatusControllerClient.GetVmwareOperationStatus(context.Context, string, string, string, *MasterSitesOperationsStatusControllerClientGetVmwareOperationStatusOptions) (MasterSitesOperationsStatusControllerClientGetVmwareOperationStatusResponse, error)` +- New function `PossibleDefaultValues() []Default` +- New function `PossibleDefaultValuesValues() []DefaultValues` +- New function `PossibleHighAvailabilityValues() []HighAvailability` +- New function `PossibleHighAvailabilityValuesValues() []HighAvailabilityValues` +- New function `NewPrivateEndpointConnectionControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*PrivateEndpointConnectionControllerClient, error)` +- New function `*PrivateEndpointConnectionControllerClient.Create(context.Context, string, string, string, PrivateEndpointConnection, *PrivateEndpointConnectionControllerClientCreateOptions) (PrivateEndpointConnectionControllerClientCreateResponse, error)` +- New function `*PrivateEndpointConnectionControllerClient.Delete(context.Context, string, string, string, *PrivateEndpointConnectionControllerClientDeleteOptions) (PrivateEndpointConnectionControllerClientDeleteResponse, error)` +- New function `*PrivateEndpointConnectionControllerClient.Get(context.Context, string, string, string, *PrivateEndpointConnectionControllerClientGetOptions) (PrivateEndpointConnectionControllerClientGetResponse, error)` +- New function `*PrivateEndpointConnectionControllerClient.NewListByMasterSitePager(string, string, *PrivateEndpointConnectionControllerClientListByMasterSiteOptions) *runtime.Pager[PrivateEndpointConnectionControllerClientListByMasterSiteResponse]` +- New function `NewPrivateLinkResourcesControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*PrivateLinkResourcesControllerClient, error)` +- New function `*PrivateLinkResourcesControllerClient.Get(context.Context, string, string, string, *PrivateLinkResourcesControllerClientGetOptions) (PrivateLinkResourcesControllerClientGetResponse, error)` +- New function `*PrivateLinkResourcesControllerClient.NewListByMasterSitePager(string, string, *PrivateLinkResourcesControllerClientListByMasterSiteOptions) *runtime.Pager[PrivateLinkResourcesControllerClientListByMasterSiteResponse]` +- New function `NewRunAsAccountsControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*RunAsAccountsControllerClient, error)` +- New function `*RunAsAccountsControllerClient.Get(context.Context, string, string, string, *RunAsAccountsControllerClientGetOptions) (RunAsAccountsControllerClientGetResponse, error)` +- New function `*RunAsAccountsControllerClient.NewListByVmwareSitePager(string, string, *RunAsAccountsControllerClientListByVmwareSiteOptions) *runtime.Pager[RunAsAccountsControllerClientListByVmwareSiteResponse]` +- New function `NewSQLAvailabilityGroupsControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*SQLAvailabilityGroupsControllerClient, error)` +- New function `*SQLAvailabilityGroupsControllerClient.Get(context.Context, string, string, string, string, *SQLAvailabilityGroupsControllerClientGetOptions) (SQLAvailabilityGroupsControllerClientGetResponse, error)` +- New function `*SQLAvailabilityGroupsControllerClient.NewListBySQLSitePager(string, string, string, *SQLAvailabilityGroupsControllerClientListBySQLSiteOptions) *runtime.Pager[SQLAvailabilityGroupsControllerClientListBySQLSiteResponse]` +- New function `NewSQLDatabasesControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*SQLDatabasesControllerClient, error)` +- New function `*SQLDatabasesControllerClient.Get(context.Context, string, string, string, string, *SQLDatabasesControllerClientGetOptions) (SQLDatabasesControllerClientGetResponse, error)` +- New function `*SQLDatabasesControllerClient.NewListBySQLSitePager(string, string, string, *SQLDatabasesControllerClientListBySQLSiteOptions) *runtime.Pager[SQLDatabasesControllerClientListBySQLSiteResponse]` +- New function `NewSQLDiscoverySiteDataSourceControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*SQLDiscoverySiteDataSourceControllerClient, error)` +- New function `*SQLDiscoverySiteDataSourceControllerClient.BeginCreate(context.Context, string, string, string, string, SQLDiscoverySiteDataSource, *SQLDiscoverySiteDataSourceControllerClientBeginCreateOptions) (*runtime.Poller[SQLDiscoverySiteDataSourceControllerClientCreateResponse], error)` +- New function `*SQLDiscoverySiteDataSourceControllerClient.Delete(context.Context, string, string, string, string, *SQLDiscoverySiteDataSourceControllerClientDeleteOptions) (SQLDiscoverySiteDataSourceControllerClientDeleteResponse, error)` +- New function `*SQLDiscoverySiteDataSourceControllerClient.Get(context.Context, string, string, string, string, *SQLDiscoverySiteDataSourceControllerClientGetOptions) (SQLDiscoverySiteDataSourceControllerClientGetResponse, error)` +- New function `*SQLDiscoverySiteDataSourceControllerClient.NewListBySQLSitePager(string, string, string, *SQLDiscoverySiteDataSourceControllerClientListBySQLSiteOptions) *runtime.Pager[SQLDiscoverySiteDataSourceControllerClientListBySQLSiteResponse]` +- New function `NewSQLJobsControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*SQLJobsControllerClient, error)` +- New function `*SQLJobsControllerClient.Get(context.Context, string, string, string, string, *SQLJobsControllerClientGetOptions) (SQLJobsControllerClientGetResponse, error)` +- New function `*SQLJobsControllerClient.NewListBySQLSitePager(string, string, string, *SQLJobsControllerClientListBySQLSiteOptions) *runtime.Pager[SQLJobsControllerClientListBySQLSiteResponse]` +- New function `NewSQLOperationsStatusControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*SQLOperationsStatusControllerClient, error)` +- New function `*SQLOperationsStatusControllerClient.GetSQLOperationStatus(context.Context, string, string, string, string, *SQLOperationsStatusControllerClientGetSQLOperationStatusOptions) (SQLOperationsStatusControllerClientGetSQLOperationStatusResponse, error)` +- New function `NewSQLRunAsAccountsControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*SQLRunAsAccountsControllerClient, error)` +- New function `*SQLRunAsAccountsControllerClient.Get(context.Context, string, string, string, string, *SQLRunAsAccountsControllerClientGetOptions) (SQLRunAsAccountsControllerClientGetResponse, error)` +- New function `*SQLRunAsAccountsControllerClient.NewListBySQLSitePager(string, string, string, *SQLRunAsAccountsControllerClientListBySQLSiteOptions) *runtime.Pager[SQLRunAsAccountsControllerClientListBySQLSiteResponse]` +- New function `NewSQLServersControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*SQLServersControllerClient, error)` +- New function `*SQLServersControllerClient.Get(context.Context, string, string, string, string, *SQLServersControllerClientGetOptions) (SQLServersControllerClientGetResponse, error)` +- New function `*SQLServersControllerClient.NewListBySQLSitePager(string, string, string, *SQLServersControllerClientListBySQLSiteOptions) *runtime.Pager[SQLServersControllerClientListBySQLSiteResponse]` +- New function `*SQLServersControllerClient.Update(context.Context, string, string, string, string, SQLServerV2Update, *SQLServersControllerClientUpdateOptions) (SQLServersControllerClientUpdateResponse, error)` +- New function `NewSQLSitesControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*SQLSitesControllerClient, error)` +- New function `*SQLSitesControllerClient.Create(context.Context, string, string, string, SQLSite, *SQLSitesControllerClientCreateOptions) (SQLSitesControllerClientCreateResponse, error)` +- New function `*SQLSitesControllerClient.Delete(context.Context, string, string, string, *SQLSitesControllerClientDeleteOptions) (SQLSitesControllerClientDeleteResponse, error)` +- New function `*SQLSitesControllerClient.ErrorSummary(context.Context, string, string, string, ErrorSummaryRequest, *SQLSitesControllerClientErrorSummaryOptions) (SQLSitesControllerClientErrorSummaryResponse, error)` +- New function `*SQLSitesControllerClient.BeginExportSQLServerErrors(context.Context, string, string, string, any, *SQLSitesControllerClientBeginExportSQLServerErrorsOptions) (*runtime.Poller[SQLSitesControllerClientExportSQLServerErrorsResponse], error)` +- New function `*SQLSitesControllerClient.BeginExportSQLServers(context.Context, string, string, string, ExportSQLServersRequest, *SQLSitesControllerClientBeginExportSQLServersOptions) (*runtime.Poller[SQLSitesControllerClientExportSQLServersResponse], error)` +- New function `*SQLSitesControllerClient.Get(context.Context, string, string, string, *SQLSitesControllerClientGetOptions) (SQLSitesControllerClientGetResponse, error)` +- New function `*SQLSitesControllerClient.NewListByMasterSitePager(string, string, *SQLSitesControllerClientListByMasterSiteOptions) *runtime.Pager[SQLSitesControllerClientListByMasterSiteResponse]` +- New function `*SQLSitesControllerClient.BeginRefresh(context.Context, string, string, string, SQLSiteRefreshBody, *SQLSitesControllerClientBeginRefreshOptions) (*runtime.Poller[SQLSitesControllerClientRefreshResponse], error)` +- New function `*SQLSitesControllerClient.Summary(context.Context, string, string, string, *SQLSitesControllerClientSummaryOptions) (SQLSitesControllerClientSummaryResponse, error)` +- New function `*SQLSitesControllerClient.BeginUpdate(context.Context, string, string, string, SQLSiteUpdate, *SQLSitesControllerClientBeginUpdateOptions) (*runtime.Poller[SQLSitesControllerClientUpdateResponse], error)` +- New function `NewServerDependencyMapControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ServerDependencyMapControllerClient, error)` +- New function `*ServerDependencyMapControllerClient.BeginClientGroupMembers(context.Context, string, string, DependencyMapServiceMapextensionsClientGroupMembersRequest, *ServerDependencyMapControllerClientBeginClientGroupMembersOptions) (*runtime.Poller[ServerDependencyMapControllerClientClientGroupMembersResponse], error)` +- New function `*ServerDependencyMapControllerClient.BeginExportDependencies(context.Context, string, string, DependencyMapServiceMapextensionsExportDependenciesRequest, *ServerDependencyMapControllerClientBeginExportDependenciesOptions) (*runtime.Poller[ServerDependencyMapControllerClientExportDependenciesResponse], error)` +- New function `*ServerDependencyMapControllerClient.BeginGenerateCoarseMap(context.Context, string, string, DependencyMapServiceMapextensionsScopeMapRequest, *ServerDependencyMapControllerClientBeginGenerateCoarseMapOptions) (*runtime.Poller[ServerDependencyMapControllerClientGenerateCoarseMapResponse], error)` +- New function `*ServerDependencyMapControllerClient.BeginGenerateDetailedMap(context.Context, string, string, DependencyMapServiceMapextensionsSingleMachineDetailedMapRequest, *ServerDependencyMapControllerClientBeginGenerateDetailedMapOptions) (*runtime.Poller[ServerDependencyMapControllerClientGenerateDetailedMapResponse], error)` +- New function `*ServerDependencyMapControllerClient.BeginServerGroupMembers(context.Context, string, string, DependencyMapServiceMapextensionsServerGroupMembersRequest, *ServerDependencyMapControllerClientBeginServerGroupMembersOptions) (*runtime.Poller[ServerDependencyMapControllerClientServerGroupMembersResponse], error)` +- New function `NewServerJobsControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ServerJobsControllerClient, error)` +- New function `*ServerJobsControllerClient.Get(context.Context, string, string, string, *ServerJobsControllerClientGetOptions) (ServerJobsControllerClientGetResponse, error)` +- New function `*ServerJobsControllerClient.NewListByServerSiteResourcePager(string, string, *ServerJobsControllerClientListByServerSiteResourceOptions) *runtime.Pager[ServerJobsControllerClientListByServerSiteResourceResponse]` +- New function `NewServerOperationsStatusControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ServerOperationsStatusControllerClient, error)` +- New function `*ServerOperationsStatusControllerClient.GetServerSiteOperationsStatus(context.Context, string, string, string, *ServerOperationsStatusControllerClientGetServerSiteOperationsStatusOptions) (ServerOperationsStatusControllerClientGetServerSiteOperationsStatusResponse, error)` +- New function `NewServerRunAsAccountsControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ServerRunAsAccountsControllerClient, error)` +- New function `*ServerRunAsAccountsControllerClient.Get(context.Context, string, string, string, *ServerRunAsAccountsControllerClientGetOptions) (ServerRunAsAccountsControllerClientGetResponse, error)` +- New function `*ServerRunAsAccountsControllerClient.NewListByServerSiteResourcePager(string, string, *ServerRunAsAccountsControllerClientListByServerSiteResourceOptions) *runtime.Pager[ServerRunAsAccountsControllerClientListByServerSiteResourceResponse]` +- New function `NewServerSitesControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ServerSitesControllerClient, error)` +- New function `*ServerSitesControllerClient.ComputeErrorSummary(context.Context, string, string, any, *ServerSitesControllerClientComputeErrorSummaryOptions) (ServerSitesControllerClientComputeErrorSummaryResponse, error)` +- New function `*ServerSitesControllerClient.Computeusage(context.Context, string, string, any, *ServerSitesControllerClientComputeusageOptions) (ServerSitesControllerClientComputeusageResponse, error)` +- New function `*ServerSitesControllerClient.BeginCreate(context.Context, string, string, ServerSiteResource, *ServerSitesControllerClientBeginCreateOptions) (*runtime.Poller[ServerSitesControllerClientCreateResponse], error)` +- New function `*ServerSitesControllerClient.Delete(context.Context, string, string, *ServerSitesControllerClientDeleteOptions) (ServerSitesControllerClientDeleteResponse, error)` +- New function `*ServerSitesControllerClient.BeginExportApplications(context.Context, string, string, any, *ServerSitesControllerClientBeginExportApplicationsOptions) (*runtime.Poller[ServerSitesControllerClientExportApplicationsResponse], error)` +- New function `*ServerSitesControllerClient.BeginExportMachineErrors(context.Context, string, string, ExportMachineErrorsRequest, *ServerSitesControllerClientBeginExportMachineErrorsOptions) (*runtime.Poller[ServerSitesControllerClientExportMachineErrorsResponse], error)` +- New function `*ServerSitesControllerClient.Get(context.Context, string, string, *ServerSitesControllerClientGetOptions) (ServerSitesControllerClientGetResponse, error)` +- New function `*ServerSitesControllerClient.NewListByResourceGroupPager(string, *ServerSitesControllerClientListByResourceGroupOptions) *runtime.Pager[ServerSitesControllerClientListByResourceGroupResponse]` +- New function `*ServerSitesControllerClient.NewListBySubscriptionPager(*ServerSitesControllerClientListBySubscriptionOptions) *runtime.Pager[ServerSitesControllerClientListBySubscriptionResponse]` +- New function `*ServerSitesControllerClient.ListHealthSummary(context.Context, string, string, *ServerSitesControllerClientListHealthSummaryOptions) (ServerSitesControllerClientListHealthSummaryResponse, error)` +- New function `*ServerSitesControllerClient.BeginRefreshSite(context.Context, string, string, *ServerSitesControllerClientBeginRefreshSiteOptions) (*runtime.Poller[ServerSitesControllerClientRefreshSiteResponse], error)` +- New function `*ServerSitesControllerClient.Summary(context.Context, string, string, *ServerSitesControllerClientSummaryOptions) (ServerSitesControllerClientSummaryResponse, error)` +- New function `*ServerSitesControllerClient.Update(context.Context, string, string, ServerSiteResourceUpdate, *ServerSitesControllerClientUpdateOptions) (ServerSitesControllerClientUpdateResponse, error)` +- New function `*ServerSitesControllerClient.BeginUpdateDependencyMapStatus(context.Context, string, string, UpdateMachineDepMapStatus, *ServerSitesControllerClientBeginUpdateDependencyMapStatusOptions) (*runtime.Poller[ServerSitesControllerClientUpdateDependencyMapStatusResponse], error)` +- New function `*ServerSitesControllerClient.BeginUpdateProperties(context.Context, string, string, MachineMetadataCollection, *ServerSitesControllerClientBeginUpdatePropertiesOptions) (*runtime.Poller[ServerSitesControllerClientUpdatePropertiesResponse], error)` +- New function `NewServerSoftwareInventoriesControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ServerSoftwareInventoriesControllerClient, error)` +- New function `*ServerSoftwareInventoriesControllerClient.GetMachineSoftwareInventory(context.Context, string, string, string, Default, *ServerSoftwareInventoriesControllerClientGetMachineSoftwareInventoryOptions) (ServerSoftwareInventoriesControllerClientGetMachineSoftwareInventoryResponse, error)` +- New function `*ServerSoftwareInventoriesControllerClient.NewListByServerPager(string, string, string, *ServerSoftwareInventoriesControllerClientListByServerOptions) *runtime.Pager[ServerSoftwareInventoriesControllerClientListByServerResponse]` +- New function `NewServersControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ServersControllerClient, error)` +- New function `*ServersControllerClient.DeleteMachine(context.Context, string, string, string, *ServersControllerClientDeleteMachineOptions) (ServersControllerClientDeleteMachineResponse, error)` +- New function `*ServersControllerClient.GetMachine(context.Context, string, string, string, *ServersControllerClientGetMachineOptions) (ServersControllerClientGetMachineResponse, error)` +- New function `*ServersControllerClient.NewListByServerSiteResourcePager(string, string, *ServersControllerClientListByServerSiteResourceOptions) *runtime.Pager[ServersControllerClientListByServerSiteResourceResponse]` +- New function `*ServersControllerClient.UpdateMachine(context.Context, string, string, string, ServerUpdate, *ServersControllerClientUpdateMachineOptions) (ServersControllerClientUpdateMachineResponse, error)` +- New function `NewSitesControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*SitesControllerClient, error)` +- New function `*SitesControllerClient.ComputeErrorSummary(context.Context, string, string, any, *SitesControllerClientComputeErrorSummaryOptions) (SitesControllerClientComputeErrorSummaryResponse, error)` +- New function `*SitesControllerClient.Computeusage(context.Context, string, string, any, *SitesControllerClientComputeusageOptions) (SitesControllerClientComputeusageResponse, error)` +- New function `*SitesControllerClient.Create(context.Context, string, string, VmwareSite, *SitesControllerClientCreateOptions) (SitesControllerClientCreateResponse, error)` +- New function `*SitesControllerClient.Delete(context.Context, string, string, *SitesControllerClientDeleteOptions) (SitesControllerClientDeleteResponse, error)` +- New function `*SitesControllerClient.BeginExportApplications(context.Context, string, string, any, *SitesControllerClientBeginExportApplicationsOptions) (*runtime.Poller[SitesControllerClientExportApplicationsResponse], error)` +- New function `*SitesControllerClient.BeginExportMachineErrors(context.Context, string, string, ExportMachineErrorsRequest, *SitesControllerClientBeginExportMachineErrorsOptions) (*runtime.Poller[SitesControllerClientExportMachineErrorsResponse], error)` +- New function `*SitesControllerClient.BeginExportMachines(context.Context, string, string, ExportMachinesRequest, *SitesControllerClientBeginExportMachinesOptions) (*runtime.Poller[SitesControllerClientExportMachinesResponse], error)` +- New function `*SitesControllerClient.Get(context.Context, string, string, *SitesControllerClientGetOptions) (SitesControllerClientGetResponse, error)` +- New function `*SitesControllerClient.NewListByResourceGroupPager(string, *SitesControllerClientListByResourceGroupOptions) *runtime.Pager[SitesControllerClientListByResourceGroupResponse]` +- New function `*SitesControllerClient.NewListBySubscriptionPager(*SitesControllerClientListBySubscriptionOptions) *runtime.Pager[SitesControllerClientListBySubscriptionResponse]` +- New function `*SitesControllerClient.ListHealthSummary(context.Context, string, string, *SitesControllerClientListHealthSummaryOptions) (SitesControllerClientListHealthSummaryResponse, error)` +- New function `*SitesControllerClient.Summary(context.Context, string, string, *SitesControllerClientSummaryOptions) (SitesControllerClientSummaryResponse, error)` +- New function `*SitesControllerClient.Update(context.Context, string, string, VmwareSiteUpdate, *SitesControllerClientUpdateOptions) (SitesControllerClientUpdateResponse, error)` +- New function `NewTomcatWebApplicationsControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*TomcatWebApplicationsControllerClient, error)` +- New function `*TomcatWebApplicationsControllerClient.Get(context.Context, string, string, string, string, *TomcatWebApplicationsControllerClientGetOptions) (TomcatWebApplicationsControllerClientGetResponse, error)` +- New function `*TomcatWebApplicationsControllerClient.NewListByWebAppSitePager(string, string, string, *TomcatWebApplicationsControllerClientListByWebAppSiteOptions) *runtime.Pager[TomcatWebApplicationsControllerClientListByWebAppSiteResponse]` +- New function `*TomcatWebApplicationsControllerClient.Update(context.Context, string, string, string, string, any, *TomcatWebApplicationsControllerClientUpdateOptions) (TomcatWebApplicationsControllerClientUpdateResponse, error)` +- New function `NewTomcatWebServersControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*TomcatWebServersControllerClient, error)` +- New function `*TomcatWebServersControllerClient.Get(context.Context, string, string, string, string, *TomcatWebServersControllerClientGetOptions) (TomcatWebServersControllerClientGetResponse, error)` +- New function `*TomcatWebServersControllerClient.NewListByWebAppSitePager(string, string, string, *TomcatWebServersControllerClientListByWebAppSiteOptions) *runtime.Pager[TomcatWebServersControllerClientListByWebAppSiteResponse]` +- New function `NewVcenterControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*VcenterControllerClient, error)` +- New function `*VcenterControllerClient.BeginCreate(context.Context, string, string, string, Vcenter, *VcenterControllerClientBeginCreateOptions) (*runtime.Poller[VcenterControllerClientCreateResponse], error)` +- New function `*VcenterControllerClient.Delete(context.Context, string, string, string, *VcenterControllerClientDeleteOptions) (VcenterControllerClientDeleteResponse, error)` +- New function `*VcenterControllerClient.Get(context.Context, string, string, string, *VcenterControllerClientGetOptions) (VcenterControllerClientGetResponse, error)` +- New function `*VcenterControllerClient.NewListByVmwareSitePager(string, string, *VcenterControllerClientListByVmwareSiteOptions) *runtime.Pager[VcenterControllerClientListByVmwareSiteResponse]` +- New function `NewVmwareHostControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*VmwareHostControllerClient, error)` +- New function `*VmwareHostControllerClient.Get(context.Context, string, string, string, *VmwareHostControllerClientGetOptions) (VmwareHostControllerClientGetResponse, error)` +- New function `*VmwareHostControllerClient.NewListByVmwareSitePager(string, string, *VmwareHostControllerClientListByVmwareSiteOptions) *runtime.Pager[VmwareHostControllerClientListByVmwareSiteResponse]` +- New function `NewVmwareOperationsStatusClient(string, azcore.TokenCredential, *arm.ClientOptions) (*VmwareOperationsStatusClient, error)` +- New function `*VmwareOperationsStatusClient.GetVmwareOperationStatus(context.Context, string, string, string, *VmwareOperationsStatusClientGetVmwareOperationStatusOptions) (VmwareOperationsStatusClientGetVmwareOperationStatusResponse, error)` +- New function `NewVmwarePropertiesControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*VmwarePropertiesControllerClient, error)` +- New function `*VmwarePropertiesControllerClient.BeginUpdateDependencyMapStatus(context.Context, string, string, UpdateMachineDepMapStatus, *VmwarePropertiesControllerClientBeginUpdateDependencyMapStatusOptions) (*runtime.Poller[VmwarePropertiesControllerClientUpdateDependencyMapStatusResponse], error)` +- New function `*VmwarePropertiesControllerClient.BeginUpdateProperties(context.Context, string, string, MachineMetadataCollection, *VmwarePropertiesControllerClientBeginUpdatePropertiesOptions) (*runtime.Poller[VmwarePropertiesControllerClientUpdatePropertiesResponse], error)` +- New function `*VmwarePropertiesControllerClient.BeginUpdateRunAsAccount(context.Context, string, string, UpdateMachineRunAsAccount, *VmwarePropertiesControllerClientBeginUpdateRunAsAccountOptions) (*runtime.Poller[VmwarePropertiesControllerClientUpdateRunAsAccountResponse], error)` +- New function `*VmwarePropertiesControllerClient.BeginUpdateTags(context.Context, string, string, UpdateMachineTags, *VmwarePropertiesControllerClientBeginUpdateTagsOptions) (*runtime.Poller[VmwarePropertiesControllerClientUpdateTagsResponse], error)` +- New function `NewVmwareSoftwareInventoriesControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*VmwareSoftwareInventoriesControllerClient, error)` +- New function `*VmwareSoftwareInventoriesControllerClient.GetMachineSoftwareInventory(context.Context, string, string, string, Default, *VmwareSoftwareInventoriesControllerClientGetMachineSoftwareInventoryOptions) (VmwareSoftwareInventoriesControllerClientGetMachineSoftwareInventoryResponse, error)` +- New function `*VmwareSoftwareInventoriesControllerClient.NewListByMachineResourcePager(string, string, string, *VmwareSoftwareInventoriesControllerClientListByMachineResourceOptions) *runtime.Pager[VmwareSoftwareInventoriesControllerClientListByMachineResourceResponse]` +- New function `NewWebAppDiscoverySiteDataSourcesControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*WebAppDiscoverySiteDataSourcesControllerClient, error)` +- New function `*WebAppDiscoverySiteDataSourcesControllerClient.BeginCreate(context.Context, string, string, string, string, DiscoverySiteDataSource, *WebAppDiscoverySiteDataSourcesControllerClientBeginCreateOptions) (*runtime.Poller[WebAppDiscoverySiteDataSourcesControllerClientCreateResponse], error)` +- New function `*WebAppDiscoverySiteDataSourcesControllerClient.BeginDelete(context.Context, string, string, string, string, *WebAppDiscoverySiteDataSourcesControllerClientBeginDeleteOptions) (*runtime.Poller[WebAppDiscoverySiteDataSourcesControllerClientDeleteResponse], error)` +- New function `*WebAppDiscoverySiteDataSourcesControllerClient.Get(context.Context, string, string, string, string, *WebAppDiscoverySiteDataSourcesControllerClientGetOptions) (WebAppDiscoverySiteDataSourcesControllerClientGetResponse, error)` +- New function `*WebAppDiscoverySiteDataSourcesControllerClient.NewListByWebAppSitePager(string, string, string, *WebAppDiscoverySiteDataSourcesControllerClientListByWebAppSiteOptions) *runtime.Pager[WebAppDiscoverySiteDataSourcesControllerClientListByWebAppSiteResponse]` +- New function `NewWebAppExtendedMachinesControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*WebAppExtendedMachinesControllerClient, error)` +- New function `*WebAppExtendedMachinesControllerClient.Get(context.Context, string, string, string, string, *WebAppExtendedMachinesControllerClientGetOptions) (WebAppExtendedMachinesControllerClientGetResponse, error)` +- New function `*WebAppExtendedMachinesControllerClient.NewListByWebAppSitePager(string, string, string, *WebAppExtendedMachinesControllerClientListByWebAppSiteOptions) *runtime.Pager[WebAppExtendedMachinesControllerClientListByWebAppSiteResponse]` +- New function `NewWebAppPropertiesControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*WebAppPropertiesControllerClient, error)` +- New function `*WebAppPropertiesControllerClient.BeginUpdateProperties(context.Context, string, string, string, WebAppPropertiesCollection, *WebAppPropertiesControllerClientBeginUpdatePropertiesOptions) (*runtime.Poller[WebAppPropertiesControllerClientUpdatePropertiesResponse], error)` +- New function `NewWebAppRunAsAccountsControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*WebAppRunAsAccountsControllerClient, error)` +- New function `*WebAppRunAsAccountsControllerClient.Get(context.Context, string, string, string, string, *WebAppRunAsAccountsControllerClientGetOptions) (WebAppRunAsAccountsControllerClientGetResponse, error)` +- New function `*WebAppRunAsAccountsControllerClient.NewListByWebAppSitePager(string, string, string, *WebAppRunAsAccountsControllerClientListByWebAppSiteOptions) *runtime.Pager[WebAppRunAsAccountsControllerClientListByWebAppSiteResponse]` +- New function `NewWebAppSitesControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*WebAppSitesControllerClient, error)` +- New function `*WebAppSitesControllerClient.Create(context.Context, string, string, string, WebAppSite, *WebAppSitesControllerClientCreateOptions) (WebAppSitesControllerClientCreateResponse, error)` +- New function `*WebAppSitesControllerClient.BeginDelete(context.Context, string, string, string, *WebAppSitesControllerClientBeginDeleteOptions) (*runtime.Poller[WebAppSitesControllerClientDeleteResponse], error)` +- New function `*WebAppSitesControllerClient.ErrorSummary(context.Context, string, string, string, ErrorSummaryRequest, *WebAppSitesControllerClientErrorSummaryOptions) (WebAppSitesControllerClientErrorSummaryResponse, error)` +- New function `*WebAppSitesControllerClient.BeginExportInventory(context.Context, string, string, string, ExportWebAppsRequest, *WebAppSitesControllerClientBeginExportInventoryOptions) (*runtime.Poller[WebAppSitesControllerClientExportInventoryResponse], error)` +- New function `*WebAppSitesControllerClient.Get(context.Context, string, string, string, *WebAppSitesControllerClientGetOptions) (WebAppSitesControllerClientGetResponse, error)` +- New function `*WebAppSitesControllerClient.NewListByMasterSitePager(string, string, *WebAppSitesControllerClientListByMasterSiteOptions) *runtime.Pager[WebAppSitesControllerClientListByMasterSiteResponse]` +- New function `*WebAppSitesControllerClient.BeginRefresh(context.Context, string, string, string, ProxySiteRefreshBody, *WebAppSitesControllerClientBeginRefreshOptions) (*runtime.Poller[WebAppSitesControllerClientRefreshResponse], error)` +- New function `*WebAppSitesControllerClient.Summary(context.Context, string, string, string, *WebAppSitesControllerClientSummaryOptions) (WebAppSitesControllerClientSummaryResponse, error)` +- New function `*WebAppSitesControllerClient.BeginUpdate(context.Context, string, string, string, WebAppSiteUpdate, *WebAppSitesControllerClientBeginUpdateOptions) (*runtime.Poller[WebAppSitesControllerClientUpdateResponse], error)` +- New function `NewWebApplicationsControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*WebApplicationsControllerClient, error)` +- New function `*WebApplicationsControllerClient.NewListByWebAppSitePager(string, string, string, *WebApplicationsControllerClientListByWebAppSiteOptions) *runtime.Pager[WebApplicationsControllerClientListByWebAppSiteResponse]` +- New function `NewWebServersControllerClient(string, azcore.TokenCredential, *arm.ClientOptions) (*WebServersControllerClient, error)` +- New function `*WebServersControllerClient.NewListByWebAppSitePager(string, string, string, *WebServersControllerClientListByWebAppSiteOptions) *runtime.Pager[WebServersControllerClientListByWebAppSiteResponse]` +- New struct `Application` +- New struct `ApplicationDiscovery` +- New struct `AppsAndRoles` +- New struct `BizTalkServer` +- New struct `ConnectorUnit` +- New struct `DeleteImportMachinesJob` +- New struct `DeleteImportMachinesJobCollection` +- New struct `DeleteImportedMachinesJobProperties` +- New struct `DependencyMapDiscovery` +- New struct `DependencyMapMachineInput` +- New struct `DependencyMapServiceMapextensionsClientGroupMembersRequest` +- New struct `DependencyMapServiceMapextensionsDependencyMapRequestFilters` +- New struct `DependencyMapServiceMapextensionsExportDependenciesRequest` +- New struct `DependencyMapServiceMapextensionsScopeMapRequest` +- New struct `DependencyMapServiceMapextensionsServerGroupMembersRequest` +- New struct `DependencyMapServiceMapextensionsSingleMachineDetailedMapRequest` +- New struct `DirectoryPath` +- New struct `DiscoveryScopeErrorSummary` +- New struct `DiscoverySiteDataSource` +- New struct `DiscoverySiteDataSourceListResult` +- New struct `DiscoverySiteDataSourceProperties` +- New struct `ErrorAdditionalInfo` +- New struct `ErrorDetail` +- New struct `ErrorDetails` +- New struct `ErrorResponse` +- New struct `ErrorSummaryRequest` +- New struct `Errors` +- New struct `ExchangeServer` +- New struct `ExportImportedMachinesJob` +- New struct `ExportImportedMachinesJobEntityProperties` +- New struct `ExportMachineErrorsRequest` +- New struct `ExportMachinesRequest` +- New struct `ExportSQLServersRequest` +- New struct `ExportWebAppsRequest` +- New struct `Feature` +- New struct `FileMetaData` +- New struct `FrontEndBinding` +- New struct `GuestOsDetails` +- New struct `HealthErrorDetails` +- New struct `HypervCluster` +- New struct `HypervClusterListResult` +- New struct `HypervClusterProperties` +- New struct `HypervDisk` +- New struct `HypervHost` +- New struct `HypervHostListResult` +- New struct `HypervHostProperties` +- New struct `HypervJob` +- New struct `HypervJobListResult` +- New struct `HypervMachine` +- New struct `HypervMachineListResult` +- New struct `HypervMachineProperties` +- New struct `HypervMachineUpdate` +- New struct `HypervMachineUpdateProperties` +- New struct `HypervNetworkAdapter` +- New struct `HypervOperationsStatusResource` +- New struct `HypervRunAsAccountResource` +- New struct `HypervRunAsAccountResourceListResult` +- New struct `HypervSite` +- New struct `HypervSiteListResult` +- New struct `HypervSiteUpdate` +- New struct `HypervSiteUpdateProperties` +- New struct `HypervSiteUsage` +- New struct `HypervVMSoftwareInventory` +- New struct `HypervVMSoftwareInventoryListResult` +- New struct `IisApplicationUnit` +- New struct `IisVirtualApplicationUnit` +- New struct `IisWebApplicationProperties` +- New struct `IisWebApplications` +- New struct `IisWebApplicationsListResult` +- New struct `IisWebApplicationsUpdate` +- New struct `IisWebApplicationsUpdateProperties` +- New struct `IisWebServerProperties` +- New struct `IisWebServers` +- New struct `IisWebServersListResult` +- New struct `ImportJob` +- New struct `ImportJobListResult` +- New struct `ImportMachine` +- New struct `ImportMachineListResult` +- New struct `ImportMachineProperties` +- New struct `ImportMachinesJob` +- New struct `ImportMachinesJobProperties` +- New struct `ImportSite` +- New struct `ImportSiteListResult` +- New struct `ImportSiteProperties` +- New struct `ImportSiteUpdate` +- New struct `ImportSiteUpdateProperties` +- New struct `JobErrorSummary` +- New struct `JobProperties` +- New struct `MachineMetadata` +- New struct `MachineMetadataCollection` +- New struct `MachineResource` +- New struct `MachineResourceListResult` +- New struct `MachineResourceUpdate` +- New struct `MachineResourceUpdateProperties` +- New struct `MachineSoftwareInventoryProperties` +- New struct `MasterSite` +- New struct `MasterSiteListResult` +- New struct `MasterSiteProperties` +- New struct `MasterSiteUpdate` +- New struct `MasterSiteUpdateProperties` +- New struct `OperatingSystem` +- New struct `OperationListResult` +- New struct `OperationStatus` +- New struct `OperationStatusError` +- New struct `OperationStatusProperties` +- New struct `OracleDiscovery` +- New struct `OtherDatabase` +- New struct `PagedDeleteImportMachinesJob` +- New struct `PagedExportImportedMachinesJob` +- New struct `PagedImportMachinesJob` +- New struct `PrivateEndpointConnectionListResult` +- New struct `PrivateEndpointConnectionPropertiesV2` +- New struct `PrivateLinkResourceListResult` +- New struct `ProcessorInfo` +- New struct `ProductSupportStatus` +- New struct `ProxyResource` +- New struct `ProxySiteRefreshBody` +- New struct `RequestExportMachineErrorsProperties` +- New struct `Resource` +- New struct `RunAsAccountMachineInput` +- New struct `RunAsAccountProperties` +- New struct `SQLAvailabilityGroup` +- New struct `SQLAvailabilityGroupListResult` +- New struct `SQLAvailabilityGroupProperties` +- New struct `SQLAvailabilityGroupReplicaInfo` +- New struct `SQLAvailabilityReplicaOverview` +- New struct `SQLAvailabilityReplicaProperties` +- New struct `SQLDatabasePropertiesV2` +- New struct `SQLDatabaseReplicaInfo` +- New struct `SQLDatabaseV2` +- New struct `SQLDatabaseV2ListResult` +- New struct `SQLDiscovery` +- New struct `SQLDiscoverySiteDataSource` +- New struct `SQLDiscoverySiteDataSourceListResult` +- New struct `SQLDiscoverySiteDataSourceProperties` +- New struct `SQLFciProperties` +- New struct `SQLJob` +- New struct `SQLJobListResult` +- New struct `SQLMachineOverview` +- New struct `SQLRunAsAccount` +- New struct `SQLRunAsAccountListResult` +- New struct `SQLServerApplication` +- New struct `SQLServerProperties` +- New struct `SQLServerV2` +- New struct `SQLServerV2ListResult` +- New struct `SQLServerV2Update` +- New struct `SQLServerV2UpdateProperties` +- New struct `SQLSite` +- New struct `SQLSiteListResult` +- New struct `SQLSiteProperties` +- New struct `SQLSiteRefreshBody` +- New struct `SQLSiteUpdate` +- New struct `SQLSiteUpdateProperties` +- New struct `SQLSiteUsage` +- New struct `SasURIResponse` +- New struct `Server` +- New struct `ServerDisk` +- New struct `ServerJob` +- New struct `ServerJobListResult` +- New struct `ServerListResult` +- New struct `ServerNetworkAdapter` +- New struct `ServerProperties` +- New struct `ServerRunAsAccount` +- New struct `ServerRunAsAccountListResult` +- New struct `ServerSiteResource` +- New struct `ServerSiteResourceListResult` +- New struct `ServerSiteResourceUpdate` +- New struct `ServerSiteResourceUpdateProperties` +- New struct `ServerSiteUsage` +- New struct `ServerSiteUsageResponse` +- New struct `ServerSoftwareInventory` +- New struct `ServerSoftwareInventoryListResult` +- New struct `ServerUpdate` +- New struct `ServerUpdateProperties` +- New struct `SharePointServer` +- New struct `SiteAgentProperties` +- New struct `SiteApplianceProperties` +- New struct `SiteErrorSummary` +- New struct `SiteHealthSummary` +- New struct `SiteHealthSummaryCollection` +- New struct `SiteProperties` +- New struct `SiteSpnProperties` +- New struct `SitesProperties` +- New struct `SpringBootDiscovery` +- New struct `StaticDiscovery` +- New struct `SystemCenter` +- New struct `SystemData` +- New struct `TagsMachineInput` +- New struct `TomcatEngineUnit` +- New struct `TomcatHostUnit` +- New struct `TomcatServiceUnit` +- New struct `TomcatWebApplicationProperties` +- New struct `TomcatWebApplications` +- New struct `TomcatWebApplicationsListResult` +- New struct `TomcatWebServerProperties` +- New struct `TomcatWebServers` +- New struct `TomcatWebServersListResult` +- New struct `TrackedResource` +- New struct `UpdateMachineDepMapStatus` +- New struct `UpdateMachineRunAsAccount` +- New struct `UpdateMachineTags` +- New struct `V20180501PreviewVmwareRunAsAccount` +- New struct `V20180501PreviewVmwareRunAsAccountVmwareRunAsAccountCollection` +- New struct `Vcenter` +- New struct `VcenterListResult` +- New struct `VcenterProperties` +- New struct `VmwareDatastore` +- New struct `VmwareDisk` +- New struct `VmwareHost` +- New struct `VmwareHostListResult` +- New struct `VmwareHostProperties` +- New struct `VmwareJob` +- New struct `VmwareJobListResult` +- New struct `VmwareMachineProperties` +- New struct `VmwareMachineSoftwareInventory` +- New struct `VmwareMachineSoftwareInventoryListResult` +- New struct `VmwareNetworkAdapter` +- New struct `VmwareRunAsAccountResource` +- New struct `VmwareRunAsAccountResourceListResult` +- New struct `VmwareSite` +- New struct `VmwareSiteListResult` +- New struct `VmwareSiteUpdate` +- New struct `VmwareSiteUpdateProperties` +- New struct `VmwareSiteUsage` +- New struct `WebAppDiscovery` +- New struct `WebAppExtendedMachine` +- New struct `WebAppExtendedMachineListResult` +- New struct `WebAppExtendedMachineProperties` +- New struct `WebAppProperties` +- New struct `WebAppPropertiesCollection` +- New struct `WebAppRunAsAccount` +- New struct `WebAppRunAsAccountListResult` +- New struct `WebAppSite` +- New struct `WebAppSiteListResult` +- New struct `WebAppSiteProperties` +- New struct `WebAppSiteUpdate` +- New struct `WebAppSiteUpdateProperties` +- New struct `WebAppSiteUsage` +- New struct `WebApplication` +- New struct `WebApplicationAppsAndRolesModel` +- New struct `WebApplicationConfigurationUnit` +- New struct `WebApplicationDirectoryUnit` +- New struct `WebApplicationFramework` +- New struct `WebApplicationListResult` +- New struct `WebApplicationProperties` +- New struct `WebRoleImportDisk` +- New struct `WebRoleOperatingSystem` +- New struct `WebServer` +- New struct `WebServerListResult` +- New struct `WebServerProperties` +- New field `ActionType`, `IsDataAction` in struct `Operation` +- New anonymous field `OperationListResult` in struct `OperationsClientListResponse` +- New field `SystemData` in struct `PrivateEndpointConnection` +- New field `SystemData` in struct `PrivateLinkResource` +- New field `ProvisioningState` in struct `PrivateLinkResourceProperties` + + ## 1.2.0 (2023-11-24) ### Features Added diff --git a/sdk/resourcemanager/migrate/armmigrate/README.md b/sdk/resourcemanager/migrate/armmigrate/README.md index e38ce48d7cd0..2d99c95a1f4d 100644 --- a/sdk/resourcemanager/migrate/armmigrate/README.md +++ b/sdk/resourcemanager/migrate/armmigrate/README.md @@ -1,6 +1,6 @@ # Azure Migrate Module for Go -[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate) +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2) The `armmigrate` module provides operations for working with Azure Migrate. @@ -20,7 +20,7 @@ This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for ve Install the Azure Migrate module: ```sh -go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2 ``` ## Authorization @@ -57,7 +57,7 @@ clientFactory, err := armmigrate.NewClientFactory(, cred, &opti A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory. ```go -client := clientFactory.NewGroupsClient() +client := clientFactory.NewDependencyMapControllerClient() ``` ## Fakes diff --git a/sdk/resourcemanager/migrate/armmigrate/assessedmachines_client.go b/sdk/resourcemanager/migrate/armmigrate/assessedmachines_client.go deleted file mode 100644 index 69d8f0705980..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/assessedmachines_client.go +++ /dev/null @@ -1,208 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmigrate - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// AssessedMachinesClient contains the methods for the AssessedMachines group. -// Don't use this type directly, use NewAssessedMachinesClient() instead. -type AssessedMachinesClient struct { - internal *arm.Client - subscriptionID string -} - -// NewAssessedMachinesClient creates a new instance of AssessedMachinesClient with the specified values. -// - subscriptionID - Azure Subscription Id in which project was created. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewAssessedMachinesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AssessedMachinesClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &AssessedMachinesClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Get an assessed machine with its size & cost estimate that was evaluated in the specified assessment. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - groupName - Unique name of a group within a project. -// - assessmentName - Unique name of an assessment within a project. -// - assessedMachineName - Unique name of an assessed machine evaluated as part of an assessment. -// - options - AssessedMachinesClientGetOptions contains the optional parameters for the AssessedMachinesClient.Get method. -func (client *AssessedMachinesClient) Get(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, assessedMachineName string, options *AssessedMachinesClientGetOptions) (AssessedMachinesClientGetResponse, error) { - var err error - const operationName = "AssessedMachinesClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, groupName, assessmentName, assessedMachineName, options) - if err != nil { - return AssessedMachinesClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AssessedMachinesClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AssessedMachinesClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *AssessedMachinesClient) getCreateRequest(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, assessedMachineName string, options *AssessedMachinesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/assessments/{assessmentName}/assessedMachines/{assessedMachineName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if groupName == "" { - return nil, errors.New("parameter groupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) - if assessmentName == "" { - return nil, errors.New("parameter assessmentName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{assessmentName}", url.PathEscape(assessmentName)) - if assessedMachineName == "" { - return nil, errors.New("parameter assessedMachineName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{assessedMachineName}", url.PathEscape(assessedMachineName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *AssessedMachinesClient) getHandleResponse(resp *http.Response) (AssessedMachinesClientGetResponse, error) { - result := AssessedMachinesClientGetResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.AssessedMachine); err != nil { - return AssessedMachinesClientGetResponse{}, err - } - return result, nil -} - -// NewListByAssessmentPager - Get list of machines that assessed as part of the specified assessment. Returns a json array -// of objects of type 'assessedMachine' as specified in the Models section. -// Whenever an assessment is created or updated, it goes under computation. During this phase, the 'status' field of Assessment -// object reports 'Computing'. During the period when the assessment is under -// computation, the list of assessed machines is empty and no assessed machines are returned by this call. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - groupName - Unique name of a group within a project. -// - assessmentName - Unique name of an assessment within a project. -// - options - AssessedMachinesClientListByAssessmentOptions contains the optional parameters for the AssessedMachinesClient.NewListByAssessmentPager -// method. -func (client *AssessedMachinesClient) NewListByAssessmentPager(resourceGroupName string, projectName string, groupName string, assessmentName string, options *AssessedMachinesClientListByAssessmentOptions) *runtime.Pager[AssessedMachinesClientListByAssessmentResponse] { - return runtime.NewPager(runtime.PagingHandler[AssessedMachinesClientListByAssessmentResponse]{ - More: func(page AssessedMachinesClientListByAssessmentResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *AssessedMachinesClientListByAssessmentResponse) (AssessedMachinesClientListByAssessmentResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AssessedMachinesClient.NewListByAssessmentPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listByAssessmentCreateRequest(ctx, resourceGroupName, projectName, groupName, assessmentName, options) - }, nil) - if err != nil { - return AssessedMachinesClientListByAssessmentResponse{}, err - } - return client.listByAssessmentHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByAssessmentCreateRequest creates the ListByAssessment request. -func (client *AssessedMachinesClient) listByAssessmentCreateRequest(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, options *AssessedMachinesClientListByAssessmentOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/assessments/{assessmentName}/assessedMachines" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if groupName == "" { - return nil, errors.New("parameter groupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) - if assessmentName == "" { - return nil, errors.New("parameter assessmentName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{assessmentName}", url.PathEscape(assessmentName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByAssessmentHandleResponse handles the ListByAssessment response. -func (client *AssessedMachinesClient) listByAssessmentHandleResponse(resp *http.Response) (AssessedMachinesClientListByAssessmentResponse, error) { - result := AssessedMachinesClientListByAssessmentResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.AssessedMachineResultList); err != nil { - return AssessedMachinesClientListByAssessmentResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/assessedmachines_client_example_test.go b/sdk/resourcemanager/migrate/armmigrate/assessedmachines_client_example_test.go deleted file mode 100644 index e0ba10b46036..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/assessedmachines_client_example_test.go +++ /dev/null @@ -1,267 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmigrate_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/AssessedMachines_ListByAssessment.json -func ExampleAssessedMachinesClient_NewListByAssessmentPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAssessedMachinesClient().NewListByAssessmentPager("abgoyal-westEurope", "abgoyalWEselfhostb72bproject", "Test1", "assessment_5_9_2019_16_22_14", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AssessedMachineResultList = armmigrate.AssessedMachineResultList{ - // Value: []*armmigrate.AssessedMachine{ - // { - // Name: to.Ptr("f57fe432-3bd2-486a-a83a-6f4d99f1a952"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/groups/assessments/assessedMachines"), - // ETag: to.Ptr("\"b300e5dd-0000-0d00-0000-5cd4065f0000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/Test1/assessments/assessment_5_9_2019_16_22_14/assessedMachines/f57fe432-3bd2-486a-a83a-6f4d99f1a952"), - // Properties: &armmigrate.AssessedMachineProperties{ - // Description: to.Ptr("Microsoft Azure Migration Image on Windows Server 2016"), - // BootType: to.Ptr(armmigrate.MachineBootTypeBIOS), - // ConfidenceRatingInPercentage: to.Ptr[float64](0), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:52:15.778Z"); return t}()), - // DatacenterMachineArmID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourcegroups/abgoyal-westeurope/providers/microsoft.offazure/vmwaresites/portalvcenterbc2fsite/machines/idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_52e1f68c-bea5-19ff-d0ad-6a94b79a286f"), - // DatacenterManagementServerArmID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westEurope/providers/Microsoft.OffAzure/VMwareSites/PortalvCenterbc2fsite/vcenters/idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3"), - // DatacenterManagementServerName: to.Ptr("IDCLAB-A360.fareast.corp.microsoft.com"), - // Disks: map[string]*armmigrate.AssessedDisk{ - // "6000C299-02f5-d137-9bab-8a8ee7b192a0": &armmigrate.AssessedDisk{ - // Name: to.Ptr("6000C299-02f5-d137-9bab-8a8ee7b192a0"), - // DisplayName: to.Ptr("scsi0:0"), - // GigabytesForRecommendedDiskSize: to.Ptr[int32](128), - // GigabytesProvisioned: to.Ptr[float64](80), - // MegabytesPerSecondOfRead: to.Ptr[float64](0), - // MegabytesPerSecondOfWrite: to.Ptr[float64](0), - // MonthlyStorageCost: to.Ptr[float64](5.888), - // NumberOfReadOperationsPerSecond: to.Ptr[float64](0), - // NumberOfWriteOperationsPerSecond: to.Ptr[float64](0), - // RecommendedDiskSize: to.Ptr(armmigrate.AzureDiskSizeStandardS10), - // RecommendedDiskType: to.Ptr(armmigrate.AzureDiskTypeStandard), - // Suitability: to.Ptr(armmigrate.CloudSuitabilitySuitable), - // SuitabilityDetail: to.Ptr(armmigrate.AzureDiskSuitabilityDetail("NumberOfReadOperationsPerSecondMissing, NumberOfWriteOperationsPerSecondMissing, MegabytesPerSecondOfReadMissing, MegabytesPerSecondOfWriteMissing")), - // SuitabilityExplanation: to.Ptr(armmigrate.AzureDiskSuitabilityExplanationNotApplicable), - // }, - // }, - // DisplayName: to.Ptr("SHubhamVMNew"), - // MegabytesOfMemory: to.Ptr[float64](16384), - // MegabytesOfMemoryForRecommendedSize: to.Ptr[float64](16384), - // MonthlyBandwidthCost: to.Ptr[float64](0), - // MonthlyComputeCostForRecommendedSize: to.Ptr[float64](101.138616), - // MonthlyPremiumStorageCost: to.Ptr[float64](0), - // MonthlyStandardSSDStorageCost: to.Ptr[float64](0), - // MonthlyStorageCost: to.Ptr[float64](5.888), - // NetworkAdapters: map[string]*armmigrate.AssessedNetworkAdapter{ - // "4000": &armmigrate.AssessedNetworkAdapter{ - // DisplayName: to.Ptr("VM Network"), - // IPAddresses: []*string{ - // }, - // MacAddress: to.Ptr("00:0c:29:ad:13:d3"), - // MegabytesPerSecondReceived: to.Ptr[float64](0), - // MegabytesPerSecondTransmitted: to.Ptr[float64](0), - // MonthlyBandwidthCosts: to.Ptr[float64](0), - // NetGigabytesTransmittedPerMonth: to.Ptr[float64](0), - // Suitability: to.Ptr(armmigrate.CloudSuitabilitySuitable), - // SuitabilityDetail: to.Ptr(armmigrate.AzureNetworkAdapterSuitabilityDetailMegabytesOfDataTransmittedMissing), - // SuitabilityExplanation: to.Ptr(armmigrate.AzureNetworkAdapterSuitabilityExplanationNotApplicable), - // }, - // }, - // NumberOfCores: to.Ptr[int32](8), - // NumberOfCoresForRecommendedSize: to.Ptr[int32](8), - // OperatingSystemName: to.Ptr("Microsoft Windows Server 2016 (64-bit)"), - // OperatingSystemType: to.Ptr("windowsGuest"), - // PercentageCoresUtilization: to.Ptr[float64](0), - // PercentageMemoryUtilization: to.Ptr[float64](0), - // RecommendedSize: to.Ptr(armmigrate.AzureVMSizeStandardF8SV2), - // Suitability: to.Ptr(armmigrate.CloudSuitabilitySuitable), - // SuitabilityDetail: to.Ptr(armmigrate.AzureVMSuitabilityDetail("PercentageOfCoresUtilizedMissing, PercentageOfMemoryUtilizedMissing")), - // SuitabilityExplanation: to.Ptr(armmigrate.AzureVMSuitabilityExplanationNotApplicable), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:52:15.778Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("3b4a34a6-c729-46d2-bfd1-bcb52cc4935e"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/groups/assessments/assessedMachines"), - // ETag: to.Ptr("\"b300e6dd-0000-0d00-0000-5cd4065f0000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/Test1/assessments/assessment_5_9_2019_16_22_14/assessedMachines/3b4a34a6-c729-46d2-bfd1-bcb52cc4935e"), - // Properties: &armmigrate.AssessedMachineProperties{ - // Description: to.Ptr("Microsoft Azure Migration Image on Windows Server 2016"), - // BootType: to.Ptr(armmigrate.MachineBootTypeBIOS), - // ConfidenceRatingInPercentage: to.Ptr[float64](0), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:52:15.778Z"); return t}()), - // DatacenterMachineArmID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourcegroups/abgoyal-westeurope/providers/microsoft.offazure/vmwaresites/portalvcenterbc2fsite/machines/idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_50296915-8b4b-5c82-79a1-adf3966acb6b"), - // DatacenterManagementServerArmID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westEurope/providers/Microsoft.OffAzure/VMwareSites/PortalvCenterbc2fsite/vcenters/idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3"), - // DatacenterManagementServerName: to.Ptr("IDCLAB-A360.fareast.corp.microsoft.com"), - // Disks: map[string]*armmigrate.AssessedDisk{ - // "6000C298-8305-5635-e618-3a8675c42495": &armmigrate.AssessedDisk{ - // Name: to.Ptr("6000C298-8305-5635-e618-3a8675c42495"), - // DisplayName: to.Ptr("scsi0:0"), - // GigabytesForRecommendedDiskSize: to.Ptr[int32](128), - // GigabytesProvisioned: to.Ptr[float64](80), - // MegabytesPerSecondOfRead: to.Ptr[float64](0), - // MegabytesPerSecondOfWrite: to.Ptr[float64](0), - // MonthlyStorageCost: to.Ptr[float64](5.888), - // NumberOfReadOperationsPerSecond: to.Ptr[float64](0), - // NumberOfWriteOperationsPerSecond: to.Ptr[float64](0), - // RecommendedDiskSize: to.Ptr(armmigrate.AzureDiskSizeStandardS10), - // RecommendedDiskType: to.Ptr(armmigrate.AzureDiskTypeStandard), - // Suitability: to.Ptr(armmigrate.CloudSuitabilitySuitable), - // SuitabilityDetail: to.Ptr(armmigrate.AzureDiskSuitabilityDetail("NumberOfReadOperationsPerSecondMissing, NumberOfWriteOperationsPerSecondMissing, MegabytesPerSecondOfReadMissing, MegabytesPerSecondOfWriteMissing")), - // SuitabilityExplanation: to.Ptr(armmigrate.AzureDiskSuitabilityExplanationNotApplicable), - // }, - // }, - // DisplayName: to.Ptr("testfpl1"), - // MegabytesOfMemory: to.Ptr[float64](16384), - // MegabytesOfMemoryForRecommendedSize: to.Ptr[float64](16384), - // MonthlyBandwidthCost: to.Ptr[float64](0), - // MonthlyComputeCostForRecommendedSize: to.Ptr[float64](101.138616), - // MonthlyPremiumStorageCost: to.Ptr[float64](0), - // MonthlyStandardSSDStorageCost: to.Ptr[float64](0), - // MonthlyStorageCost: to.Ptr[float64](5.888), - // NetworkAdapters: map[string]*armmigrate.AssessedNetworkAdapter{ - // "4000": &armmigrate.AssessedNetworkAdapter{ - // DisplayName: to.Ptr("VM Network"), - // IPAddresses: []*string{ - // }, - // MacAddress: to.Ptr("00:50:56:a9:35:ca"), - // MegabytesPerSecondReceived: to.Ptr[float64](0), - // MegabytesPerSecondTransmitted: to.Ptr[float64](0), - // MonthlyBandwidthCosts: to.Ptr[float64](0), - // NetGigabytesTransmittedPerMonth: to.Ptr[float64](0), - // Suitability: to.Ptr(armmigrate.CloudSuitabilitySuitable), - // SuitabilityDetail: to.Ptr(armmigrate.AzureNetworkAdapterSuitabilityDetailMegabytesOfDataTransmittedMissing), - // SuitabilityExplanation: to.Ptr(armmigrate.AzureNetworkAdapterSuitabilityExplanationNotApplicable), - // }, - // }, - // NumberOfCores: to.Ptr[int32](8), - // NumberOfCoresForRecommendedSize: to.Ptr[int32](8), - // OperatingSystemName: to.Ptr("Microsoft Windows Server 2016 (64-bit)"), - // OperatingSystemType: to.Ptr("windowsguest"), - // PercentageCoresUtilization: to.Ptr[float64](0), - // PercentageMemoryUtilization: to.Ptr[float64](0), - // RecommendedSize: to.Ptr(armmigrate.AzureVMSizeStandardF8SV2), - // Suitability: to.Ptr(armmigrate.CloudSuitabilitySuitable), - // SuitabilityDetail: to.Ptr(armmigrate.AzureVMSuitabilityDetail("PercentageOfCoresUtilizedMissing, PercentageOfMemoryUtilizedMissing")), - // SuitabilityExplanation: to.Ptr(armmigrate.AzureVMSuitabilityExplanationNotApplicable), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:52:15.778Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/AssessedMachines_Get.json -func ExampleAssessedMachinesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAssessedMachinesClient().Get(ctx, "abgoyal-westEurope", "abgoyalWEselfhostb72bproject", "Test1", "assessment_5_9_2019_16_22_14", "f57fe432-3bd2-486a-a83a-6f4d99f1a952", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AssessedMachine = armmigrate.AssessedMachine{ - // Name: to.Ptr("f57fe432-3bd2-486a-a83a-6f4d99f1a952"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/groups/assessments/assessedMachines"), - // ETag: to.Ptr("\"b300e5dd-0000-0d00-0000-5cd4065f0000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/Test1/assessments/assessment_5_9_2019_16_22_14/assessedMachines/f57fe432-3bd2-486a-a83a-6f4d99f1a952"), - // Properties: &armmigrate.AssessedMachineProperties{ - // Description: to.Ptr("Microsoft Azure Migration Image on Windows Server 2016"), - // BootType: to.Ptr(armmigrate.MachineBootTypeBIOS), - // ConfidenceRatingInPercentage: to.Ptr[float64](0), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:52:15.778Z"); return t}()), - // DatacenterMachineArmID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourcegroups/abgoyal-westeurope/providers/microsoft.offazure/vmwaresites/portalvcenterbc2fsite/machines/idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_52e1f68c-bea5-19ff-d0ad-6a94b79a286f"), - // DatacenterManagementServerArmID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westEurope/providers/Microsoft.OffAzure/VMwareSites/PortalvCenterbc2fsite/vcenters/idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3"), - // DatacenterManagementServerName: to.Ptr("IDCLAB-A360.fareast.corp.microsoft.com"), - // Disks: map[string]*armmigrate.AssessedDisk{ - // "6000C299-02f5-d137-9bab-8a8ee7b192a0": &armmigrate.AssessedDisk{ - // Name: to.Ptr("6000C299-02f5-d137-9bab-8a8ee7b192a0"), - // DisplayName: to.Ptr("scsi0:0"), - // GigabytesForRecommendedDiskSize: to.Ptr[int32](128), - // GigabytesProvisioned: to.Ptr[float64](80), - // MegabytesPerSecondOfRead: to.Ptr[float64](0), - // MegabytesPerSecondOfWrite: to.Ptr[float64](0), - // MonthlyStorageCost: to.Ptr[float64](5.888), - // NumberOfReadOperationsPerSecond: to.Ptr[float64](0), - // NumberOfWriteOperationsPerSecond: to.Ptr[float64](0), - // RecommendedDiskSize: to.Ptr(armmigrate.AzureDiskSizeStandardS10), - // RecommendedDiskType: to.Ptr(armmigrate.AzureDiskTypeStandard), - // Suitability: to.Ptr(armmigrate.CloudSuitabilitySuitable), - // SuitabilityDetail: to.Ptr(armmigrate.AzureDiskSuitabilityDetail("NumberOfReadOperationsPerSecondMissing, NumberOfWriteOperationsPerSecondMissing, MegabytesPerSecondOfReadMissing, MegabytesPerSecondOfWriteMissing")), - // SuitabilityExplanation: to.Ptr(armmigrate.AzureDiskSuitabilityExplanationNotApplicable), - // }, - // }, - // DisplayName: to.Ptr("SHubhamVMNew"), - // MegabytesOfMemory: to.Ptr[float64](16384), - // MegabytesOfMemoryForRecommendedSize: to.Ptr[float64](16384), - // MonthlyBandwidthCost: to.Ptr[float64](0), - // MonthlyComputeCostForRecommendedSize: to.Ptr[float64](101.138616), - // MonthlyPremiumStorageCost: to.Ptr[float64](0), - // MonthlyStandardSSDStorageCost: to.Ptr[float64](0), - // MonthlyStorageCost: to.Ptr[float64](5.888), - // NetworkAdapters: map[string]*armmigrate.AssessedNetworkAdapter{ - // "4000": &armmigrate.AssessedNetworkAdapter{ - // DisplayName: to.Ptr("VM Network"), - // IPAddresses: []*string{ - // }, - // MacAddress: to.Ptr("00:0c:29:ad:13:d3"), - // MegabytesPerSecondReceived: to.Ptr[float64](0), - // MegabytesPerSecondTransmitted: to.Ptr[float64](0), - // MonthlyBandwidthCosts: to.Ptr[float64](0), - // NetGigabytesTransmittedPerMonth: to.Ptr[float64](0), - // Suitability: to.Ptr(armmigrate.CloudSuitabilitySuitable), - // SuitabilityDetail: to.Ptr(armmigrate.AzureNetworkAdapterSuitabilityDetailMegabytesOfDataTransmittedMissing), - // SuitabilityExplanation: to.Ptr(armmigrate.AzureNetworkAdapterSuitabilityExplanationNotApplicable), - // }, - // }, - // NumberOfCores: to.Ptr[int32](8), - // NumberOfCoresForRecommendedSize: to.Ptr[int32](8), - // OperatingSystemName: to.Ptr("Microsoft Windows Server 2016 (64-bit)"), - // OperatingSystemType: to.Ptr("windowsGuest"), - // PercentageCoresUtilization: to.Ptr[float64](0), - // PercentageMemoryUtilization: to.Ptr[float64](0), - // RecommendedSize: to.Ptr(armmigrate.AzureVMSizeStandardF8SV2), - // Suitability: to.Ptr(armmigrate.CloudSuitabilitySuitable), - // SuitabilityDetail: to.Ptr(armmigrate.AzureVMSuitabilityDetail("PercentageOfCoresUtilizedMissing, PercentageOfMemoryUtilizedMissing")), - // SuitabilityExplanation: to.Ptr(armmigrate.AzureVMSuitabilityExplanationNotApplicable), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:52:15.778Z"); return t}()), - // }, - // } -} diff --git a/sdk/resourcemanager/migrate/armmigrate/assessments_client.go b/sdk/resourcemanager/migrate/armmigrate/assessments_client.go deleted file mode 100644 index d7e114231b84..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/assessments_client.go +++ /dev/null @@ -1,513 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmigrate - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// AssessmentsClient contains the methods for the Assessments group. -// Don't use this type directly, use NewAssessmentsClient() instead. -type AssessmentsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewAssessmentsClient creates a new instance of AssessmentsClient with the specified values. -// - subscriptionID - Azure Subscription Id in which project was created. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewAssessmentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AssessmentsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &AssessmentsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Create - Create a new assessment with the given name and the specified settings. Since name of an assessment in a project -// is a unique identifier, if an assessment with the name provided already exists, then -// the existing assessment is updated. -// Any PUT operation, resulting in either create or update on an assessment, will cause the assessment to go in a "InProgress" -// state. This will be indicated by the field 'computationState' on the -// Assessment object. During this time no other PUT operation will be allowed on that assessment object, nor will a Delete -// operation. Once the computation for the assessment is complete, the field -// 'computationState' will be updated to 'Ready', and then other PUT or DELETE operations can happen on the assessment. -// When assessment is under computation, any PUT will lead to a 400 - Bad Request error. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - groupName - Unique name of a group within a project. -// - assessmentName - Unique name of an assessment within a project. -// - options - AssessmentsClientCreateOptions contains the optional parameters for the AssessmentsClient.Create method. -func (client *AssessmentsClient) Create(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, options *AssessmentsClientCreateOptions) (AssessmentsClientCreateResponse, error) { - var err error - const operationName = "AssessmentsClient.Create" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createCreateRequest(ctx, resourceGroupName, projectName, groupName, assessmentName, options) - if err != nil { - return AssessmentsClientCreateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AssessmentsClientCreateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return AssessmentsClientCreateResponse{}, err - } - resp, err := client.createHandleResponse(httpResp) - return resp, err -} - -// createCreateRequest creates the Create request. -func (client *AssessmentsClient) createCreateRequest(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, options *AssessmentsClientCreateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/assessments/{assessmentName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if groupName == "" { - return nil, errors.New("parameter groupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) - if assessmentName == "" { - return nil, errors.New("parameter assessmentName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{assessmentName}", url.PathEscape(assessmentName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.Assessment != nil { - if err := runtime.MarshalAsJSON(req, *options.Assessment); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// createHandleResponse handles the Create response. -func (client *AssessmentsClient) createHandleResponse(resp *http.Response) (AssessmentsClientCreateResponse, error) { - result := AssessmentsClientCreateResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.Assessment); err != nil { - return AssessmentsClientCreateResponse{}, err - } - return result, nil -} - -// Delete - Delete an assessment from the project. The machines remain in the assessment. Deleting a non-existent assessment -// results in a no-operation. -// When an assessment is under computation, as indicated by the 'computationState' field, it cannot be deleted. Any such attempt -// will return a 400 - Bad Request. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - groupName - Unique name of a group within a project. -// - assessmentName - Unique name of an assessment within a project. -// - options - AssessmentsClientDeleteOptions contains the optional parameters for the AssessmentsClient.Delete method. -func (client *AssessmentsClient) Delete(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, options *AssessmentsClientDeleteOptions) (AssessmentsClientDeleteResponse, error) { - var err error - const operationName = "AssessmentsClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, projectName, groupName, assessmentName, options) - if err != nil { - return AssessmentsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AssessmentsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return AssessmentsClientDeleteResponse{}, err - } - resp, err := client.deleteHandleResponse(httpResp) - return resp, err -} - -// deleteCreateRequest creates the Delete request. -func (client *AssessmentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, options *AssessmentsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/assessments/{assessmentName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if groupName == "" { - return nil, errors.New("parameter groupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) - if assessmentName == "" { - return nil, errors.New("parameter assessmentName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{assessmentName}", url.PathEscape(assessmentName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// deleteHandleResponse handles the Delete response. -func (client *AssessmentsClient) deleteHandleResponse(resp *http.Response) (AssessmentsClientDeleteResponse, error) { - result := AssessmentsClientDeleteResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - return result, nil -} - -// Get - Get an existing assessment with the specified name. Returns a json object of type 'assessment' as specified in Models -// section. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - groupName - Unique name of a group within a project. -// - assessmentName - Unique name of an assessment within a project. -// - options - AssessmentsClientGetOptions contains the optional parameters for the AssessmentsClient.Get method. -func (client *AssessmentsClient) Get(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, options *AssessmentsClientGetOptions) (AssessmentsClientGetResponse, error) { - var err error - const operationName = "AssessmentsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, groupName, assessmentName, options) - if err != nil { - return AssessmentsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AssessmentsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AssessmentsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *AssessmentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, options *AssessmentsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/assessments/{assessmentName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if groupName == "" { - return nil, errors.New("parameter groupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) - if assessmentName == "" { - return nil, errors.New("parameter assessmentName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{assessmentName}", url.PathEscape(assessmentName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *AssessmentsClient) getHandleResponse(resp *http.Response) (AssessmentsClientGetResponse, error) { - result := AssessmentsClientGetResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.Assessment); err != nil { - return AssessmentsClientGetResponse{}, err - } - return result, nil -} - -// GetReportDownloadURL - Get the URL for downloading the assessment in a report format. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - groupName - Unique name of a group within a project. -// - assessmentName - Unique name of an assessment within a project. -// - options - AssessmentsClientGetReportDownloadURLOptions contains the optional parameters for the AssessmentsClient.GetReportDownloadURL -// method. -func (client *AssessmentsClient) GetReportDownloadURL(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, options *AssessmentsClientGetReportDownloadURLOptions) (AssessmentsClientGetReportDownloadURLResponse, error) { - var err error - const operationName = "AssessmentsClient.GetReportDownloadURL" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getReportDownloadURLCreateRequest(ctx, resourceGroupName, projectName, groupName, assessmentName, options) - if err != nil { - return AssessmentsClientGetReportDownloadURLResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AssessmentsClientGetReportDownloadURLResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AssessmentsClientGetReportDownloadURLResponse{}, err - } - resp, err := client.getReportDownloadURLHandleResponse(httpResp) - return resp, err -} - -// getReportDownloadURLCreateRequest creates the GetReportDownloadURL request. -func (client *AssessmentsClient) getReportDownloadURLCreateRequest(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, options *AssessmentsClientGetReportDownloadURLOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/assessments/{assessmentName}/downloadUrl" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if groupName == "" { - return nil, errors.New("parameter groupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) - if assessmentName == "" { - return nil, errors.New("parameter assessmentName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{assessmentName}", url.PathEscape(assessmentName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getReportDownloadURLHandleResponse handles the GetReportDownloadURL response. -func (client *AssessmentsClient) getReportDownloadURLHandleResponse(resp *http.Response) (AssessmentsClientGetReportDownloadURLResponse, error) { - result := AssessmentsClientGetReportDownloadURLResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.DownloadURL); err != nil { - return AssessmentsClientGetReportDownloadURLResponse{}, err - } - return result, nil -} - -// NewListByGroupPager - Get all assessments created for the specified group. -// Returns a json array of objects of type 'assessment' as specified in Models section. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - groupName - Unique name of a group within a project. -// - options - AssessmentsClientListByGroupOptions contains the optional parameters for the AssessmentsClient.NewListByGroupPager -// method. -func (client *AssessmentsClient) NewListByGroupPager(resourceGroupName string, projectName string, groupName string, options *AssessmentsClientListByGroupOptions) *runtime.Pager[AssessmentsClientListByGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[AssessmentsClientListByGroupResponse]{ - More: func(page AssessmentsClientListByGroupResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *AssessmentsClientListByGroupResponse) (AssessmentsClientListByGroupResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AssessmentsClient.NewListByGroupPager") - req, err := client.listByGroupCreateRequest(ctx, resourceGroupName, projectName, groupName, options) - if err != nil { - return AssessmentsClientListByGroupResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AssessmentsClientListByGroupResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AssessmentsClientListByGroupResponse{}, runtime.NewResponseError(resp) - } - return client.listByGroupHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByGroupCreateRequest creates the ListByGroup request. -func (client *AssessmentsClient) listByGroupCreateRequest(ctx context.Context, resourceGroupName string, projectName string, groupName string, options *AssessmentsClientListByGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/assessments" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if groupName == "" { - return nil, errors.New("parameter groupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByGroupHandleResponse handles the ListByGroup response. -func (client *AssessmentsClient) listByGroupHandleResponse(resp *http.Response) (AssessmentsClientListByGroupResponse, error) { - result := AssessmentsClientListByGroupResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.AssessmentResultList); err != nil { - return AssessmentsClientListByGroupResponse{}, err - } - return result, nil -} - -// NewListByProjectPager - Get all assessments created in the project. -// Returns a json array of objects of type 'assessment' as specified in Models section. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - options - AssessmentsClientListByProjectOptions contains the optional parameters for the AssessmentsClient.NewListByProjectPager -// method. -func (client *AssessmentsClient) NewListByProjectPager(resourceGroupName string, projectName string, options *AssessmentsClientListByProjectOptions) *runtime.Pager[AssessmentsClientListByProjectResponse] { - return runtime.NewPager(runtime.PagingHandler[AssessmentsClientListByProjectResponse]{ - More: func(page AssessmentsClientListByProjectResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *AssessmentsClientListByProjectResponse) (AssessmentsClientListByProjectResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AssessmentsClient.NewListByProjectPager") - req, err := client.listByProjectCreateRequest(ctx, resourceGroupName, projectName, options) - if err != nil { - return AssessmentsClientListByProjectResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AssessmentsClientListByProjectResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AssessmentsClientListByProjectResponse{}, runtime.NewResponseError(resp) - } - return client.listByProjectHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByProjectCreateRequest creates the ListByProject request. -func (client *AssessmentsClient) listByProjectCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *AssessmentsClientListByProjectOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/assessments" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByProjectHandleResponse handles the ListByProject response. -func (client *AssessmentsClient) listByProjectHandleResponse(resp *http.Response) (AssessmentsClientListByProjectResponse, error) { - result := AssessmentsClientListByProjectResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.AssessmentResultList); err != nil { - return AssessmentsClientListByProjectResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/assessments_client_example_test.go b/sdk/resourcemanager/migrate/armmigrate/assessments_client_example_test.go deleted file mode 100644 index 76b50d0146e2..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/assessments_client_example_test.go +++ /dev/null @@ -1,511 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmigrate_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Assessments_ListByGroup.json -func ExampleAssessmentsClient_NewListByGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAssessmentsClient().NewListByGroupPager("abgoyal-westEurope", "abgoyalWEselfhostb72bproject", "Test1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AssessmentResultList = armmigrate.AssessmentResultList{ - // Value: []*armmigrate.Assessment{ - // { - // Name: to.Ptr("assessment_5_9_2019_16_22_14"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/groups/assessments"), - // ETag: to.Ptr("\"21009c31-0000-0d00-0000-5cd585ad0000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/Test1/assessments/assessment_5_9_2019_16_22_14"), - // Properties: &armmigrate.AssessmentProperties{ - // AzureDiskType: to.Ptr(armmigrate.AzureDiskTypeStandardOrPremium), - // AzureHybridUseBenefit: to.Ptr(armmigrate.AzureHybridUseBenefitYes), - // AzureLocation: to.Ptr(armmigrate.AzureLocationNorthEurope), - // AzureOfferCode: to.Ptr(armmigrate.AzureOfferCodeMSAZR0003P), - // AzurePricingTier: to.Ptr(armmigrate.AzurePricingTierStandard), - // AzureStorageRedundancy: to.Ptr(armmigrate.AzureStorageRedundancyLocallyRedundant), - // AzureVMFamilies: []*armmigrate.AzureVMFamily{ - // to.Ptr(armmigrate.AzureVMFamilyDv2Series), - // to.Ptr(armmigrate.AzureVMFamilyFSeries), - // to.Ptr(armmigrate.AzureVMFamilyDv3Series), - // to.Ptr(armmigrate.AzureVMFamilyDSSeries), - // to.Ptr(armmigrate.AzureVMFamilyDSv2Series), - // to.Ptr(armmigrate.AzureVMFamilyFsSeries), - // to.Ptr(armmigrate.AzureVMFamilyDsv3Series), - // to.Ptr(armmigrate.AzureVMFamilyEv3Series), - // to.Ptr(armmigrate.AzureVMFamilyEsv3Series), - // to.Ptr(armmigrate.AzureVMFamilyDSeries), - // to.Ptr(armmigrate.AzureVMFamilyMSeries), - // to.Ptr(armmigrate.AzureVMFamilyFsv2Series), - // to.Ptr(armmigrate.AzureVMFamilyHSeries)}, - // ConfidenceRatingInPercentage: to.Ptr[float64](0), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:52:14.489Z"); return t}()), - // Currency: to.Ptr(armmigrate.CurrencyUSD), - // DiscountPercentage: to.Ptr[float64](0), - // MonthlyBandwidthCost: to.Ptr[float64](0), - // MonthlyComputeCost: to.Ptr[float64](2588.830584), - // MonthlyPremiumStorageCost: to.Ptr[float64](0), - // MonthlyStandardSSDStorageCost: to.Ptr[float64](0), - // MonthlyStorageCost: to.Ptr[float64](238.016), - // NumberOfMachines: to.Ptr[int32](26), - // Percentile: to.Ptr(armmigrate.PercentilePercentile95), - // PerfDataEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:52:14.489Z"); return t}()), - // PerfDataStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-08T10:52:14.489Z"); return t}()), - // PricesTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-26T11:07:37.139Z"); return t}()), - // ReservedInstance: to.Ptr(armmigrate.ReservedInstanceRI3Year), - // ScalingFactor: to.Ptr[float64](1), - // SizingCriterion: to.Ptr(armmigrate.AssessmentSizingCriterionPerformanceBased), - // Stage: to.Ptr(armmigrate.AssessmentStageInProgress), - // Status: to.Ptr(armmigrate.AssessmentStatusOutDated), - // TimeRange: to.Ptr(armmigrate.TimeRangeDay), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:52:14.489Z"); return t}()), - // VMUptime: &armmigrate.VMUptime{ - // DaysPerMonth: to.Ptr[int32](31), - // HoursPerDay: to.Ptr[int32](24), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Assessments_ListByProject.json -func ExampleAssessmentsClient_NewListByProjectPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAssessmentsClient().NewListByProjectPager("abgoyal-westEurope", "abgoyalWEselfhostb72bproject", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AssessmentResultList = armmigrate.AssessmentResultList{ - // Value: []*armmigrate.Assessment{ - // { - // Name: to.Ptr("assessment_5_9_2019_16_22_14"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/groups/assessments"), - // ETag: to.Ptr("\"21009c31-0000-0d00-0000-5cd585ad0000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/Test1/assessments/assessment_5_9_2019_16_22_14"), - // Properties: &armmigrate.AssessmentProperties{ - // AzureDiskType: to.Ptr(armmigrate.AzureDiskTypeStandardOrPremium), - // AzureHybridUseBenefit: to.Ptr(armmigrate.AzureHybridUseBenefitYes), - // AzureLocation: to.Ptr(armmigrate.AzureLocationNorthEurope), - // AzureOfferCode: to.Ptr(armmigrate.AzureOfferCodeMSAZR0003P), - // AzurePricingTier: to.Ptr(armmigrate.AzurePricingTierStandard), - // AzureStorageRedundancy: to.Ptr(armmigrate.AzureStorageRedundancyLocallyRedundant), - // AzureVMFamilies: []*armmigrate.AzureVMFamily{ - // to.Ptr(armmigrate.AzureVMFamilyDv2Series), - // to.Ptr(armmigrate.AzureVMFamilyFSeries), - // to.Ptr(armmigrate.AzureVMFamilyDv3Series), - // to.Ptr(armmigrate.AzureVMFamilyDSSeries), - // to.Ptr(armmigrate.AzureVMFamilyDSv2Series), - // to.Ptr(armmigrate.AzureVMFamilyFsSeries), - // to.Ptr(armmigrate.AzureVMFamilyDsv3Series), - // to.Ptr(armmigrate.AzureVMFamilyEv3Series), - // to.Ptr(armmigrate.AzureVMFamilyEsv3Series), - // to.Ptr(armmigrate.AzureVMFamilyDSeries), - // to.Ptr(armmigrate.AzureVMFamilyMSeries), - // to.Ptr(armmigrate.AzureVMFamilyFsv2Series), - // to.Ptr(armmigrate.AzureVMFamilyHSeries)}, - // ConfidenceRatingInPercentage: to.Ptr[float64](0), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:52:14.489Z"); return t}()), - // Currency: to.Ptr(armmigrate.CurrencyUSD), - // DiscountPercentage: to.Ptr[float64](0), - // MonthlyBandwidthCost: to.Ptr[float64](0), - // MonthlyComputeCost: to.Ptr[float64](2588.830584), - // MonthlyPremiumStorageCost: to.Ptr[float64](0), - // MonthlyStandardSSDStorageCost: to.Ptr[float64](0), - // MonthlyStorageCost: to.Ptr[float64](238.016), - // NumberOfMachines: to.Ptr[int32](26), - // Percentile: to.Ptr(armmigrate.PercentilePercentile95), - // PerfDataEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:52:14.489Z"); return t}()), - // PerfDataStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-08T10:52:14.489Z"); return t}()), - // PricesTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-26T11:07:37.139Z"); return t}()), - // ReservedInstance: to.Ptr(armmigrate.ReservedInstanceRI3Year), - // ScalingFactor: to.Ptr[float64](1), - // SizingCriterion: to.Ptr(armmigrate.AssessmentSizingCriterionPerformanceBased), - // Stage: to.Ptr(armmigrate.AssessmentStageInProgress), - // Status: to.Ptr(armmigrate.AssessmentStatusOutDated), - // TimeRange: to.Ptr(armmigrate.TimeRangeDay), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:52:14.489Z"); return t}()), - // VMUptime: &armmigrate.VMUptime{ - // DaysPerMonth: to.Ptr[int32](31), - // HoursPerDay: to.Ptr[int32](24), - // }, - // }, - // }, - // { - // Name: to.Ptr("assessment_5_9_2019_17_0_56"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/groups/assessments"), - // ETag: to.Ptr("\"1e000c2c-0000-0d00-0000-5cdaa4190000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/Group2/assessments/assessment_5_9_2019_17_0_56"), - // Properties: &armmigrate.AssessmentProperties{ - // AzureDiskType: to.Ptr(armmigrate.AzureDiskTypeStandardOrPremium), - // AzureHybridUseBenefit: to.Ptr(armmigrate.AzureHybridUseBenefitYes), - // AzureLocation: to.Ptr(armmigrate.AzureLocationNorthEurope), - // AzureOfferCode: to.Ptr(armmigrate.AzureOfferCodeMSAZR0003P), - // AzurePricingTier: to.Ptr(armmigrate.AzurePricingTierStandard), - // AzureStorageRedundancy: to.Ptr(armmigrate.AzureStorageRedundancyLocallyRedundant), - // AzureVMFamilies: []*armmigrate.AzureVMFamily{ - // to.Ptr(armmigrate.AzureVMFamilyDv2Series), - // to.Ptr(armmigrate.AzureVMFamilyFSeries), - // to.Ptr(armmigrate.AzureVMFamilyDv3Series), - // to.Ptr(armmigrate.AzureVMFamilyDSSeries), - // to.Ptr(armmigrate.AzureVMFamilyDSv2Series), - // to.Ptr(armmigrate.AzureVMFamilyFsSeries), - // to.Ptr(armmigrate.AzureVMFamilyDsv3Series), - // to.Ptr(armmigrate.AzureVMFamilyEv3Series), - // to.Ptr(armmigrate.AzureVMFamilyEsv3Series), - // to.Ptr(armmigrate.AzureVMFamilyDSeries), - // to.Ptr(armmigrate.AzureVMFamilyMSeries), - // to.Ptr(armmigrate.AzureVMFamilyFsv2Series), - // to.Ptr(armmigrate.AzureVMFamilyHSeries)}, - // ConfidenceRatingInPercentage: to.Ptr[float64](0), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T11:30:57.003Z"); return t}()), - // Currency: to.Ptr(armmigrate.CurrencyUSD), - // DiscountPercentage: to.Ptr[float64](0), - // MonthlyBandwidthCost: to.Ptr[float64](0), - // MonthlyComputeCost: to.Ptr[float64](607.443264), - // MonthlyPremiumStorageCost: to.Ptr[float64](0), - // MonthlyStandardSSDStorageCost: to.Ptr[float64](0), - // MonthlyStorageCost: to.Ptr[float64](111.36), - // NumberOfMachines: to.Ptr[int32](5), - // Percentile: to.Ptr(armmigrate.PercentilePercentile95), - // PerfDataEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T11:30:57.003Z"); return t}()), - // PerfDataStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-08T11:30:57.003Z"); return t}()), - // PricesTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-26T11:07:37.139Z"); return t}()), - // ReservedInstance: to.Ptr(armmigrate.ReservedInstanceRI3Year), - // ScalingFactor: to.Ptr[float64](1), - // SizingCriterion: to.Ptr(armmigrate.AssessmentSizingCriterionPerformanceBased), - // Stage: to.Ptr(armmigrate.AssessmentStageInProgress), - // Status: to.Ptr(armmigrate.AssessmentStatusCompleted), - // TimeRange: to.Ptr(armmigrate.TimeRangeDay), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T11:30:57.003Z"); return t}()), - // VMUptime: &armmigrate.VMUptime{ - // DaysPerMonth: to.Ptr[int32](31), - // HoursPerDay: to.Ptr[int32](24), - // }, - // }, - // }, - // { - // Name: to.Ptr("assessment_5_14_2019_16_48_47"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/groups/assessments"), - // ETag: to.Ptr("\"1e000c2c-0000-0d00-0000-5cdaa4190000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/Group2/assessments/assessment_5_14_2019_16_48_47"), - // Properties: &armmigrate.AssessmentProperties{ - // AzureDiskType: to.Ptr(armmigrate.AzureDiskTypeStandardOrPremium), - // AzureHybridUseBenefit: to.Ptr(armmigrate.AzureHybridUseBenefitYes), - // AzureLocation: to.Ptr(armmigrate.AzureLocationNorthEurope), - // AzureOfferCode: to.Ptr(armmigrate.AzureOfferCodeMSAZR0003P), - // AzurePricingTier: to.Ptr(armmigrate.AzurePricingTierStandard), - // AzureStorageRedundancy: to.Ptr(armmigrate.AzureStorageRedundancyLocallyRedundant), - // AzureVMFamilies: []*armmigrate.AzureVMFamily{ - // to.Ptr(armmigrate.AzureVMFamilyDv2Series), - // to.Ptr(armmigrate.AzureVMFamilyFSeries), - // to.Ptr(armmigrate.AzureVMFamilyDv3Series), - // to.Ptr(armmigrate.AzureVMFamilyDSSeries), - // to.Ptr(armmigrate.AzureVMFamilyDSv2Series), - // to.Ptr(armmigrate.AzureVMFamilyFsSeries), - // to.Ptr(armmigrate.AzureVMFamilyDsv3Series), - // to.Ptr(armmigrate.AzureVMFamilyEv3Series), - // to.Ptr(armmigrate.AzureVMFamilyEsv3Series), - // to.Ptr(armmigrate.AzureVMFamilyDSeries), - // to.Ptr(armmigrate.AzureVMFamilyMSeries), - // to.Ptr(armmigrate.AzureVMFamilyFsv2Series), - // to.Ptr(armmigrate.AzureVMFamilyHSeries)}, - // ConfidenceRatingInPercentage: to.Ptr[float64](0), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-14T11:18:47.789Z"); return t}()), - // Currency: to.Ptr(armmigrate.CurrencyUSD), - // DiscountPercentage: to.Ptr[float64](0), - // MonthlyBandwidthCost: to.Ptr[float64](0), - // MonthlyComputeCost: to.Ptr[float64](607.443264), - // MonthlyPremiumStorageCost: to.Ptr[float64](0), - // MonthlyStandardSSDStorageCost: to.Ptr[float64](0), - // MonthlyStorageCost: to.Ptr[float64](111.36), - // NumberOfMachines: to.Ptr[int32](5), - // Percentile: to.Ptr(armmigrate.PercentilePercentile95), - // PerfDataEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-14T11:18:47.789Z"); return t}()), - // PerfDataStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-13T11:18:47.789Z"); return t}()), - // PricesTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-26T11:07:37.139Z"); return t}()), - // ReservedInstance: to.Ptr(armmigrate.ReservedInstanceRI3Year), - // ScalingFactor: to.Ptr[float64](1), - // SizingCriterion: to.Ptr(armmigrate.AssessmentSizingCriterionPerformanceBased), - // Stage: to.Ptr(armmigrate.AssessmentStageInProgress), - // Status: to.Ptr(armmigrate.AssessmentStatusCompleted), - // TimeRange: to.Ptr(armmigrate.TimeRangeDay), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-14T11:18:47.789Z"); return t}()), - // VMUptime: &armmigrate.VMUptime{ - // DaysPerMonth: to.Ptr[int32](31), - // HoursPerDay: to.Ptr[int32](24), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Assessments_Get.json -func ExampleAssessmentsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAssessmentsClient().Get(ctx, "abgoyal-westEurope", "abgoyalWEselfhostb72bproject", "Test1", "assessment_5_9_2019_16_22_14", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Assessment = armmigrate.Assessment{ - // Name: to.Ptr("assessment_5_9_2019_16_22_14"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/groups/assessments"), - // ETag: to.Ptr("\"21009c31-0000-0d00-0000-5cd585ad0000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/Test1/assessments/assessment_5_9_2019_16_22_14"), - // Properties: &armmigrate.AssessmentProperties{ - // AzureDiskType: to.Ptr(armmigrate.AzureDiskTypeStandardOrPremium), - // AzureHybridUseBenefit: to.Ptr(armmigrate.AzureHybridUseBenefitYes), - // AzureLocation: to.Ptr(armmigrate.AzureLocationNorthEurope), - // AzureOfferCode: to.Ptr(armmigrate.AzureOfferCodeMSAZR0003P), - // AzurePricingTier: to.Ptr(armmigrate.AzurePricingTierStandard), - // AzureStorageRedundancy: to.Ptr(armmigrate.AzureStorageRedundancyLocallyRedundant), - // AzureVMFamilies: []*armmigrate.AzureVMFamily{ - // to.Ptr(armmigrate.AzureVMFamilyDv2Series), - // to.Ptr(armmigrate.AzureVMFamilyFSeries), - // to.Ptr(armmigrate.AzureVMFamilyDv3Series), - // to.Ptr(armmigrate.AzureVMFamilyDSSeries), - // to.Ptr(armmigrate.AzureVMFamilyDSv2Series), - // to.Ptr(armmigrate.AzureVMFamilyFsSeries), - // to.Ptr(armmigrate.AzureVMFamilyDsv3Series), - // to.Ptr(armmigrate.AzureVMFamilyEv3Series), - // to.Ptr(armmigrate.AzureVMFamilyEsv3Series), - // to.Ptr(armmigrate.AzureVMFamilyDSeries), - // to.Ptr(armmigrate.AzureVMFamilyMSeries), - // to.Ptr(armmigrate.AzureVMFamilyFsv2Series), - // to.Ptr(armmigrate.AzureVMFamilyHSeries)}, - // ConfidenceRatingInPercentage: to.Ptr[float64](0), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:52:14.489Z"); return t}()), - // Currency: to.Ptr(armmigrate.CurrencyUSD), - // DiscountPercentage: to.Ptr[float64](0), - // MonthlyBandwidthCost: to.Ptr[float64](0), - // MonthlyComputeCost: to.Ptr[float64](2588.830584), - // MonthlyPremiumStorageCost: to.Ptr[float64](0), - // MonthlyStandardSSDStorageCost: to.Ptr[float64](0), - // MonthlyStorageCost: to.Ptr[float64](238.016), - // NumberOfMachines: to.Ptr[int32](26), - // Percentile: to.Ptr(armmigrate.PercentilePercentile95), - // PerfDataEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:52:14.489Z"); return t}()), - // PerfDataStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-08T10:52:14.489Z"); return t}()), - // PricesTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-26T11:07:37.139Z"); return t}()), - // ReservedInstance: to.Ptr(armmigrate.ReservedInstanceRI3Year), - // ScalingFactor: to.Ptr[float64](1), - // SizingCriterion: to.Ptr(armmigrate.AssessmentSizingCriterionPerformanceBased), - // Stage: to.Ptr(armmigrate.AssessmentStageInProgress), - // Status: to.Ptr(armmigrate.AssessmentStatusOutDated), - // TimeRange: to.Ptr(armmigrate.TimeRangeDay), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:52:14.489Z"); return t}()), - // VMUptime: &armmigrate.VMUptime{ - // DaysPerMonth: to.Ptr[int32](31), - // HoursPerDay: to.Ptr[int32](24), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Assessments_Create.json -func ExampleAssessmentsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAssessmentsClient().Create(ctx, "abgoyal-westEurope", "abgoyalWEselfhostb72bproject", "Group2", "assessment_5_14_2019_16_48_47", &armmigrate.AssessmentsClientCreateOptions{Assessment: &armmigrate.Assessment{ - ETag: to.Ptr("\"1e000c2c-0000-0d00-0000-5cdaa4190000\""), - Properties: &armmigrate.AssessmentProperties{ - AzureDiskType: to.Ptr(armmigrate.AzureDiskTypeStandardOrPremium), - AzureHybridUseBenefit: to.Ptr(armmigrate.AzureHybridUseBenefitYes), - AzureLocation: to.Ptr(armmigrate.AzureLocationNorthEurope), - AzureOfferCode: to.Ptr(armmigrate.AzureOfferCodeMSAZR0003P), - AzurePricingTier: to.Ptr(armmigrate.AzurePricingTierStandard), - AzureStorageRedundancy: to.Ptr(armmigrate.AzureStorageRedundancyLocallyRedundant), - AzureVMFamilies: []*armmigrate.AzureVMFamily{ - to.Ptr(armmigrate.AzureVMFamilyDv2Series), - to.Ptr(armmigrate.AzureVMFamilyFSeries), - to.Ptr(armmigrate.AzureVMFamilyDv3Series), - to.Ptr(armmigrate.AzureVMFamilyDSSeries), - to.Ptr(armmigrate.AzureVMFamilyDSv2Series), - to.Ptr(armmigrate.AzureVMFamilyFsSeries), - to.Ptr(armmigrate.AzureVMFamilyDsv3Series), - to.Ptr(armmigrate.AzureVMFamilyEv3Series), - to.Ptr(armmigrate.AzureVMFamilyEsv3Series), - to.Ptr(armmigrate.AzureVMFamilyDSeries), - to.Ptr(armmigrate.AzureVMFamilyMSeries), - to.Ptr(armmigrate.AzureVMFamilyFsv2Series), - to.Ptr(armmigrate.AzureVMFamilyHSeries)}, - Currency: to.Ptr(armmigrate.CurrencyUSD), - DiscountPercentage: to.Ptr[float64](100), - Percentile: to.Ptr(armmigrate.PercentilePercentile95), - ReservedInstance: to.Ptr(armmigrate.ReservedInstanceRI3Year), - ScalingFactor: to.Ptr[float64](1), - SizingCriterion: to.Ptr(armmigrate.AssessmentSizingCriterionPerformanceBased), - Stage: to.Ptr(armmigrate.AssessmentStageInProgress), - TimeRange: to.Ptr(armmigrate.TimeRangeDay), - VMUptime: &armmigrate.VMUptime{ - DaysPerMonth: to.Ptr[int32](31), - HoursPerDay: to.Ptr[int32](24), - }, - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Assessment = armmigrate.Assessment{ - // Name: to.Ptr("assessment_5_14_2019_16_48_47"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/groups/assessments"), - // ETag: to.Ptr("\"1e000c2c-0000-0d00-0000-5cdaa4190000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/Group2/assessments/assessment_5_14_2019_16_48_47"), - // Properties: &armmigrate.AssessmentProperties{ - // AzureDiskType: to.Ptr(armmigrate.AzureDiskTypeStandardOrPremium), - // AzureHybridUseBenefit: to.Ptr(armmigrate.AzureHybridUseBenefitYes), - // AzureLocation: to.Ptr(armmigrate.AzureLocationNorthEurope), - // AzureOfferCode: to.Ptr(armmigrate.AzureOfferCodeMSAZR0003P), - // AzurePricingTier: to.Ptr(armmigrate.AzurePricingTierStandard), - // AzureStorageRedundancy: to.Ptr(armmigrate.AzureStorageRedundancyLocallyRedundant), - // AzureVMFamilies: []*armmigrate.AzureVMFamily{ - // to.Ptr(armmigrate.AzureVMFamilyDv2Series), - // to.Ptr(armmigrate.AzureVMFamilyFSeries), - // to.Ptr(armmigrate.AzureVMFamilyDv3Series), - // to.Ptr(armmigrate.AzureVMFamilyDSSeries), - // to.Ptr(armmigrate.AzureVMFamilyDSv2Series), - // to.Ptr(armmigrate.AzureVMFamilyFsSeries), - // to.Ptr(armmigrate.AzureVMFamilyDsv3Series), - // to.Ptr(armmigrate.AzureVMFamilyEv3Series), - // to.Ptr(armmigrate.AzureVMFamilyEsv3Series), - // to.Ptr(armmigrate.AzureVMFamilyDSeries), - // to.Ptr(armmigrate.AzureVMFamilyMSeries), - // to.Ptr(armmigrate.AzureVMFamilyFsv2Series), - // to.Ptr(armmigrate.AzureVMFamilyHSeries)}, - // ConfidenceRatingInPercentage: to.Ptr[float64](0), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-14T11:18:47.789Z"); return t}()), - // Currency: to.Ptr(armmigrate.CurrencyUSD), - // DiscountPercentage: to.Ptr[float64](0), - // MonthlyBandwidthCost: to.Ptr[float64](0), - // MonthlyComputeCost: to.Ptr[float64](607.443264), - // MonthlyPremiumStorageCost: to.Ptr[float64](0), - // MonthlyStandardSSDStorageCost: to.Ptr[float64](0), - // MonthlyStorageCost: to.Ptr[float64](111.36), - // NumberOfMachines: to.Ptr[int32](5), - // Percentile: to.Ptr(armmigrate.PercentilePercentile95), - // PerfDataEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-14T11:18:47.789Z"); return t}()), - // PerfDataStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-13T11:18:47.789Z"); return t}()), - // PricesTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-26T11:07:37.139Z"); return t}()), - // ReservedInstance: to.Ptr(armmigrate.ReservedInstanceRI3Year), - // ScalingFactor: to.Ptr[float64](1), - // SizingCriterion: to.Ptr(armmigrate.AssessmentSizingCriterionPerformanceBased), - // Stage: to.Ptr(armmigrate.AssessmentStageInProgress), - // Status: to.Ptr(armmigrate.AssessmentStatusCompleted), - // TimeRange: to.Ptr(armmigrate.TimeRangeDay), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-14T11:18:47.789Z"); return t}()), - // VMUptime: &armmigrate.VMUptime{ - // DaysPerMonth: to.Ptr[int32](31), - // HoursPerDay: to.Ptr[int32](24), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Assessments_Delete.json -func ExampleAssessmentsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAssessmentsClient().Delete(ctx, "abgoyal-westEurope", "abgoyalWEselfhostb72bproject", "Test1", "assessment_5_9_2019_16_22_14", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Assessments_GetReportDownloadUrl.json -func ExampleAssessmentsClient_GetReportDownloadURL() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAssessmentsClient().GetReportDownloadURL(ctx, "abgoyal-westEurope", "abgoyalWEselfhostb72bproject", "Test1", "assessment_5_9_2019_16_22_14", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DownloadURL = armmigrate.DownloadURL{ - // AssessmentReportURL: to.Ptr("link-to-download-assessment-report"), - // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-05T13:17:23.543Z"); return t}()), - // } -} diff --git a/sdk/resourcemanager/migrate/armmigrate/autorest.md b/sdk/resourcemanager/migrate/armmigrate/autorest.md index 7bc45e58d2a4..588f100b9ebb 100644 --- a/sdk/resourcemanager/migrate/armmigrate/autorest.md +++ b/sdk/resourcemanager/migrate/armmigrate/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/migrate/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/migrate/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.2.0 +module-version: 2.0.0-beta.1 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/migrate/armmigrate/client_factory.go b/sdk/resourcemanager/migrate/armmigrate/client_factory.go index b999a6f2a261..883c773e23c7 100644 --- a/sdk/resourcemanager/migrate/armmigrate/client_factory.go +++ b/sdk/resourcemanager/migrate/armmigrate/client_factory.go @@ -23,7 +23,7 @@ type ClientFactory struct { // NewClientFactory creates a new instance of ClientFactory with the specified values. // The parameter values will be propagated to any client created from this factory. -// - subscriptionID - Azure Subscription Id in which project was created. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { @@ -37,39 +37,123 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, }, nil } -// NewAssessedMachinesClient creates a new instance of AssessedMachinesClient. -func (c *ClientFactory) NewAssessedMachinesClient() *AssessedMachinesClient { - subClient, _ := NewAssessedMachinesClient(c.subscriptionID, c.credential, c.options) +// NewDependencyMapControllerClient creates a new instance of DependencyMapControllerClient. +func (c *ClientFactory) NewDependencyMapControllerClient() *DependencyMapControllerClient { + subClient, _ := NewDependencyMapControllerClient(c.subscriptionID, c.credential, c.options) return subClient } -// NewAssessmentsClient creates a new instance of AssessmentsClient. -func (c *ClientFactory) NewAssessmentsClient() *AssessmentsClient { - subClient, _ := NewAssessmentsClient(c.subscriptionID, c.credential, c.options) +// NewHypervClusterControllerClient creates a new instance of HypervClusterControllerClient. +func (c *ClientFactory) NewHypervClusterControllerClient() *HypervClusterControllerClient { + subClient, _ := NewHypervClusterControllerClient(c.subscriptionID, c.credential, c.options) return subClient } -// NewGroupsClient creates a new instance of GroupsClient. -func (c *ClientFactory) NewGroupsClient() *GroupsClient { - subClient, _ := NewGroupsClient(c.subscriptionID, c.credential, c.options) +// NewHypervDependencyMapControllerClient creates a new instance of HypervDependencyMapControllerClient. +func (c *ClientFactory) NewHypervDependencyMapControllerClient() *HypervDependencyMapControllerClient { + subClient, _ := NewHypervDependencyMapControllerClient(c.subscriptionID, c.credential, c.options) return subClient } -// NewHyperVCollectorsClient creates a new instance of HyperVCollectorsClient. -func (c *ClientFactory) NewHyperVCollectorsClient() *HyperVCollectorsClient { - subClient, _ := NewHyperVCollectorsClient(c.subscriptionID, c.credential, c.options) +// NewHypervHostControllerClient creates a new instance of HypervHostControllerClient. +func (c *ClientFactory) NewHypervHostControllerClient() *HypervHostControllerClient { + subClient, _ := NewHypervHostControllerClient(c.subscriptionID, c.credential, c.options) return subClient } -// NewImportCollectorsClient creates a new instance of ImportCollectorsClient. -func (c *ClientFactory) NewImportCollectorsClient() *ImportCollectorsClient { - subClient, _ := NewImportCollectorsClient(c.subscriptionID, c.credential, c.options) +// NewHypervJobsClient creates a new instance of HypervJobsClient. +func (c *ClientFactory) NewHypervJobsClient() *HypervJobsClient { + subClient, _ := NewHypervJobsClient(c.subscriptionID, c.credential, c.options) return subClient } -// NewMachinesClient creates a new instance of MachinesClient. -func (c *ClientFactory) NewMachinesClient() *MachinesClient { - subClient, _ := NewMachinesClient(c.subscriptionID, c.credential, c.options) +// NewHypervJobsControllerClient creates a new instance of HypervJobsControllerClient. +func (c *ClientFactory) NewHypervJobsControllerClient() *HypervJobsControllerClient { + subClient, _ := NewHypervJobsControllerClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewHypervMachinesControllerClient creates a new instance of HypervMachinesControllerClient. +func (c *ClientFactory) NewHypervMachinesControllerClient() *HypervMachinesControllerClient { + subClient, _ := NewHypervMachinesControllerClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewHypervOperationsStatusControllerClient creates a new instance of HypervOperationsStatusControllerClient. +func (c *ClientFactory) NewHypervOperationsStatusControllerClient() *HypervOperationsStatusControllerClient { + subClient, _ := NewHypervOperationsStatusControllerClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewHypervRunAsAccountsControllerClient creates a new instance of HypervRunAsAccountsControllerClient. +func (c *ClientFactory) NewHypervRunAsAccountsControllerClient() *HypervRunAsAccountsControllerClient { + subClient, _ := NewHypervRunAsAccountsControllerClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewHypervSitesClient creates a new instance of HypervSitesClient. +func (c *ClientFactory) NewHypervSitesClient() *HypervSitesClient { + subClient, _ := NewHypervSitesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewHypervSitesControllerClient creates a new instance of HypervSitesControllerClient. +func (c *ClientFactory) NewHypervSitesControllerClient() *HypervSitesControllerClient { + subClient, _ := NewHypervSitesControllerClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewHypervSoftwareInventoriesControllerClient creates a new instance of HypervSoftwareInventoriesControllerClient. +func (c *ClientFactory) NewHypervSoftwareInventoriesControllerClient() *HypervSoftwareInventoriesControllerClient { + subClient, _ := NewHypervSoftwareInventoriesControllerClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewIisWebApplicationsControllerClient creates a new instance of IisWebApplicationsControllerClient. +func (c *ClientFactory) NewIisWebApplicationsControllerClient() *IisWebApplicationsControllerClient { + subClient, _ := NewIisWebApplicationsControllerClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewIisWebServersControllerClient creates a new instance of IisWebServersControllerClient. +func (c *ClientFactory) NewIisWebServersControllerClient() *IisWebServersControllerClient { + subClient, _ := NewIisWebServersControllerClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewImportJobsControllerClient creates a new instance of ImportJobsControllerClient. +func (c *ClientFactory) NewImportJobsControllerClient() *ImportJobsControllerClient { + subClient, _ := NewImportJobsControllerClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewImportMachinesControllerClient creates a new instance of ImportMachinesControllerClient. +func (c *ClientFactory) NewImportMachinesControllerClient() *ImportMachinesControllerClient { + subClient, _ := NewImportMachinesControllerClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewImportSitesControllerClient creates a new instance of ImportSitesControllerClient. +func (c *ClientFactory) NewImportSitesControllerClient() *ImportSitesControllerClient { + subClient, _ := NewImportSitesControllerClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewMachinesControllerClient creates a new instance of MachinesControllerClient. +func (c *ClientFactory) NewMachinesControllerClient() *MachinesControllerClient { + subClient, _ := NewMachinesControllerClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewMasterSitesControllerClient creates a new instance of MasterSitesControllerClient. +func (c *ClientFactory) NewMasterSitesControllerClient() *MasterSitesControllerClient { + subClient, _ := NewMasterSitesControllerClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewMasterSitesOperationsStatusControllerClient creates a new instance of MasterSitesOperationsStatusControllerClient. +func (c *ClientFactory) NewMasterSitesOperationsStatusControllerClient() *MasterSitesOperationsStatusControllerClient { + subClient, _ := NewMasterSitesOperationsStatusControllerClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -79,32 +163,200 @@ func (c *ClientFactory) NewOperationsClient() *OperationsClient { return subClient } -// NewPrivateEndpointConnectionClient creates a new instance of PrivateEndpointConnectionClient. -func (c *ClientFactory) NewPrivateEndpointConnectionClient() *PrivateEndpointConnectionClient { - subClient, _ := NewPrivateEndpointConnectionClient(c.subscriptionID, c.credential, c.options) +// NewPrivateEndpointConnectionControllerClient creates a new instance of PrivateEndpointConnectionControllerClient. +func (c *ClientFactory) NewPrivateEndpointConnectionControllerClient() *PrivateEndpointConnectionControllerClient { + subClient, _ := NewPrivateEndpointConnectionControllerClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewPrivateLinkResourcesControllerClient creates a new instance of PrivateLinkResourcesControllerClient. +func (c *ClientFactory) NewPrivateLinkResourcesControllerClient() *PrivateLinkResourcesControllerClient { + subClient, _ := NewPrivateLinkResourcesControllerClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewRunAsAccountsControllerClient creates a new instance of RunAsAccountsControllerClient. +func (c *ClientFactory) NewRunAsAccountsControllerClient() *RunAsAccountsControllerClient { + subClient, _ := NewRunAsAccountsControllerClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewSQLAvailabilityGroupsControllerClient creates a new instance of SQLAvailabilityGroupsControllerClient. +func (c *ClientFactory) NewSQLAvailabilityGroupsControllerClient() *SQLAvailabilityGroupsControllerClient { + subClient, _ := NewSQLAvailabilityGroupsControllerClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewSQLDatabasesControllerClient creates a new instance of SQLDatabasesControllerClient. +func (c *ClientFactory) NewSQLDatabasesControllerClient() *SQLDatabasesControllerClient { + subClient, _ := NewSQLDatabasesControllerClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewSQLDiscoverySiteDataSourceControllerClient creates a new instance of SQLDiscoverySiteDataSourceControllerClient. +func (c *ClientFactory) NewSQLDiscoverySiteDataSourceControllerClient() *SQLDiscoverySiteDataSourceControllerClient { + subClient, _ := NewSQLDiscoverySiteDataSourceControllerClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewSQLJobsControllerClient creates a new instance of SQLJobsControllerClient. +func (c *ClientFactory) NewSQLJobsControllerClient() *SQLJobsControllerClient { + subClient, _ := NewSQLJobsControllerClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewSQLOperationsStatusControllerClient creates a new instance of SQLOperationsStatusControllerClient. +func (c *ClientFactory) NewSQLOperationsStatusControllerClient() *SQLOperationsStatusControllerClient { + subClient, _ := NewSQLOperationsStatusControllerClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewSQLRunAsAccountsControllerClient creates a new instance of SQLRunAsAccountsControllerClient. +func (c *ClientFactory) NewSQLRunAsAccountsControllerClient() *SQLRunAsAccountsControllerClient { + subClient, _ := NewSQLRunAsAccountsControllerClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewSQLServersControllerClient creates a new instance of SQLServersControllerClient. +func (c *ClientFactory) NewSQLServersControllerClient() *SQLServersControllerClient { + subClient, _ := NewSQLServersControllerClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewSQLSitesControllerClient creates a new instance of SQLSitesControllerClient. +func (c *ClientFactory) NewSQLSitesControllerClient() *SQLSitesControllerClient { + subClient, _ := NewSQLSitesControllerClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewServerDependencyMapControllerClient creates a new instance of ServerDependencyMapControllerClient. +func (c *ClientFactory) NewServerDependencyMapControllerClient() *ServerDependencyMapControllerClient { + subClient, _ := NewServerDependencyMapControllerClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewServerJobsControllerClient creates a new instance of ServerJobsControllerClient. +func (c *ClientFactory) NewServerJobsControllerClient() *ServerJobsControllerClient { + subClient, _ := NewServerJobsControllerClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewServerOperationsStatusControllerClient creates a new instance of ServerOperationsStatusControllerClient. +func (c *ClientFactory) NewServerOperationsStatusControllerClient() *ServerOperationsStatusControllerClient { + subClient, _ := NewServerOperationsStatusControllerClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewServerRunAsAccountsControllerClient creates a new instance of ServerRunAsAccountsControllerClient. +func (c *ClientFactory) NewServerRunAsAccountsControllerClient() *ServerRunAsAccountsControllerClient { + subClient, _ := NewServerRunAsAccountsControllerClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewServerSitesControllerClient creates a new instance of ServerSitesControllerClient. +func (c *ClientFactory) NewServerSitesControllerClient() *ServerSitesControllerClient { + subClient, _ := NewServerSitesControllerClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewServerSoftwareInventoriesControllerClient creates a new instance of ServerSoftwareInventoriesControllerClient. +func (c *ClientFactory) NewServerSoftwareInventoriesControllerClient() *ServerSoftwareInventoriesControllerClient { + subClient, _ := NewServerSoftwareInventoriesControllerClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewServersControllerClient creates a new instance of ServersControllerClient. +func (c *ClientFactory) NewServersControllerClient() *ServersControllerClient { + subClient, _ := NewServersControllerClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewSitesControllerClient creates a new instance of SitesControllerClient. +func (c *ClientFactory) NewSitesControllerClient() *SitesControllerClient { + subClient, _ := NewSitesControllerClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewTomcatWebApplicationsControllerClient creates a new instance of TomcatWebApplicationsControllerClient. +func (c *ClientFactory) NewTomcatWebApplicationsControllerClient() *TomcatWebApplicationsControllerClient { + subClient, _ := NewTomcatWebApplicationsControllerClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewTomcatWebServersControllerClient creates a new instance of TomcatWebServersControllerClient. +func (c *ClientFactory) NewTomcatWebServersControllerClient() *TomcatWebServersControllerClient { + subClient, _ := NewTomcatWebServersControllerClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewVcenterControllerClient creates a new instance of VcenterControllerClient. +func (c *ClientFactory) NewVcenterControllerClient() *VcenterControllerClient { + subClient, _ := NewVcenterControllerClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewVmwareHostControllerClient creates a new instance of VmwareHostControllerClient. +func (c *ClientFactory) NewVmwareHostControllerClient() *VmwareHostControllerClient { + subClient, _ := NewVmwareHostControllerClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewVmwareOperationsStatusClient creates a new instance of VmwareOperationsStatusClient. +func (c *ClientFactory) NewVmwareOperationsStatusClient() *VmwareOperationsStatusClient { + subClient, _ := NewVmwareOperationsStatusClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewVmwarePropertiesControllerClient creates a new instance of VmwarePropertiesControllerClient. +func (c *ClientFactory) NewVmwarePropertiesControllerClient() *VmwarePropertiesControllerClient { + subClient, _ := NewVmwarePropertiesControllerClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewVmwareSoftwareInventoriesControllerClient creates a new instance of VmwareSoftwareInventoriesControllerClient. +func (c *ClientFactory) NewVmwareSoftwareInventoriesControllerClient() *VmwareSoftwareInventoriesControllerClient { + subClient, _ := NewVmwareSoftwareInventoriesControllerClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewWebAppDiscoverySiteDataSourcesControllerClient creates a new instance of WebAppDiscoverySiteDataSourcesControllerClient. +func (c *ClientFactory) NewWebAppDiscoverySiteDataSourcesControllerClient() *WebAppDiscoverySiteDataSourcesControllerClient { + subClient, _ := NewWebAppDiscoverySiteDataSourcesControllerClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewWebAppExtendedMachinesControllerClient creates a new instance of WebAppExtendedMachinesControllerClient. +func (c *ClientFactory) NewWebAppExtendedMachinesControllerClient() *WebAppExtendedMachinesControllerClient { + subClient, _ := NewWebAppExtendedMachinesControllerClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewWebAppPropertiesControllerClient creates a new instance of WebAppPropertiesControllerClient. +func (c *ClientFactory) NewWebAppPropertiesControllerClient() *WebAppPropertiesControllerClient { + subClient, _ := NewWebAppPropertiesControllerClient(c.subscriptionID, c.credential, c.options) return subClient } -// NewPrivateLinkResourceClient creates a new instance of PrivateLinkResourceClient. -func (c *ClientFactory) NewPrivateLinkResourceClient() *PrivateLinkResourceClient { - subClient, _ := NewPrivateLinkResourceClient(c.subscriptionID, c.credential, c.options) +// NewWebAppRunAsAccountsControllerClient creates a new instance of WebAppRunAsAccountsControllerClient. +func (c *ClientFactory) NewWebAppRunAsAccountsControllerClient() *WebAppRunAsAccountsControllerClient { + subClient, _ := NewWebAppRunAsAccountsControllerClient(c.subscriptionID, c.credential, c.options) return subClient } -// NewProjectsClient creates a new instance of ProjectsClient. -func (c *ClientFactory) NewProjectsClient() *ProjectsClient { - subClient, _ := NewProjectsClient(c.subscriptionID, c.credential, c.options) +// NewWebAppSitesControllerClient creates a new instance of WebAppSitesControllerClient. +func (c *ClientFactory) NewWebAppSitesControllerClient() *WebAppSitesControllerClient { + subClient, _ := NewWebAppSitesControllerClient(c.subscriptionID, c.credential, c.options) return subClient } -// NewServerCollectorsClient creates a new instance of ServerCollectorsClient. -func (c *ClientFactory) NewServerCollectorsClient() *ServerCollectorsClient { - subClient, _ := NewServerCollectorsClient(c.subscriptionID, c.credential, c.options) +// NewWebApplicationsControllerClient creates a new instance of WebApplicationsControllerClient. +func (c *ClientFactory) NewWebApplicationsControllerClient() *WebApplicationsControllerClient { + subClient, _ := NewWebApplicationsControllerClient(c.subscriptionID, c.credential, c.options) return subClient } -// NewVMwareCollectorsClient creates a new instance of VMwareCollectorsClient. -func (c *ClientFactory) NewVMwareCollectorsClient() *VMwareCollectorsClient { - subClient, _ := NewVMwareCollectorsClient(c.subscriptionID, c.credential, c.options) +// NewWebServersControllerClient creates a new instance of WebServersControllerClient. +func (c *ClientFactory) NewWebServersControllerClient() *WebServersControllerClient { + subClient, _ := NewWebServersControllerClient(c.subscriptionID, c.credential, c.options) return subClient } diff --git a/sdk/resourcemanager/migrate/armmigrate/constants.go b/sdk/resourcemanager/migrate/armmigrate/constants.go index 987064342fa7..01ba528e9ec6 100644 --- a/sdk/resourcemanager/migrate/armmigrate/constants.go +++ b/sdk/resourcemanager/migrate/armmigrate/constants.go @@ -10,1135 +10,598 @@ package armmigrate const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" - moduleVersion = "v1.2.0" + moduleVersion = "v2.0.0-beta.1" ) -// AssessmentSizingCriterion - Assessment sizing criterion. -type AssessmentSizingCriterion string +// ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +type ActionType string const ( - AssessmentSizingCriterionAsOnPremises AssessmentSizingCriterion = "AsOnPremises" - AssessmentSizingCriterionPerformanceBased AssessmentSizingCriterion = "PerformanceBased" + ActionTypeInternal ActionType = "Internal" ) -// PossibleAssessmentSizingCriterionValues returns the possible values for the AssessmentSizingCriterion const type. -func PossibleAssessmentSizingCriterionValues() []AssessmentSizingCriterion { - return []AssessmentSizingCriterion{ - AssessmentSizingCriterionAsOnPremises, - AssessmentSizingCriterionPerformanceBased, +// PossibleActionTypeValues returns the possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ + ActionTypeInternal, } } -// AssessmentStage - User configurable setting that describes the status of the assessment. -type AssessmentStage string +// ApplicationDiscoveryScopeStatus - Application Discovery Scope Status +type ApplicationDiscoveryScopeStatus string const ( - AssessmentStageApproved AssessmentStage = "Approved" - AssessmentStageInProgress AssessmentStage = "InProgress" - AssessmentStageUnderReview AssessmentStage = "UnderReview" + // ApplicationDiscoveryScopeStatusDisabled - Disabled value. + ApplicationDiscoveryScopeStatusDisabled ApplicationDiscoveryScopeStatus = "Disabled" + // ApplicationDiscoveryScopeStatusDiscoveryFailed - DiscoveryFailed value. + ApplicationDiscoveryScopeStatusDiscoveryFailed ApplicationDiscoveryScopeStatus = "DiscoveryFailed" + // ApplicationDiscoveryScopeStatusDiscoveryInProgress - DiscoveryInProgress value. + ApplicationDiscoveryScopeStatusDiscoveryInProgress ApplicationDiscoveryScopeStatus = "DiscoveryInProgress" + // ApplicationDiscoveryScopeStatusDiscoveryNotStarted - DiscoveryNotStarted value. + ApplicationDiscoveryScopeStatusDiscoveryNotStarted ApplicationDiscoveryScopeStatus = "DiscoveryNotStarted" + // ApplicationDiscoveryScopeStatusDiscoveryPartiallySucceded - DiscoveryPartiallySucceded value. + ApplicationDiscoveryScopeStatusDiscoveryPartiallySucceded ApplicationDiscoveryScopeStatus = "DiscoveryPartiallySucceded" + // ApplicationDiscoveryScopeStatusDiscoverySucceeded - DiscoverySucceeded value. + ApplicationDiscoveryScopeStatusDiscoverySucceeded ApplicationDiscoveryScopeStatus = "DiscoverySucceeded" + // ApplicationDiscoveryScopeStatusDiscoverySucceededAtleastOnce - DiscoverySucceededAtleastOnce value. + ApplicationDiscoveryScopeStatusDiscoverySucceededAtleastOnce ApplicationDiscoveryScopeStatus = "DiscoverySucceededAtleastOnce" + // ApplicationDiscoveryScopeStatusRunAsAccountNotAssociated - RunAsAccountNotAssociated value. + ApplicationDiscoveryScopeStatusRunAsAccountNotAssociated ApplicationDiscoveryScopeStatus = "RunAsAccountNotAssociated" ) -// PossibleAssessmentStageValues returns the possible values for the AssessmentStage const type. -func PossibleAssessmentStageValues() []AssessmentStage { - return []AssessmentStage{ - AssessmentStageApproved, - AssessmentStageInProgress, - AssessmentStageUnderReview, +// PossibleApplicationDiscoveryScopeStatusValues returns the possible values for the ApplicationDiscoveryScopeStatus const type. +func PossibleApplicationDiscoveryScopeStatusValues() []ApplicationDiscoveryScopeStatus { + return []ApplicationDiscoveryScopeStatus{ + ApplicationDiscoveryScopeStatusDisabled, + ApplicationDiscoveryScopeStatusDiscoveryFailed, + ApplicationDiscoveryScopeStatusDiscoveryInProgress, + ApplicationDiscoveryScopeStatusDiscoveryNotStarted, + ApplicationDiscoveryScopeStatusDiscoveryPartiallySucceded, + ApplicationDiscoveryScopeStatusDiscoverySucceeded, + ApplicationDiscoveryScopeStatusDiscoverySucceededAtleastOnce, + ApplicationDiscoveryScopeStatusRunAsAccountNotAssociated, } } -// AssessmentStatus - Whether the assessment has been created and is valid. -type AssessmentStatus string +// CreatedByType - The type of identity that created the resource. +type CreatedByType string const ( - AssessmentStatusCompleted AssessmentStatus = "Completed" - AssessmentStatusCreated AssessmentStatus = "Created" - AssessmentStatusInvalid AssessmentStatus = "Invalid" - AssessmentStatusOutDated AssessmentStatus = "OutDated" - AssessmentStatusOutOfSync AssessmentStatus = "OutOfSync" - AssessmentStatusRunning AssessmentStatus = "Running" - AssessmentStatusUpdated AssessmentStatus = "Updated" + CreatedByTypeApplication CreatedByType = "Application" + CreatedByTypeKey CreatedByType = "Key" + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + CreatedByTypeUser CreatedByType = "User" ) -// PossibleAssessmentStatusValues returns the possible values for the AssessmentStatus const type. -func PossibleAssessmentStatusValues() []AssessmentStatus { - return []AssessmentStatus{ - AssessmentStatusCompleted, - AssessmentStatusCreated, - AssessmentStatusInvalid, - AssessmentStatusOutDated, - AssessmentStatusOutOfSync, - AssessmentStatusRunning, - AssessmentStatusUpdated, +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, } } -// AzureDiskSize - Recommended Azure size for the disk, given utilization data and preferences set on Assessment. -type AzureDiskSize string +type Default string const ( - AzureDiskSizePremiumP10 AzureDiskSize = "Premium_P10" - AzureDiskSizePremiumP15 AzureDiskSize = "Premium_P15" - AzureDiskSizePremiumP20 AzureDiskSize = "Premium_P20" - AzureDiskSizePremiumP30 AzureDiskSize = "Premium_P30" - AzureDiskSizePremiumP4 AzureDiskSize = "Premium_P4" - AzureDiskSizePremiumP40 AzureDiskSize = "Premium_P40" - AzureDiskSizePremiumP50 AzureDiskSize = "Premium_P50" - AzureDiskSizePremiumP6 AzureDiskSize = "Premium_P6" - AzureDiskSizePremiumP60 AzureDiskSize = "Premium_P60" - AzureDiskSizePremiumP70 AzureDiskSize = "Premium_P70" - AzureDiskSizePremiumP80 AzureDiskSize = "Premium_P80" - AzureDiskSizeStandardS10 AzureDiskSize = "Standard_S10" - AzureDiskSizeStandardS15 AzureDiskSize = "Standard_S15" - AzureDiskSizeStandardS20 AzureDiskSize = "Standard_S20" - AzureDiskSizeStandardS30 AzureDiskSize = "Standard_S30" - AzureDiskSizeStandardS4 AzureDiskSize = "Standard_S4" - AzureDiskSizeStandardS40 AzureDiskSize = "Standard_S40" - AzureDiskSizeStandardS50 AzureDiskSize = "Standard_S50" - AzureDiskSizeStandardS6 AzureDiskSize = "Standard_S6" - AzureDiskSizeStandardS60 AzureDiskSize = "Standard_S60" - AzureDiskSizeStandardS70 AzureDiskSize = "Standard_S70" - AzureDiskSizeStandardS80 AzureDiskSize = "Standard_S80" - AzureDiskSizeStandardSSDE10 AzureDiskSize = "StandardSSD_E10" - AzureDiskSizeStandardSSDE15 AzureDiskSize = "StandardSSD_E15" - AzureDiskSizeStandardSSDE20 AzureDiskSize = "StandardSSD_E20" - AzureDiskSizeStandardSSDE30 AzureDiskSize = "StandardSSD_E30" - AzureDiskSizeStandardSSDE4 AzureDiskSize = "StandardSSD_E4" - AzureDiskSizeStandardSSDE40 AzureDiskSize = "StandardSSD_E40" - AzureDiskSizeStandardSSDE50 AzureDiskSize = "StandardSSD_E50" - AzureDiskSizeStandardSSDE6 AzureDiskSize = "StandardSSD_E6" - AzureDiskSizeStandardSSDE60 AzureDiskSize = "StandardSSD_E60" - AzureDiskSizeStandardSSDE70 AzureDiskSize = "StandardSSD_E70" - AzureDiskSizeStandardSSDE80 AzureDiskSize = "StandardSSD_E80" - AzureDiskSizeUnknown AzureDiskSize = "Unknown" + // DefaultDefault - default value. + DefaultDefault Default = "default" ) -// PossibleAzureDiskSizeValues returns the possible values for the AzureDiskSize const type. -func PossibleAzureDiskSizeValues() []AzureDiskSize { - return []AzureDiskSize{ - AzureDiskSizePremiumP10, - AzureDiskSizePremiumP15, - AzureDiskSizePremiumP20, - AzureDiskSizePremiumP30, - AzureDiskSizePremiumP4, - AzureDiskSizePremiumP40, - AzureDiskSizePremiumP50, - AzureDiskSizePremiumP6, - AzureDiskSizePremiumP60, - AzureDiskSizePremiumP70, - AzureDiskSizePremiumP80, - AzureDiskSizeStandardS10, - AzureDiskSizeStandardS15, - AzureDiskSizeStandardS20, - AzureDiskSizeStandardS30, - AzureDiskSizeStandardS4, - AzureDiskSizeStandardS40, - AzureDiskSizeStandardS50, - AzureDiskSizeStandardS6, - AzureDiskSizeStandardS60, - AzureDiskSizeStandardS70, - AzureDiskSizeStandardS80, - AzureDiskSizeStandardSSDE10, - AzureDiskSizeStandardSSDE15, - AzureDiskSizeStandardSSDE20, - AzureDiskSizeStandardSSDE30, - AzureDiskSizeStandardSSDE4, - AzureDiskSizeStandardSSDE40, - AzureDiskSizeStandardSSDE50, - AzureDiskSizeStandardSSDE6, - AzureDiskSizeStandardSSDE60, - AzureDiskSizeStandardSSDE70, - AzureDiskSizeStandardSSDE80, - AzureDiskSizeUnknown, +// PossibleDefaultValues returns the possible values for the Default const type. +func PossibleDefaultValues() []Default { + return []Default{ + DefaultDefault, } } -// AzureDiskSuitabilityDetail - If disk is suitable to be migrate but some conditions/checks were not considered while calculating -// suitability, this explains the details. -type AzureDiskSuitabilityDetail string +// DefaultAutoGenerated - HealthError Details Source +type DefaultAutoGenerated string const ( - AzureDiskSuitabilityDetailDiskGigabytesConsumedMissing AzureDiskSuitabilityDetail = "DiskGigabytesConsumedMissing" - AzureDiskSuitabilityDetailDiskGigabytesConsumedOutOfRange AzureDiskSuitabilityDetail = "DiskGigabytesConsumedOutOfRange" - AzureDiskSuitabilityDetailDiskGigabytesProvisionedMissing AzureDiskSuitabilityDetail = "DiskGigabytesProvisionedMissing" - AzureDiskSuitabilityDetailDiskGigabytesProvisionedOutOfRange AzureDiskSuitabilityDetail = "DiskGigabytesProvisionedOutOfRange" - AzureDiskSuitabilityDetailMegabytesPerSecondOfReadMissing AzureDiskSuitabilityDetail = "MegabytesPerSecondOfReadMissing" - AzureDiskSuitabilityDetailMegabytesPerSecondOfReadOutOfRange AzureDiskSuitabilityDetail = "MegabytesPerSecondOfReadOutOfRange" - AzureDiskSuitabilityDetailMegabytesPerSecondOfWriteMissing AzureDiskSuitabilityDetail = "MegabytesPerSecondOfWriteMissing" - AzureDiskSuitabilityDetailMegabytesPerSecondOfWriteOutOfRange AzureDiskSuitabilityDetail = "MegabytesPerSecondOfWriteOutOfRange" - AzureDiskSuitabilityDetailNone AzureDiskSuitabilityDetail = "None" - AzureDiskSuitabilityDetailNumberOfReadOperationsPerSecondMissing AzureDiskSuitabilityDetail = "NumberOfReadOperationsPerSecondMissing" - AzureDiskSuitabilityDetailNumberOfReadOperationsPerSecondOutOfRange AzureDiskSuitabilityDetail = "NumberOfReadOperationsPerSecondOutOfRange" - AzureDiskSuitabilityDetailNumberOfWriteOperationsPerSecondMissing AzureDiskSuitabilityDetail = "NumberOfWriteOperationsPerSecondMissing" - AzureDiskSuitabilityDetailNumberOfWriteOperationsPerSecondOutOfRange AzureDiskSuitabilityDetail = "NumberOfWriteOperationsPerSecondOutOfRange" + // DefaultAutoGeneratedDefault - default value. + DefaultAutoGeneratedDefault DefaultAutoGenerated = "default" ) -// PossibleAzureDiskSuitabilityDetailValues returns the possible values for the AzureDiskSuitabilityDetail const type. -func PossibleAzureDiskSuitabilityDetailValues() []AzureDiskSuitabilityDetail { - return []AzureDiskSuitabilityDetail{ - AzureDiskSuitabilityDetailDiskGigabytesConsumedMissing, - AzureDiskSuitabilityDetailDiskGigabytesConsumedOutOfRange, - AzureDiskSuitabilityDetailDiskGigabytesProvisionedMissing, - AzureDiskSuitabilityDetailDiskGigabytesProvisionedOutOfRange, - AzureDiskSuitabilityDetailMegabytesPerSecondOfReadMissing, - AzureDiskSuitabilityDetailMegabytesPerSecondOfReadOutOfRange, - AzureDiskSuitabilityDetailMegabytesPerSecondOfWriteMissing, - AzureDiskSuitabilityDetailMegabytesPerSecondOfWriteOutOfRange, - AzureDiskSuitabilityDetailNone, - AzureDiskSuitabilityDetailNumberOfReadOperationsPerSecondMissing, - AzureDiskSuitabilityDetailNumberOfReadOperationsPerSecondOutOfRange, - AzureDiskSuitabilityDetailNumberOfWriteOperationsPerSecondMissing, - AzureDiskSuitabilityDetailNumberOfWriteOperationsPerSecondOutOfRange, +// PossibleDefaultAutoGeneratedValues returns the possible values for the DefaultAutoGenerated const type. +func PossibleDefaultAutoGeneratedValues() []DefaultAutoGenerated { + return []DefaultAutoGenerated{ + DefaultAutoGeneratedDefault, } } -// AzureDiskSuitabilityExplanation - If disk is not suitable to be migrated, this explains the reasons and mitigation steps. -type AzureDiskSuitabilityExplanation string +// DefaultValues - HealthError Details Source +type DefaultValues string const ( - AzureDiskSuitabilityExplanationDiskSizeGreaterThanSupported AzureDiskSuitabilityExplanation = "DiskSizeGreaterThanSupported" - AzureDiskSuitabilityExplanationInternalErrorOccurredForDiskEvaluation AzureDiskSuitabilityExplanation = "InternalErrorOccurredForDiskEvaluation" - AzureDiskSuitabilityExplanationNoDiskSizeFoundForSelectedRedundancy AzureDiskSuitabilityExplanation = "NoDiskSizeFoundForSelectedRedundancy" - AzureDiskSuitabilityExplanationNoDiskSizeFoundInSelectedLocation AzureDiskSuitabilityExplanation = "NoDiskSizeFoundInSelectedLocation" - AzureDiskSuitabilityExplanationNoEaPriceFoundForDiskSize AzureDiskSuitabilityExplanation = "NoEaPriceFoundForDiskSize" - AzureDiskSuitabilityExplanationNoSuitableDiskSizeForIops AzureDiskSuitabilityExplanation = "NoSuitableDiskSizeForIops" - AzureDiskSuitabilityExplanationNoSuitableDiskSizeForThroughput AzureDiskSuitabilityExplanation = "NoSuitableDiskSizeForThroughput" - AzureDiskSuitabilityExplanationNotApplicable AzureDiskSuitabilityExplanation = "NotApplicable" - AzureDiskSuitabilityExplanationUnknown AzureDiskSuitabilityExplanation = "Unknown" + // DefaultValuesDefault - default value. + DefaultValuesDefault DefaultValues = "default" ) -// PossibleAzureDiskSuitabilityExplanationValues returns the possible values for the AzureDiskSuitabilityExplanation const type. -func PossibleAzureDiskSuitabilityExplanationValues() []AzureDiskSuitabilityExplanation { - return []AzureDiskSuitabilityExplanation{ - AzureDiskSuitabilityExplanationDiskSizeGreaterThanSupported, - AzureDiskSuitabilityExplanationInternalErrorOccurredForDiskEvaluation, - AzureDiskSuitabilityExplanationNoDiskSizeFoundForSelectedRedundancy, - AzureDiskSuitabilityExplanationNoDiskSizeFoundInSelectedLocation, - AzureDiskSuitabilityExplanationNoEaPriceFoundForDiskSize, - AzureDiskSuitabilityExplanationNoSuitableDiskSizeForIops, - AzureDiskSuitabilityExplanationNoSuitableDiskSizeForThroughput, - AzureDiskSuitabilityExplanationNotApplicable, - AzureDiskSuitabilityExplanationUnknown, +// PossibleDefaultValuesValues returns the possible values for the DefaultValues const type. +func PossibleDefaultValuesValues() []DefaultValues { + return []DefaultValues{ + DefaultValuesDefault, } } -// AzureDiskType - Storage type selected for this disk. -type AzureDiskType string +// DeleteImportedMachinesJobPropertiesJobState - Cosmos db Imported Machines JobEntity +type DeleteImportedMachinesJobPropertiesJobState string const ( - AzureDiskTypePremium AzureDiskType = "Premium" - AzureDiskTypeStandard AzureDiskType = "Standard" - AzureDiskTypeStandardOrPremium AzureDiskType = "StandardOrPremium" - AzureDiskTypeStandardSSD AzureDiskType = "StandardSSD" - AzureDiskTypeUnknown AzureDiskType = "Unknown" + // DeleteImportedMachinesJobPropertiesJobStateCompleted - Completed value. + DeleteImportedMachinesJobPropertiesJobStateCompleted DeleteImportedMachinesJobPropertiesJobState = "Completed" + // DeleteImportedMachinesJobPropertiesJobStateFailed - Failed value. + DeleteImportedMachinesJobPropertiesJobStateFailed DeleteImportedMachinesJobPropertiesJobState = "Failed" + // DeleteImportedMachinesJobPropertiesJobStateUnknown - Unknown value. + DeleteImportedMachinesJobPropertiesJobStateUnknown DeleteImportedMachinesJobPropertiesJobState = "Unknown" + // DeleteImportedMachinesJobPropertiesJobStateVerified - Verified value. + DeleteImportedMachinesJobPropertiesJobStateVerified DeleteImportedMachinesJobPropertiesJobState = "Verified" + // DeleteImportedMachinesJobPropertiesJobStateVerifiedWithErrors - VerifiedWithErrors value. + DeleteImportedMachinesJobPropertiesJobStateVerifiedWithErrors DeleteImportedMachinesJobPropertiesJobState = "VerifiedWithErrors" ) -// PossibleAzureDiskTypeValues returns the possible values for the AzureDiskType const type. -func PossibleAzureDiskTypeValues() []AzureDiskType { - return []AzureDiskType{ - AzureDiskTypePremium, - AzureDiskTypeStandard, - AzureDiskTypeStandardOrPremium, - AzureDiskTypeStandardSSD, - AzureDiskTypeUnknown, +// PossibleDeleteImportedMachinesJobPropertiesJobStateValues returns the possible values for the DeleteImportedMachinesJobPropertiesJobState const type. +func PossibleDeleteImportedMachinesJobPropertiesJobStateValues() []DeleteImportedMachinesJobPropertiesJobState { + return []DeleteImportedMachinesJobPropertiesJobState{ + DeleteImportedMachinesJobPropertiesJobStateCompleted, + DeleteImportedMachinesJobPropertiesJobStateFailed, + DeleteImportedMachinesJobPropertiesJobStateUnknown, + DeleteImportedMachinesJobPropertiesJobStateVerified, + DeleteImportedMachinesJobPropertiesJobStateVerifiedWithErrors, } } -// AzureHybridUseBenefit - AHUB discount on windows virtual machines. -type AzureHybridUseBenefit string +// DependencyMapDiscoveryScopeStatus - DependencyMap DiscoveryScope Status +type DependencyMapDiscoveryScopeStatus string const ( - AzureHybridUseBenefitNo AzureHybridUseBenefit = "No" - AzureHybridUseBenefitUnknown AzureHybridUseBenefit = "Unknown" - AzureHybridUseBenefitYes AzureHybridUseBenefit = "Yes" + // DependencyMapDiscoveryScopeStatusDisabled - Disabled value. + DependencyMapDiscoveryScopeStatusDisabled DependencyMapDiscoveryScopeStatus = "Disabled" + // DependencyMapDiscoveryScopeStatusDiscoveryFailed - DiscoveryFailed value. + DependencyMapDiscoveryScopeStatusDiscoveryFailed DependencyMapDiscoveryScopeStatus = "DiscoveryFailed" + // DependencyMapDiscoveryScopeStatusDiscoveryInProgress - DiscoveryInProgress value. + DependencyMapDiscoveryScopeStatusDiscoveryInProgress DependencyMapDiscoveryScopeStatus = "DiscoveryInProgress" + // DependencyMapDiscoveryScopeStatusDiscoveryNotStarted - DiscoveryNotStarted value. + DependencyMapDiscoveryScopeStatusDiscoveryNotStarted DependencyMapDiscoveryScopeStatus = "DiscoveryNotStarted" + // DependencyMapDiscoveryScopeStatusDiscoveryPartiallySucceded - DiscoveryPartiallySucceded value. + DependencyMapDiscoveryScopeStatusDiscoveryPartiallySucceded DependencyMapDiscoveryScopeStatus = "DiscoveryPartiallySucceded" + // DependencyMapDiscoveryScopeStatusDiscoverySucceeded - DiscoverySucceeded value. + DependencyMapDiscoveryScopeStatusDiscoverySucceeded DependencyMapDiscoveryScopeStatus = "DiscoverySucceeded" + // DependencyMapDiscoveryScopeStatusDiscoverySucceededAtleastOnce - DiscoverySucceededAtleastOnce value. + DependencyMapDiscoveryScopeStatusDiscoverySucceededAtleastOnce DependencyMapDiscoveryScopeStatus = "DiscoverySucceededAtleastOnce" + // DependencyMapDiscoveryScopeStatusRunAsAccountNotAssociated - RunAsAccountNotAssociated value. + DependencyMapDiscoveryScopeStatusRunAsAccountNotAssociated DependencyMapDiscoveryScopeStatus = "RunAsAccountNotAssociated" ) -// PossibleAzureHybridUseBenefitValues returns the possible values for the AzureHybridUseBenefit const type. -func PossibleAzureHybridUseBenefitValues() []AzureHybridUseBenefit { - return []AzureHybridUseBenefit{ - AzureHybridUseBenefitNo, - AzureHybridUseBenefitUnknown, - AzureHybridUseBenefitYes, +// PossibleDependencyMapDiscoveryScopeStatusValues returns the possible values for the DependencyMapDiscoveryScopeStatus const type. +func PossibleDependencyMapDiscoveryScopeStatusValues() []DependencyMapDiscoveryScopeStatus { + return []DependencyMapDiscoveryScopeStatus{ + DependencyMapDiscoveryScopeStatusDisabled, + DependencyMapDiscoveryScopeStatusDiscoveryFailed, + DependencyMapDiscoveryScopeStatusDiscoveryInProgress, + DependencyMapDiscoveryScopeStatusDiscoveryNotStarted, + DependencyMapDiscoveryScopeStatusDiscoveryPartiallySucceded, + DependencyMapDiscoveryScopeStatusDiscoverySucceeded, + DependencyMapDiscoveryScopeStatusDiscoverySucceededAtleastOnce, + DependencyMapDiscoveryScopeStatusRunAsAccountNotAssociated, } } -// AzureLocation - Target Azure location for which the machines should be assessed. These enums are the same as used by Compute -// API. -type AzureLocation string +// DiscoveryScopeStatus - Discovery Scope. +type DiscoveryScopeStatus string const ( - AzureLocationAustraliaEast AzureLocation = "AustraliaEast" - AzureLocationAustraliaSoutheast AzureLocation = "AustraliaSoutheast" - AzureLocationBrazilSouth AzureLocation = "BrazilSouth" - AzureLocationCanadaCentral AzureLocation = "CanadaCentral" - AzureLocationCanadaEast AzureLocation = "CanadaEast" - AzureLocationCentralIndia AzureLocation = "CentralIndia" - AzureLocationCentralUs AzureLocation = "CentralUs" - AzureLocationChinaEast AzureLocation = "ChinaEast" - AzureLocationChinaNorth AzureLocation = "ChinaNorth" - AzureLocationEastAsia AzureLocation = "EastAsia" - AzureLocationEastUs AzureLocation = "EastUs" - AzureLocationEastUs2 AzureLocation = "EastUs2" - AzureLocationGermanyCentral AzureLocation = "GermanyCentral" - AzureLocationGermanyNortheast AzureLocation = "GermanyNortheast" - AzureLocationJapanEast AzureLocation = "JapanEast" - AzureLocationJapanWest AzureLocation = "JapanWest" - AzureLocationKoreaCentral AzureLocation = "KoreaCentral" - AzureLocationKoreaSouth AzureLocation = "KoreaSouth" - AzureLocationNorthCentralUs AzureLocation = "NorthCentralUs" - AzureLocationNorthEurope AzureLocation = "NorthEurope" - AzureLocationSouthCentralUs AzureLocation = "SouthCentralUs" - AzureLocationSouthIndia AzureLocation = "SouthIndia" - AzureLocationSoutheastAsia AzureLocation = "SoutheastAsia" - AzureLocationUSDoDCentral AzureLocation = "USDoDCentral" - AzureLocationUSDoDEast AzureLocation = "USDoDEast" - AzureLocationUSGovArizona AzureLocation = "USGovArizona" - AzureLocationUSGovIowa AzureLocation = "USGovIowa" - AzureLocationUSGovTexas AzureLocation = "USGovTexas" - AzureLocationUSGovVirginia AzureLocation = "USGovVirginia" - AzureLocationUkSouth AzureLocation = "UkSouth" - AzureLocationUkWest AzureLocation = "UkWest" - AzureLocationUnknown AzureLocation = "Unknown" - AzureLocationWestCentralUs AzureLocation = "WestCentralUs" - AzureLocationWestEurope AzureLocation = "WestEurope" - AzureLocationWestIndia AzureLocation = "WestIndia" - AzureLocationWestUs AzureLocation = "WestUs" - AzureLocationWestUs2 AzureLocation = "WestUs2" + // DiscoveryScopeStatusDisabled - Disabled value. + DiscoveryScopeStatusDisabled DiscoveryScopeStatus = "Disabled" + // DiscoveryScopeStatusDiscoveryFailed - DiscoveryFailed value. + DiscoveryScopeStatusDiscoveryFailed DiscoveryScopeStatus = "DiscoveryFailed" + // DiscoveryScopeStatusDiscoveryInProgress - DiscoveryInProgress value. + DiscoveryScopeStatusDiscoveryInProgress DiscoveryScopeStatus = "DiscoveryInProgress" + // DiscoveryScopeStatusDiscoveryNotStarted - DiscoveryNotStarted value. + DiscoveryScopeStatusDiscoveryNotStarted DiscoveryScopeStatus = "DiscoveryNotStarted" + // DiscoveryScopeStatusDiscoveryPartiallySucceded - DiscoveryPartiallySucceded value. + DiscoveryScopeStatusDiscoveryPartiallySucceded DiscoveryScopeStatus = "DiscoveryPartiallySucceded" + // DiscoveryScopeStatusDiscoverySucceeded - DiscoverySucceeded value. + DiscoveryScopeStatusDiscoverySucceeded DiscoveryScopeStatus = "DiscoverySucceeded" + // DiscoveryScopeStatusDiscoverySucceededAtleastOnce - DiscoverySucceededAtleastOnce value. + DiscoveryScopeStatusDiscoverySucceededAtleastOnce DiscoveryScopeStatus = "DiscoverySucceededAtleastOnce" + // DiscoveryScopeStatusRunAsAccountNotAssociated - RunAsAccountNotAssociated value. + DiscoveryScopeStatusRunAsAccountNotAssociated DiscoveryScopeStatus = "RunAsAccountNotAssociated" ) -// PossibleAzureLocationValues returns the possible values for the AzureLocation const type. -func PossibleAzureLocationValues() []AzureLocation { - return []AzureLocation{ - AzureLocationAustraliaEast, - AzureLocationAustraliaSoutheast, - AzureLocationBrazilSouth, - AzureLocationCanadaCentral, - AzureLocationCanadaEast, - AzureLocationCentralIndia, - AzureLocationCentralUs, - AzureLocationChinaEast, - AzureLocationChinaNorth, - AzureLocationEastAsia, - AzureLocationEastUs, - AzureLocationEastUs2, - AzureLocationGermanyCentral, - AzureLocationGermanyNortheast, - AzureLocationJapanEast, - AzureLocationJapanWest, - AzureLocationKoreaCentral, - AzureLocationKoreaSouth, - AzureLocationNorthCentralUs, - AzureLocationNorthEurope, - AzureLocationSouthCentralUs, - AzureLocationSouthIndia, - AzureLocationSoutheastAsia, - AzureLocationUSDoDCentral, - AzureLocationUSDoDEast, - AzureLocationUSGovArizona, - AzureLocationUSGovIowa, - AzureLocationUSGovTexas, - AzureLocationUSGovVirginia, - AzureLocationUkSouth, - AzureLocationUkWest, - AzureLocationUnknown, - AzureLocationWestCentralUs, - AzureLocationWestEurope, - AzureLocationWestIndia, - AzureLocationWestUs, - AzureLocationWestUs2, +// PossibleDiscoveryScopeStatusValues returns the possible values for the DiscoveryScopeStatus const type. +func PossibleDiscoveryScopeStatusValues() []DiscoveryScopeStatus { + return []DiscoveryScopeStatus{ + DiscoveryScopeStatusDisabled, + DiscoveryScopeStatusDiscoveryFailed, + DiscoveryScopeStatusDiscoveryInProgress, + DiscoveryScopeStatusDiscoveryNotStarted, + DiscoveryScopeStatusDiscoveryPartiallySucceded, + DiscoveryScopeStatusDiscoverySucceeded, + DiscoveryScopeStatusDiscoverySucceededAtleastOnce, + DiscoveryScopeStatusRunAsAccountNotAssociated, } } -// AzureNetworkAdapterSuitabilityDetail - If network adapter is not suitable for cloud, this explains the reasons. -type AzureNetworkAdapterSuitabilityDetail string +// DiscoveryScopes - Discovery scopes +type DiscoveryScopes string const ( - AzureNetworkAdapterSuitabilityDetailMegabytesOfDataTransmittedMissing AzureNetworkAdapterSuitabilityDetail = "MegabytesOfDataTransmittedMissing" - AzureNetworkAdapterSuitabilityDetailMegabytesOfDataTransmittedOutOfRange AzureNetworkAdapterSuitabilityDetail = "MegabytesOfDataTransmittedOutOfRange" - AzureNetworkAdapterSuitabilityDetailNone AzureNetworkAdapterSuitabilityDetail = "None" + // DiscoveryScopesAppsAndRoles - AppsAndRoles value. + DiscoveryScopesAppsAndRoles DiscoveryScopes = "AppsAndRoles" + // DiscoveryScopesDependencyMap - DependencyMap value. + DiscoveryScopesDependencyMap DiscoveryScopes = "DependencyMap" + // DiscoveryScopesSQLServerConnectionInfo - SQLServerConnectionInfo value. + DiscoveryScopesSQLServerConnectionInfo DiscoveryScopes = "SQLServerConnectionInfo" + // DiscoveryScopesStaticData - StaticData value. + DiscoveryScopesStaticData DiscoveryScopes = "StaticData" ) -// PossibleAzureNetworkAdapterSuitabilityDetailValues returns the possible values for the AzureNetworkAdapterSuitabilityDetail const type. -func PossibleAzureNetworkAdapterSuitabilityDetailValues() []AzureNetworkAdapterSuitabilityDetail { - return []AzureNetworkAdapterSuitabilityDetail{ - AzureNetworkAdapterSuitabilityDetailMegabytesOfDataTransmittedMissing, - AzureNetworkAdapterSuitabilityDetailMegabytesOfDataTransmittedOutOfRange, - AzureNetworkAdapterSuitabilityDetailNone, +// PossibleDiscoveryScopesValues returns the possible values for the DiscoveryScopes const type. +func PossibleDiscoveryScopesValues() []DiscoveryScopes { + return []DiscoveryScopes{ + DiscoveryScopesAppsAndRoles, + DiscoveryScopesDependencyMap, + DiscoveryScopesSQLServerConnectionInfo, + DiscoveryScopesStaticData, } } -// AzureNetworkAdapterSuitabilityExplanation - If network adapter is suitable, this explains the reasons and mitigation steps. -type AzureNetworkAdapterSuitabilityExplanation string +// EsuStatus - esu Status +type EsuStatus string const ( - AzureNetworkAdapterSuitabilityExplanationInternalErrorOccurred AzureNetworkAdapterSuitabilityExplanation = "InternalErrorOccurred" - AzureNetworkAdapterSuitabilityExplanationNotApplicable AzureNetworkAdapterSuitabilityExplanation = "NotApplicable" - AzureNetworkAdapterSuitabilityExplanationUnknown AzureNetworkAdapterSuitabilityExplanation = "Unknown" + // EsuStatusActive - Active value. + EsuStatusActive EsuStatus = "Active" + // EsuStatusInActive - InActive value. + EsuStatusInActive EsuStatus = "InActive" + // EsuStatusUnknown - Unknown value. + EsuStatusUnknown EsuStatus = "Unknown" ) -// PossibleAzureNetworkAdapterSuitabilityExplanationValues returns the possible values for the AzureNetworkAdapterSuitabilityExplanation const type. -func PossibleAzureNetworkAdapterSuitabilityExplanationValues() []AzureNetworkAdapterSuitabilityExplanation { - return []AzureNetworkAdapterSuitabilityExplanation{ - AzureNetworkAdapterSuitabilityExplanationInternalErrorOccurred, - AzureNetworkAdapterSuitabilityExplanationNotApplicable, - AzureNetworkAdapterSuitabilityExplanationUnknown, +// PossibleEsuStatusValues returns the possible values for the EsuStatus const type. +func PossibleEsuStatusValues() []EsuStatus { + return []EsuStatus{ + EsuStatusActive, + EsuStatusInActive, + EsuStatusUnknown, } } -// AzureOfferCode - Offer code according to which cost estimation is done. -type AzureOfferCode string +// EsuYear - esu year +type EsuYear string const ( - AzureOfferCodeEA AzureOfferCode = "EA" - AzureOfferCodeMSAZR0003P AzureOfferCode = "MSAZR0003P" - AzureOfferCodeMSAZR0022P AzureOfferCode = "MSAZR0022P" - AzureOfferCodeMSAZR0023P AzureOfferCode = "MSAZR0023P" - AzureOfferCodeMSAZR0025P AzureOfferCode = "MSAZR0025P" - AzureOfferCodeMSAZR0029P AzureOfferCode = "MSAZR0029P" - AzureOfferCodeMSAZR0036P AzureOfferCode = "MSAZR0036P" - AzureOfferCodeMSAZR0044P AzureOfferCode = "MSAZR0044P" - AzureOfferCodeMSAZR0059P AzureOfferCode = "MSAZR0059P" - AzureOfferCodeMSAZR0060P AzureOfferCode = "MSAZR0060P" - AzureOfferCodeMSAZR0062P AzureOfferCode = "MSAZR0062P" - AzureOfferCodeMSAZR0063P AzureOfferCode = "MSAZR0063P" - AzureOfferCodeMSAZR0064P AzureOfferCode = "MSAZR0064P" - AzureOfferCodeMSAZR0111P AzureOfferCode = "MSAZR0111P" - AzureOfferCodeMSAZR0120P AzureOfferCode = "MSAZR0120P" - AzureOfferCodeMSAZR0121P AzureOfferCode = "MSAZR0121P" - AzureOfferCodeMSAZR0122P AzureOfferCode = "MSAZR0122P" - AzureOfferCodeMSAZR0123P AzureOfferCode = "MSAZR0123P" - AzureOfferCodeMSAZR0124P AzureOfferCode = "MSAZR0124P" - AzureOfferCodeMSAZR0125P AzureOfferCode = "MSAZR0125P" - AzureOfferCodeMSAZR0126P AzureOfferCode = "MSAZR0126P" - AzureOfferCodeMSAZR0127P AzureOfferCode = "MSAZR0127P" - AzureOfferCodeMSAZR0128P AzureOfferCode = "MSAZR0128P" - AzureOfferCodeMSAZR0129P AzureOfferCode = "MSAZR0129P" - AzureOfferCodeMSAZR0130P AzureOfferCode = "MSAZR0130P" - AzureOfferCodeMSAZR0144P AzureOfferCode = "MSAZR0144P" - AzureOfferCodeMSAZR0148P AzureOfferCode = "MSAZR0148P" - AzureOfferCodeMSAZR0149P AzureOfferCode = "MSAZR0149P" - AzureOfferCodeMSAZRDE0003P AzureOfferCode = "MSAZRDE0003P" - AzureOfferCodeMSAZRDE0044P AzureOfferCode = "MSAZRDE0044P" - AzureOfferCodeMSAZRUSGOV0003P AzureOfferCode = "MSAZRUSGOV0003P" - AzureOfferCodeMSMCAZR0044P AzureOfferCode = "MSMCAZR0044P" - AzureOfferCodeMSMCAZR0059P AzureOfferCode = "MSMCAZR0059P" - AzureOfferCodeMSMCAZR0060P AzureOfferCode = "MSMCAZR0060P" - AzureOfferCodeMSMCAZR0063P AzureOfferCode = "MSMCAZR0063P" - AzureOfferCodeMSMCAZR0120P AzureOfferCode = "MSMCAZR0120P" - AzureOfferCodeMSMCAZR0121P AzureOfferCode = "MSMCAZR0121P" - AzureOfferCodeMSMCAZR0125P AzureOfferCode = "MSMCAZR0125P" - AzureOfferCodeMSMCAZR0128P AzureOfferCode = "MSMCAZR0128P" - AzureOfferCodeUnknown AzureOfferCode = "Unknown" + // EsuYearFirstYear - FirstYear value. + EsuYearFirstYear EsuYear = "FirstYear" + // EsuYearSecondYear - SecondYear value. + EsuYearSecondYear EsuYear = "SecondYear" + // EsuYearThirdYear - ThirdYear value. + EsuYearThirdYear EsuYear = "ThirdYear" + // EsuYearUnknown - Unknown value. + EsuYearUnknown EsuYear = "Unknown" + // EsuYearUpgradeYear - UpgradeYear value. + EsuYearUpgradeYear EsuYear = "UpgradeYear" ) -// PossibleAzureOfferCodeValues returns the possible values for the AzureOfferCode const type. -func PossibleAzureOfferCodeValues() []AzureOfferCode { - return []AzureOfferCode{ - AzureOfferCodeEA, - AzureOfferCodeMSAZR0003P, - AzureOfferCodeMSAZR0022P, - AzureOfferCodeMSAZR0023P, - AzureOfferCodeMSAZR0025P, - AzureOfferCodeMSAZR0029P, - AzureOfferCodeMSAZR0036P, - AzureOfferCodeMSAZR0044P, - AzureOfferCodeMSAZR0059P, - AzureOfferCodeMSAZR0060P, - AzureOfferCodeMSAZR0062P, - AzureOfferCodeMSAZR0063P, - AzureOfferCodeMSAZR0064P, - AzureOfferCodeMSAZR0111P, - AzureOfferCodeMSAZR0120P, - AzureOfferCodeMSAZR0121P, - AzureOfferCodeMSAZR0122P, - AzureOfferCodeMSAZR0123P, - AzureOfferCodeMSAZR0124P, - AzureOfferCodeMSAZR0125P, - AzureOfferCodeMSAZR0126P, - AzureOfferCodeMSAZR0127P, - AzureOfferCodeMSAZR0128P, - AzureOfferCodeMSAZR0129P, - AzureOfferCodeMSAZR0130P, - AzureOfferCodeMSAZR0144P, - AzureOfferCodeMSAZR0148P, - AzureOfferCodeMSAZR0149P, - AzureOfferCodeMSAZRDE0003P, - AzureOfferCodeMSAZRDE0044P, - AzureOfferCodeMSAZRUSGOV0003P, - AzureOfferCodeMSMCAZR0044P, - AzureOfferCodeMSMCAZR0059P, - AzureOfferCodeMSMCAZR0060P, - AzureOfferCodeMSMCAZR0063P, - AzureOfferCodeMSMCAZR0120P, - AzureOfferCodeMSMCAZR0121P, - AzureOfferCodeMSMCAZR0125P, - AzureOfferCodeMSMCAZR0128P, - AzureOfferCodeUnknown, +// PossibleEsuYearValues returns the possible values for the EsuYear const type. +func PossibleEsuYearValues() []EsuYear { + return []EsuYear{ + EsuYearFirstYear, + EsuYearSecondYear, + EsuYearThirdYear, + EsuYearUnknown, + EsuYearUpgradeYear, } } -// AzurePricingTier - Pricing tier for Size evaluation. -type AzurePricingTier string +// ExportMachineErrorsProperties - Export Machine Errors Properties +type ExportMachineErrorsProperties string const ( - AzurePricingTierBasic AzurePricingTier = "Basic" - AzurePricingTierStandard AzurePricingTier = "Standard" + // ExportMachineErrorsPropertiesAppsAndRoles - AppsAndRoles value. + ExportMachineErrorsPropertiesAppsAndRoles ExportMachineErrorsProperties = "AppsAndRoles" + // ExportMachineErrorsPropertiesDependencyMap - DependencyMap value. + ExportMachineErrorsPropertiesDependencyMap ExportMachineErrorsProperties = "DependencyMap" + // ExportMachineErrorsPropertiesSQLServerConnectionInfo - SQLServerConnectionInfo value. + ExportMachineErrorsPropertiesSQLServerConnectionInfo ExportMachineErrorsProperties = "SQLServerConnectionInfo" + // ExportMachineErrorsPropertiesStaticData - StaticData value. + ExportMachineErrorsPropertiesStaticData ExportMachineErrorsProperties = "StaticData" ) -// PossibleAzurePricingTierValues returns the possible values for the AzurePricingTier const type. -func PossibleAzurePricingTierValues() []AzurePricingTier { - return []AzurePricingTier{ - AzurePricingTierBasic, - AzurePricingTierStandard, +// PossibleExportMachineErrorsPropertiesValues returns the possible values for the ExportMachineErrorsProperties const type. +func PossibleExportMachineErrorsPropertiesValues() []ExportMachineErrorsProperties { + return []ExportMachineErrorsProperties{ + ExportMachineErrorsPropertiesAppsAndRoles, + ExportMachineErrorsPropertiesDependencyMap, + ExportMachineErrorsPropertiesSQLServerConnectionInfo, + ExportMachineErrorsPropertiesStaticData, } } -// AzureStorageRedundancy - Storage Redundancy type offered by Azure. -type AzureStorageRedundancy string +// FCIInstanceState - fci instance state +type FCIInstanceState string const ( - AzureStorageRedundancyGeoRedundant AzureStorageRedundancy = "GeoRedundant" - AzureStorageRedundancyLocallyRedundant AzureStorageRedundancy = "LocallyRedundant" - AzureStorageRedundancyReadAccessGeoRedundant AzureStorageRedundancy = "ReadAccessGeoRedundant" - AzureStorageRedundancyUnknown AzureStorageRedundancy = "Unknown" - AzureStorageRedundancyZoneRedundant AzureStorageRedundancy = "ZoneRedundant" + // FCIInstanceStateFailed - Failed value. + FCIInstanceStateFailed FCIInstanceState = "Failed" + // FCIInstanceStateInherited - Inherited value. + FCIInstanceStateInherited FCIInstanceState = "Inherited" + // FCIInstanceStateInitializing - Initializing value. + FCIInstanceStateInitializing FCIInstanceState = "Initializing" + // FCIInstanceStateOffline - Offline value. + FCIInstanceStateOffline FCIInstanceState = "Offline" + // FCIInstanceStateOfflinePending - OfflinePending value. + FCIInstanceStateOfflinePending FCIInstanceState = "OfflinePending" + // FCIInstanceStateOnline - Online value. + FCIInstanceStateOnline FCIInstanceState = "Online" + // FCIInstanceStateOnlinePending - OnlinePending value. + FCIInstanceStateOnlinePending FCIInstanceState = "OnlinePending" + // FCIInstanceStatePending - Pending value. + FCIInstanceStatePending FCIInstanceState = "Pending" + // FCIInstanceStateUnknown - Unknown value. + FCIInstanceStateUnknown FCIInstanceState = "Unknown" ) -// PossibleAzureStorageRedundancyValues returns the possible values for the AzureStorageRedundancy const type. -func PossibleAzureStorageRedundancyValues() []AzureStorageRedundancy { - return []AzureStorageRedundancy{ - AzureStorageRedundancyGeoRedundant, - AzureStorageRedundancyLocallyRedundant, - AzureStorageRedundancyReadAccessGeoRedundant, - AzureStorageRedundancyUnknown, - AzureStorageRedundancyZoneRedundant, +// PossibleFCIInstanceStateValues returns the possible values for the FCIInstanceState const type. +func PossibleFCIInstanceStateValues() []FCIInstanceState { + return []FCIInstanceState{ + FCIInstanceStateFailed, + FCIInstanceStateInherited, + FCIInstanceStateInitializing, + FCIInstanceStateOffline, + FCIInstanceStateOfflinePending, + FCIInstanceStateOnline, + FCIInstanceStateOnlinePending, + FCIInstanceStatePending, + FCIInstanceStateUnknown, } } -// AzureVMFamily - Azure VM family. -type AzureVMFamily string +// FileType - file type +type FileType string const ( - AzureVMFamilyAv2Series AzureVMFamily = "Av2_series" - AzureVMFamilyBasicA0A4 AzureVMFamily = "Basic_A0_A4" - AzureVMFamilyDCSeries AzureVMFamily = "DC_Series" - AzureVMFamilyDSSeries AzureVMFamily = "DS_series" - AzureVMFamilyDSeries AzureVMFamily = "D_series" - AzureVMFamilyDSv2Series AzureVMFamily = "DSv2_series" - AzureVMFamilyDsv3Series AzureVMFamily = "Dsv3_series" - AzureVMFamilyDv2Series AzureVMFamily = "Dv2_series" - AzureVMFamilyDv3Series AzureVMFamily = "Dv3_series" - AzureVMFamilyEsv3Series AzureVMFamily = "Esv3_series" - AzureVMFamilyEv3Series AzureVMFamily = "Ev3_series" - AzureVMFamilyFSeries AzureVMFamily = "F_series" - AzureVMFamilyFsSeries AzureVMFamily = "Fs_series" - AzureVMFamilyFsv2Series AzureVMFamily = "Fsv2_series" - AzureVMFamilyGSSeries AzureVMFamily = "GS_series" - AzureVMFamilyGSeries AzureVMFamily = "G_series" - AzureVMFamilyHSeries AzureVMFamily = "H_series" - AzureVMFamilyLsSeries AzureVMFamily = "Ls_series" - AzureVMFamilyMSeries AzureVMFamily = "M_series" - AzureVMFamilyStandardA0A7 AzureVMFamily = "Standard_A0_A7" - AzureVMFamilyStandardA8A11 AzureVMFamily = "Standard_A8_A11" - AzureVMFamilyUnknown AzureVMFamily = "Unknown" + // FileTypeFilestream - Filestream value. + FileTypeFilestream FileType = "Filestream" + // FileTypeFulltext - Fulltext value. + FileTypeFulltext FileType = "Fulltext" + // FileTypeLog - Log value. + FileTypeLog FileType = "Log" + // FileTypeNotSupported - NotSpecified value. + FileTypeNotSupported FileType = "NotSupported" + // FileTypeRows - Rows value. + FileTypeRows FileType = "Rows" ) -// PossibleAzureVMFamilyValues returns the possible values for the AzureVMFamily const type. -func PossibleAzureVMFamilyValues() []AzureVMFamily { - return []AzureVMFamily{ - AzureVMFamilyAv2Series, - AzureVMFamilyBasicA0A4, - AzureVMFamilyDCSeries, - AzureVMFamilyDSSeries, - AzureVMFamilyDSeries, - AzureVMFamilyDSv2Series, - AzureVMFamilyDsv3Series, - AzureVMFamilyDv2Series, - AzureVMFamilyDv3Series, - AzureVMFamilyEsv3Series, - AzureVMFamilyEv3Series, - AzureVMFamilyFSeries, - AzureVMFamilyFsSeries, - AzureVMFamilyFsv2Series, - AzureVMFamilyGSSeries, - AzureVMFamilyGSeries, - AzureVMFamilyHSeries, - AzureVMFamilyLsSeries, - AzureVMFamilyMSeries, - AzureVMFamilyStandardA0A7, - AzureVMFamilyStandardA8A11, - AzureVMFamilyUnknown, +// PossibleFileTypeValues returns the possible values for the FileType const type. +func PossibleFileTypeValues() []FileType { + return []FileType{ + FileTypeFilestream, + FileTypeFulltext, + FileTypeLog, + FileTypeNotSupported, + FileTypeRows, } } -// AzureVMSize - Recommended Azure size for this machine. -type AzureVMSize string +// HealthErrorDetailsDiscoveryScope - Gets discovery scope for which error is encountered. +type HealthErrorDetailsDiscoveryScope string const ( - AzureVMSizeBasicA0 AzureVMSize = "Basic_A0" - AzureVMSizeBasicA1 AzureVMSize = "Basic_A1" - AzureVMSizeBasicA2 AzureVMSize = "Basic_A2" - AzureVMSizeBasicA3 AzureVMSize = "Basic_A3" - AzureVMSizeBasicA4 AzureVMSize = "Basic_A4" - AzureVMSizeStandardA0 AzureVMSize = "Standard_A0" - AzureVMSizeStandardA1 AzureVMSize = "Standard_A1" - AzureVMSizeStandardA10 AzureVMSize = "Standard_A10" - AzureVMSizeStandardA11 AzureVMSize = "Standard_A11" - AzureVMSizeStandardA1V2 AzureVMSize = "Standard_A1_v2" - AzureVMSizeStandardA2 AzureVMSize = "Standard_A2" - AzureVMSizeStandardA2MV2 AzureVMSize = "Standard_A2m_v2" - AzureVMSizeStandardA2V2 AzureVMSize = "Standard_A2_v2" - AzureVMSizeStandardA3 AzureVMSize = "Standard_A3" - AzureVMSizeStandardA4 AzureVMSize = "Standard_A4" - AzureVMSizeStandardA4MV2 AzureVMSize = "Standard_A4m_v2" - AzureVMSizeStandardA4V2 AzureVMSize = "Standard_A4_v2" - AzureVMSizeStandardA5 AzureVMSize = "Standard_A5" - AzureVMSizeStandardA6 AzureVMSize = "Standard_A6" - AzureVMSizeStandardA7 AzureVMSize = "Standard_A7" - AzureVMSizeStandardA8 AzureVMSize = "Standard_A8" - AzureVMSizeStandardA8MV2 AzureVMSize = "Standard_A8m_v2" - AzureVMSizeStandardA8V2 AzureVMSize = "Standard_A8_v2" - AzureVMSizeStandardA9 AzureVMSize = "Standard_A9" - AzureVMSizeStandardD1 AzureVMSize = "Standard_D1" - AzureVMSizeStandardD11 AzureVMSize = "Standard_D11" - AzureVMSizeStandardD11V2 AzureVMSize = "Standard_D11_v2" - AzureVMSizeStandardD12 AzureVMSize = "Standard_D12" - AzureVMSizeStandardD12V2 AzureVMSize = "Standard_D12_v2" - AzureVMSizeStandardD13 AzureVMSize = "Standard_D13" - AzureVMSizeStandardD13V2 AzureVMSize = "Standard_D13_v2" - AzureVMSizeStandardD14 AzureVMSize = "Standard_D14" - AzureVMSizeStandardD14V2 AzureVMSize = "Standard_D14_v2" - AzureVMSizeStandardD15V2 AzureVMSize = "Standard_D15_v2" - AzureVMSizeStandardD16SV3 AzureVMSize = "Standard_D16s_v3" - AzureVMSizeStandardD16V3 AzureVMSize = "Standard_D16_v3" - AzureVMSizeStandardD1V2 AzureVMSize = "Standard_D1_v2" - AzureVMSizeStandardD2 AzureVMSize = "Standard_D2" - AzureVMSizeStandardD2SV3 AzureVMSize = "Standard_D2s_v3" - AzureVMSizeStandardD2V2 AzureVMSize = "Standard_D2_v2" - AzureVMSizeStandardD2V3 AzureVMSize = "Standard_D2_v3" - AzureVMSizeStandardD3 AzureVMSize = "Standard_D3" - AzureVMSizeStandardD32SV3 AzureVMSize = "Standard_D32s_v3" - AzureVMSizeStandardD32V3 AzureVMSize = "Standard_D32_v3" - AzureVMSizeStandardD3V2 AzureVMSize = "Standard_D3_v2" - AzureVMSizeStandardD4 AzureVMSize = "Standard_D4" - AzureVMSizeStandardD4SV3 AzureVMSize = "Standard_D4s_v3" - AzureVMSizeStandardD4V2 AzureVMSize = "Standard_D4_v2" - AzureVMSizeStandardD4V3 AzureVMSize = "Standard_D4_v3" - AzureVMSizeStandardD5V2 AzureVMSize = "Standard_D5_v2" - AzureVMSizeStandardD64SV3 AzureVMSize = "Standard_D64s_v3" - AzureVMSizeStandardD64V3 AzureVMSize = "Standard_D64_v3" - AzureVMSizeStandardD8SV3 AzureVMSize = "Standard_D8s_v3" - AzureVMSizeStandardD8V3 AzureVMSize = "Standard_D8_v3" - AzureVMSizeStandardDS1 AzureVMSize = "Standard_DS1" - AzureVMSizeStandardDS11 AzureVMSize = "Standard_DS11" - AzureVMSizeStandardDS11V2 AzureVMSize = "Standard_DS11_v2" - AzureVMSizeStandardDS12 AzureVMSize = "Standard_DS12" - AzureVMSizeStandardDS12V2 AzureVMSize = "Standard_DS12_v2" - AzureVMSizeStandardDS13 AzureVMSize = "Standard_DS13" - AzureVMSizeStandardDS13V2 AzureVMSize = "Standard_DS13_v2" - AzureVMSizeStandardDS14 AzureVMSize = "Standard_DS14" - AzureVMSizeStandardDS14V2 AzureVMSize = "Standard_DS14_v2" - AzureVMSizeStandardDS15V2 AzureVMSize = "Standard_DS15_v2" - AzureVMSizeStandardDS1V2 AzureVMSize = "Standard_DS1_v2" - AzureVMSizeStandardDS2 AzureVMSize = "Standard_DS2" - AzureVMSizeStandardDS2V2 AzureVMSize = "Standard_DS2_v2" - AzureVMSizeStandardDS3 AzureVMSize = "Standard_DS3" - AzureVMSizeStandardDS3V2 AzureVMSize = "Standard_DS3_v2" - AzureVMSizeStandardDS4 AzureVMSize = "Standard_DS4" - AzureVMSizeStandardDS4V2 AzureVMSize = "Standard_DS4_v2" - AzureVMSizeStandardDS5V2 AzureVMSize = "Standard_DS5_v2" - AzureVMSizeStandardE16SV3 AzureVMSize = "Standard_E16s_v3" - AzureVMSizeStandardE16V3 AzureVMSize = "Standard_E16_v3" - AzureVMSizeStandardE2SV3 AzureVMSize = "Standard_E2s_v3" - AzureVMSizeStandardE2V3 AzureVMSize = "Standard_E2_v3" - AzureVMSizeStandardE32SV3 AzureVMSize = "Standard_E32s_v3" - AzureVMSizeStandardE32V3 AzureVMSize = "Standard_E32_v3" - AzureVMSizeStandardE4SV3 AzureVMSize = "Standard_E4s_v3" - AzureVMSizeStandardE4V3 AzureVMSize = "Standard_E4_v3" - AzureVMSizeStandardE64SV3 AzureVMSize = "Standard_E64s_v3" - AzureVMSizeStandardE64V3 AzureVMSize = "Standard_E64_v3" - AzureVMSizeStandardE8SV3 AzureVMSize = "Standard_E8s_v3" - AzureVMSizeStandardE8V3 AzureVMSize = "Standard_E8_v3" - AzureVMSizeStandardF1 AzureVMSize = "Standard_F1" - AzureVMSizeStandardF16 AzureVMSize = "Standard_F16" - AzureVMSizeStandardF16S AzureVMSize = "Standard_F16s" - AzureVMSizeStandardF16SV2 AzureVMSize = "Standard_F16s_v2" - AzureVMSizeStandardF1S AzureVMSize = "Standard_F1s" - AzureVMSizeStandardF2 AzureVMSize = "Standard_F2" - AzureVMSizeStandardF2S AzureVMSize = "Standard_F2s" - AzureVMSizeStandardF2SV2 AzureVMSize = "Standard_F2s_v2" - AzureVMSizeStandardF32SV2 AzureVMSize = "Standard_F32s_v2" - AzureVMSizeStandardF4 AzureVMSize = "Standard_F4" - AzureVMSizeStandardF4S AzureVMSize = "Standard_F4s" - AzureVMSizeStandardF4SV2 AzureVMSize = "Standard_F4s_v2" - AzureVMSizeStandardF64SV2 AzureVMSize = "Standard_F64s_v2" - AzureVMSizeStandardF72SV2 AzureVMSize = "Standard_F72s_v2" - AzureVMSizeStandardF8 AzureVMSize = "Standard_F8" - AzureVMSizeStandardF8S AzureVMSize = "Standard_F8s" - AzureVMSizeStandardF8SV2 AzureVMSize = "Standard_F8s_v2" - AzureVMSizeStandardG1 AzureVMSize = "Standard_G1" - AzureVMSizeStandardG2 AzureVMSize = "Standard_G2" - AzureVMSizeStandardG3 AzureVMSize = "Standard_G3" - AzureVMSizeStandardG4 AzureVMSize = "Standard_G4" - AzureVMSizeStandardG5 AzureVMSize = "Standard_G5" - AzureVMSizeStandardGS1 AzureVMSize = "Standard_GS1" - AzureVMSizeStandardGS2 AzureVMSize = "Standard_GS2" - AzureVMSizeStandardGS3 AzureVMSize = "Standard_GS3" - AzureVMSizeStandardGS4 AzureVMSize = "Standard_GS4" - AzureVMSizeStandardGS5 AzureVMSize = "Standard_GS5" - AzureVMSizeStandardH16 AzureVMSize = "Standard_H16" - AzureVMSizeStandardH16M AzureVMSize = "Standard_H16m" - AzureVMSizeStandardH16Mr AzureVMSize = "Standard_H16mr" - AzureVMSizeStandardH16R AzureVMSize = "Standard_H16r" - AzureVMSizeStandardH8 AzureVMSize = "Standard_H8" - AzureVMSizeStandardH8M AzureVMSize = "Standard_H8m" - AzureVMSizeStandardL16S AzureVMSize = "Standard_L16s" - AzureVMSizeStandardL32S AzureVMSize = "Standard_L32s" - AzureVMSizeStandardL4S AzureVMSize = "Standard_L4s" - AzureVMSizeStandardL8S AzureVMSize = "Standard_L8s" - AzureVMSizeStandardM128Ms AzureVMSize = "Standard_M128ms" - AzureVMSizeStandardM128S AzureVMSize = "Standard_M128s" - AzureVMSizeStandardM64Ms AzureVMSize = "Standard_M64ms" - AzureVMSizeStandardM64S AzureVMSize = "Standard_M64s" - AzureVMSizeUnknown AzureVMSize = "Unknown" + // HealthErrorDetailsDiscoveryScopeAppsAndRoles - AppsAndRoles value. + HealthErrorDetailsDiscoveryScopeAppsAndRoles HealthErrorDetailsDiscoveryScope = "AppsAndRoles" + // HealthErrorDetailsDiscoveryScopeDependencyMap - DependencyMap value. + HealthErrorDetailsDiscoveryScopeDependencyMap HealthErrorDetailsDiscoveryScope = "DependencyMap" + // HealthErrorDetailsDiscoveryScopeDiscoveryTargets - DiscoveryTargets value. + HealthErrorDetailsDiscoveryScopeDiscoveryTargets HealthErrorDetailsDiscoveryScope = "DiscoveryTargets" + // HealthErrorDetailsDiscoveryScopeSQLServerConnectionInfo - SQLServerConnectionInfo value. + HealthErrorDetailsDiscoveryScopeSQLServerConnectionInfo HealthErrorDetailsDiscoveryScope = "SQLServerConnectionInfo" + // HealthErrorDetailsDiscoveryScopeStaticData - StaticData value. + HealthErrorDetailsDiscoveryScopeStaticData HealthErrorDetailsDiscoveryScope = "StaticData" ) -// PossibleAzureVMSizeValues returns the possible values for the AzureVMSize const type. -func PossibleAzureVMSizeValues() []AzureVMSize { - return []AzureVMSize{ - AzureVMSizeBasicA0, - AzureVMSizeBasicA1, - AzureVMSizeBasicA2, - AzureVMSizeBasicA3, - AzureVMSizeBasicA4, - AzureVMSizeStandardA0, - AzureVMSizeStandardA1, - AzureVMSizeStandardA10, - AzureVMSizeStandardA11, - AzureVMSizeStandardA1V2, - AzureVMSizeStandardA2, - AzureVMSizeStandardA2MV2, - AzureVMSizeStandardA2V2, - AzureVMSizeStandardA3, - AzureVMSizeStandardA4, - AzureVMSizeStandardA4MV2, - AzureVMSizeStandardA4V2, - AzureVMSizeStandardA5, - AzureVMSizeStandardA6, - AzureVMSizeStandardA7, - AzureVMSizeStandardA8, - AzureVMSizeStandardA8MV2, - AzureVMSizeStandardA8V2, - AzureVMSizeStandardA9, - AzureVMSizeStandardD1, - AzureVMSizeStandardD11, - AzureVMSizeStandardD11V2, - AzureVMSizeStandardD12, - AzureVMSizeStandardD12V2, - AzureVMSizeStandardD13, - AzureVMSizeStandardD13V2, - AzureVMSizeStandardD14, - AzureVMSizeStandardD14V2, - AzureVMSizeStandardD15V2, - AzureVMSizeStandardD16SV3, - AzureVMSizeStandardD16V3, - AzureVMSizeStandardD1V2, - AzureVMSizeStandardD2, - AzureVMSizeStandardD2SV3, - AzureVMSizeStandardD2V2, - AzureVMSizeStandardD2V3, - AzureVMSizeStandardD3, - AzureVMSizeStandardD32SV3, - AzureVMSizeStandardD32V3, - AzureVMSizeStandardD3V2, - AzureVMSizeStandardD4, - AzureVMSizeStandardD4SV3, - AzureVMSizeStandardD4V2, - AzureVMSizeStandardD4V3, - AzureVMSizeStandardD5V2, - AzureVMSizeStandardD64SV3, - AzureVMSizeStandardD64V3, - AzureVMSizeStandardD8SV3, - AzureVMSizeStandardD8V3, - AzureVMSizeStandardDS1, - AzureVMSizeStandardDS11, - AzureVMSizeStandardDS11V2, - AzureVMSizeStandardDS12, - AzureVMSizeStandardDS12V2, - AzureVMSizeStandardDS13, - AzureVMSizeStandardDS13V2, - AzureVMSizeStandardDS14, - AzureVMSizeStandardDS14V2, - AzureVMSizeStandardDS15V2, - AzureVMSizeStandardDS1V2, - AzureVMSizeStandardDS2, - AzureVMSizeStandardDS2V2, - AzureVMSizeStandardDS3, - AzureVMSizeStandardDS3V2, - AzureVMSizeStandardDS4, - AzureVMSizeStandardDS4V2, - AzureVMSizeStandardDS5V2, - AzureVMSizeStandardE16SV3, - AzureVMSizeStandardE16V3, - AzureVMSizeStandardE2SV3, - AzureVMSizeStandardE2V3, - AzureVMSizeStandardE32SV3, - AzureVMSizeStandardE32V3, - AzureVMSizeStandardE4SV3, - AzureVMSizeStandardE4V3, - AzureVMSizeStandardE64SV3, - AzureVMSizeStandardE64V3, - AzureVMSizeStandardE8SV3, - AzureVMSizeStandardE8V3, - AzureVMSizeStandardF1, - AzureVMSizeStandardF16, - AzureVMSizeStandardF16S, - AzureVMSizeStandardF16SV2, - AzureVMSizeStandardF1S, - AzureVMSizeStandardF2, - AzureVMSizeStandardF2S, - AzureVMSizeStandardF2SV2, - AzureVMSizeStandardF32SV2, - AzureVMSizeStandardF4, - AzureVMSizeStandardF4S, - AzureVMSizeStandardF4SV2, - AzureVMSizeStandardF64SV2, - AzureVMSizeStandardF72SV2, - AzureVMSizeStandardF8, - AzureVMSizeStandardF8S, - AzureVMSizeStandardF8SV2, - AzureVMSizeStandardG1, - AzureVMSizeStandardG2, - AzureVMSizeStandardG3, - AzureVMSizeStandardG4, - AzureVMSizeStandardG5, - AzureVMSizeStandardGS1, - AzureVMSizeStandardGS2, - AzureVMSizeStandardGS3, - AzureVMSizeStandardGS4, - AzureVMSizeStandardGS5, - AzureVMSizeStandardH16, - AzureVMSizeStandardH16M, - AzureVMSizeStandardH16Mr, - AzureVMSizeStandardH16R, - AzureVMSizeStandardH8, - AzureVMSizeStandardH8M, - AzureVMSizeStandardL16S, - AzureVMSizeStandardL32S, - AzureVMSizeStandardL4S, - AzureVMSizeStandardL8S, - AzureVMSizeStandardM128Ms, - AzureVMSizeStandardM128S, - AzureVMSizeStandardM64Ms, - AzureVMSizeStandardM64S, - AzureVMSizeUnknown, +// PossibleHealthErrorDetailsDiscoveryScopeValues returns the possible values for the HealthErrorDetailsDiscoveryScope const type. +func PossibleHealthErrorDetailsDiscoveryScopeValues() []HealthErrorDetailsDiscoveryScope { + return []HealthErrorDetailsDiscoveryScope{ + HealthErrorDetailsDiscoveryScopeAppsAndRoles, + HealthErrorDetailsDiscoveryScopeDependencyMap, + HealthErrorDetailsDiscoveryScopeDiscoveryTargets, + HealthErrorDetailsDiscoveryScopeSQLServerConnectionInfo, + HealthErrorDetailsDiscoveryScopeStaticData, } } -// AzureVMSuitabilityDetail - If machine is not suitable for cloud, this explains the reasons. -type AzureVMSuitabilityDetail string +// HealthErrorDetailsSource - HealthError Details Source +type HealthErrorDetailsSource string const ( - AzureVMSuitabilityDetailCannotReportBandwidthCosts AzureVMSuitabilityDetail = "CannotReportBandwidthCosts" - AzureVMSuitabilityDetailCannotReportComputeCost AzureVMSuitabilityDetail = "CannotReportComputeCost" - AzureVMSuitabilityDetailCannotReportStorageCost AzureVMSuitabilityDetail = "CannotReportStorageCost" - AzureVMSuitabilityDetailNone AzureVMSuitabilityDetail = "None" - AzureVMSuitabilityDetailPercentageOfCoresUtilizedMissing AzureVMSuitabilityDetail = "PercentageOfCoresUtilizedMissing" - AzureVMSuitabilityDetailPercentageOfCoresUtilizedOutOfRange AzureVMSuitabilityDetail = "PercentageOfCoresUtilizedOutOfRange" - AzureVMSuitabilityDetailPercentageOfMemoryUtilizedMissing AzureVMSuitabilityDetail = "PercentageOfMemoryUtilizedMissing" - AzureVMSuitabilityDetailPercentageOfMemoryUtilizedOutOfRange AzureVMSuitabilityDetail = "PercentageOfMemoryUtilizedOutOfRange" - AzureVMSuitabilityDetailRecommendedSizeHasLessNetworkAdapters AzureVMSuitabilityDetail = "RecommendedSizeHasLessNetworkAdapters" + // HealthErrorDetailsSourceRefreshFabricLayout - RefreshFabricLayout value. + HealthErrorDetailsSourceRefreshFabricLayout HealthErrorDetailsSource = "RefreshFabricLayout" + // HealthErrorDetailsSourceRefreshFabricLayoutDependencyMap - RefreshFabricLayoutDependencyMap value. + HealthErrorDetailsSourceRefreshFabricLayoutDependencyMap HealthErrorDetailsSource = "RefreshFabricLayoutDependencyMap" + // HealthErrorDetailsSourceRefreshFabricLayoutGuest - RefreshFabricLayoutGuest value. + HealthErrorDetailsSourceRefreshFabricLayoutGuest HealthErrorDetailsSource = "RefreshFabricLayoutGuest" ) -// PossibleAzureVMSuitabilityDetailValues returns the possible values for the AzureVMSuitabilityDetail const type. -func PossibleAzureVMSuitabilityDetailValues() []AzureVMSuitabilityDetail { - return []AzureVMSuitabilityDetail{ - AzureVMSuitabilityDetailCannotReportBandwidthCosts, - AzureVMSuitabilityDetailCannotReportComputeCost, - AzureVMSuitabilityDetailCannotReportStorageCost, - AzureVMSuitabilityDetailNone, - AzureVMSuitabilityDetailPercentageOfCoresUtilizedMissing, - AzureVMSuitabilityDetailPercentageOfCoresUtilizedOutOfRange, - AzureVMSuitabilityDetailPercentageOfMemoryUtilizedMissing, - AzureVMSuitabilityDetailPercentageOfMemoryUtilizedOutOfRange, - AzureVMSuitabilityDetailRecommendedSizeHasLessNetworkAdapters, +// PossibleHealthErrorDetailsSourceValues returns the possible values for the HealthErrorDetailsSource const type. +func PossibleHealthErrorDetailsSourceValues() []HealthErrorDetailsSource { + return []HealthErrorDetailsSource{ + HealthErrorDetailsSourceRefreshFabricLayout, + HealthErrorDetailsSourceRefreshFabricLayoutDependencyMap, + HealthErrorDetailsSourceRefreshFabricLayoutGuest, } } -// AzureVMSuitabilityExplanation - If machine is not ready to be migrated, this explains the reasons and mitigation steps. -type AzureVMSuitabilityExplanation string +// HighAvailability - Value indicating whether the VM is highly available +type HighAvailability string const ( - AzureVMSuitabilityExplanationBootTypeNotSupported AzureVMSuitabilityExplanation = "BootTypeNotSupported" - AzureVMSuitabilityExplanationBootTypeUnknown AzureVMSuitabilityExplanation = "BootTypeUnknown" - AzureVMSuitabilityExplanationCheckCentOsVersion AzureVMSuitabilityExplanation = "CheckCentOsVersion" - AzureVMSuitabilityExplanationCheckCoreOsLinuxVersion AzureVMSuitabilityExplanation = "CheckCoreOsLinuxVersion" - AzureVMSuitabilityExplanationCheckDebianLinuxVersion AzureVMSuitabilityExplanation = "CheckDebianLinuxVersion" - AzureVMSuitabilityExplanationCheckOpenSuseLinuxVersion AzureVMSuitabilityExplanation = "CheckOpenSuseLinuxVersion" - AzureVMSuitabilityExplanationCheckOracleLinuxVersion AzureVMSuitabilityExplanation = "CheckOracleLinuxVersion" - AzureVMSuitabilityExplanationCheckRedHatLinuxVersion AzureVMSuitabilityExplanation = "CheckRedHatLinuxVersion" - AzureVMSuitabilityExplanationCheckSuseLinuxVersion AzureVMSuitabilityExplanation = "CheckSuseLinuxVersion" - AzureVMSuitabilityExplanationCheckUbuntuLinuxVersion AzureVMSuitabilityExplanation = "CheckUbuntuLinuxVersion" - AzureVMSuitabilityExplanationCheckWindowsServer2008R2Version AzureVMSuitabilityExplanation = "CheckWindowsServer2008R2Version" - AzureVMSuitabilityExplanationEndorsedWithConditionsLinuxDistributions AzureVMSuitabilityExplanation = "EndorsedWithConditionsLinuxDistributions" - AzureVMSuitabilityExplanationGuestOperatingSystemArchitectureNotSupported AzureVMSuitabilityExplanation = "GuestOperatingSystemArchitectureNotSupported" - AzureVMSuitabilityExplanationGuestOperatingSystemNotSupported AzureVMSuitabilityExplanation = "GuestOperatingSystemNotSupported" - AzureVMSuitabilityExplanationGuestOperatingSystemUnknown AzureVMSuitabilityExplanation = "GuestOperatingSystemUnknown" - AzureVMSuitabilityExplanationInternalErrorOccurredDuringComputeEvaluation AzureVMSuitabilityExplanation = "InternalErrorOccurredDuringComputeEvaluation" - AzureVMSuitabilityExplanationInternalErrorOccurredDuringNetworkEvaluation AzureVMSuitabilityExplanation = "InternalErrorOccurredDuringNetworkEvaluation" - AzureVMSuitabilityExplanationInternalErrorOccurredDuringStorageEvaluation AzureVMSuitabilityExplanation = "InternalErrorOccurredDuringStorageEvaluation" - AzureVMSuitabilityExplanationMoreDisksThanSupported AzureVMSuitabilityExplanation = "MoreDisksThanSupported" - AzureVMSuitabilityExplanationNoGuestOperatingSystemConditionallySupported AzureVMSuitabilityExplanation = "NoGuestOperatingSystemConditionallySupported" - AzureVMSuitabilityExplanationNoSuitableVMSizeFound AzureVMSuitabilityExplanation = "NoSuitableVmSizeFound" - AzureVMSuitabilityExplanationNoVMSizeForBasicPricingTier AzureVMSuitabilityExplanation = "NoVmSizeForBasicPricingTier" - AzureVMSuitabilityExplanationNoVMSizeForSelectedAzureLocation AzureVMSuitabilityExplanation = "NoVmSizeForSelectedAzureLocation" - AzureVMSuitabilityExplanationNoVMSizeForSelectedPricingTier AzureVMSuitabilityExplanation = "NoVmSizeForSelectedPricingTier" - AzureVMSuitabilityExplanationNoVMSizeForStandardPricingTier AzureVMSuitabilityExplanation = "NoVmSizeForStandardPricingTier" - AzureVMSuitabilityExplanationNoVMSizeSupportsNetworkPerformance AzureVMSuitabilityExplanation = "NoVmSizeSupportsNetworkPerformance" - AzureVMSuitabilityExplanationNoVMSizeSupportsStoragePerformance AzureVMSuitabilityExplanation = "NoVmSizeSupportsStoragePerformance" - AzureVMSuitabilityExplanationNotApplicable AzureVMSuitabilityExplanation = "NotApplicable" - AzureVMSuitabilityExplanationOneOrMoreAdaptersNotSuitable AzureVMSuitabilityExplanation = "OneOrMoreAdaptersNotSuitable" - AzureVMSuitabilityExplanationOneOrMoreDisksNotSuitable AzureVMSuitabilityExplanation = "OneOrMoreDisksNotSuitable" - AzureVMSuitabilityExplanationUnendorsedLinuxDistributions AzureVMSuitabilityExplanation = "UnendorsedLinuxDistributions" - AzureVMSuitabilityExplanationUnknown AzureVMSuitabilityExplanation = "Unknown" - AzureVMSuitabilityExplanationWindowsClientVersionsConditionallySupported AzureVMSuitabilityExplanation = "WindowsClientVersionsConditionallySupported" - AzureVMSuitabilityExplanationWindowsOSNoLongerUnderMSSupport AzureVMSuitabilityExplanation = "WindowsOSNoLongerUnderMSSupport" - AzureVMSuitabilityExplanationWindowsServerVersionConditionallySupported AzureVMSuitabilityExplanation = "WindowsServerVersionConditionallySupported" - AzureVMSuitabilityExplanationWindowsServerVersionsSupportedWithCaveat AzureVMSuitabilityExplanation = "WindowsServerVersionsSupportedWithCaveat" + // HighAvailabilityNo - No value. + HighAvailabilityNo HighAvailability = "No" + // HighAvailabilityUnknown - Unknown value. + HighAvailabilityUnknown HighAvailability = "Unknown" + // HighAvailabilityYes - Yes value. + HighAvailabilityYes HighAvailability = "Yes" ) -// PossibleAzureVMSuitabilityExplanationValues returns the possible values for the AzureVMSuitabilityExplanation const type. -func PossibleAzureVMSuitabilityExplanationValues() []AzureVMSuitabilityExplanation { - return []AzureVMSuitabilityExplanation{ - AzureVMSuitabilityExplanationBootTypeNotSupported, - AzureVMSuitabilityExplanationBootTypeUnknown, - AzureVMSuitabilityExplanationCheckCentOsVersion, - AzureVMSuitabilityExplanationCheckCoreOsLinuxVersion, - AzureVMSuitabilityExplanationCheckDebianLinuxVersion, - AzureVMSuitabilityExplanationCheckOpenSuseLinuxVersion, - AzureVMSuitabilityExplanationCheckOracleLinuxVersion, - AzureVMSuitabilityExplanationCheckRedHatLinuxVersion, - AzureVMSuitabilityExplanationCheckSuseLinuxVersion, - AzureVMSuitabilityExplanationCheckUbuntuLinuxVersion, - AzureVMSuitabilityExplanationCheckWindowsServer2008R2Version, - AzureVMSuitabilityExplanationEndorsedWithConditionsLinuxDistributions, - AzureVMSuitabilityExplanationGuestOperatingSystemArchitectureNotSupported, - AzureVMSuitabilityExplanationGuestOperatingSystemNotSupported, - AzureVMSuitabilityExplanationGuestOperatingSystemUnknown, - AzureVMSuitabilityExplanationInternalErrorOccurredDuringComputeEvaluation, - AzureVMSuitabilityExplanationInternalErrorOccurredDuringNetworkEvaluation, - AzureVMSuitabilityExplanationInternalErrorOccurredDuringStorageEvaluation, - AzureVMSuitabilityExplanationMoreDisksThanSupported, - AzureVMSuitabilityExplanationNoGuestOperatingSystemConditionallySupported, - AzureVMSuitabilityExplanationNoSuitableVMSizeFound, - AzureVMSuitabilityExplanationNoVMSizeForBasicPricingTier, - AzureVMSuitabilityExplanationNoVMSizeForSelectedAzureLocation, - AzureVMSuitabilityExplanationNoVMSizeForSelectedPricingTier, - AzureVMSuitabilityExplanationNoVMSizeForStandardPricingTier, - AzureVMSuitabilityExplanationNoVMSizeSupportsNetworkPerformance, - AzureVMSuitabilityExplanationNoVMSizeSupportsStoragePerformance, - AzureVMSuitabilityExplanationNotApplicable, - AzureVMSuitabilityExplanationOneOrMoreAdaptersNotSuitable, - AzureVMSuitabilityExplanationOneOrMoreDisksNotSuitable, - AzureVMSuitabilityExplanationUnendorsedLinuxDistributions, - AzureVMSuitabilityExplanationUnknown, - AzureVMSuitabilityExplanationWindowsClientVersionsConditionallySupported, - AzureVMSuitabilityExplanationWindowsOSNoLongerUnderMSSupport, - AzureVMSuitabilityExplanationWindowsServerVersionConditionallySupported, - AzureVMSuitabilityExplanationWindowsServerVersionsSupportedWithCaveat, +// PossibleHighAvailabilityValues returns the possible values for the HighAvailability const type. +func PossibleHighAvailabilityValues() []HighAvailability { + return []HighAvailability{ + HighAvailabilityNo, + HighAvailabilityUnknown, + HighAvailabilityYes, } } -// CloudSuitability - Whether this disk is suitable for Azure. -type CloudSuitability string +// HighAvailabilityValues - Value indicating whether the VM is highly available +type HighAvailabilityValues string const ( - CloudSuitabilityConditionallySuitable CloudSuitability = "ConditionallySuitable" - CloudSuitabilityNotSuitable CloudSuitability = "NotSuitable" - CloudSuitabilityReadinessUnknown CloudSuitability = "ReadinessUnknown" - CloudSuitabilitySuitable CloudSuitability = "Suitable" - CloudSuitabilityUnknown CloudSuitability = "Unknown" + // HighAvailabilityValuesNo - No value. + HighAvailabilityValuesNo HighAvailabilityValues = "No" + // HighAvailabilityValuesUnknown - Unknown value. + HighAvailabilityValuesUnknown HighAvailabilityValues = "Unknown" + // HighAvailabilityValuesYes - Yes value. + HighAvailabilityValuesYes HighAvailabilityValues = "Yes" ) -// PossibleCloudSuitabilityValues returns the possible values for the CloudSuitability const type. -func PossibleCloudSuitabilityValues() []CloudSuitability { - return []CloudSuitability{ - CloudSuitabilityConditionallySuitable, - CloudSuitabilityNotSuitable, - CloudSuitabilityReadinessUnknown, - CloudSuitabilitySuitable, - CloudSuitabilityUnknown, +// PossibleHighAvailabilityValuesValues returns the possible values for the HighAvailabilityValues const type. +func PossibleHighAvailabilityValuesValues() []HighAvailabilityValues { + return []HighAvailabilityValues{ + HighAvailabilityValuesNo, + HighAvailabilityValuesUnknown, + HighAvailabilityValuesYes, } } -// Currency - Currency to report prices in. -type Currency string +// ImportTypeValues - ImportTypeValues enum. +type ImportTypeValues string const ( - CurrencyARS Currency = "ARS" - CurrencyAUD Currency = "AUD" - CurrencyBRL Currency = "BRL" - CurrencyCAD Currency = "CAD" - CurrencyCHF Currency = "CHF" - CurrencyCNY Currency = "CNY" - CurrencyDKK Currency = "DKK" - CurrencyEUR Currency = "EUR" - CurrencyGBP Currency = "GBP" - CurrencyHKD Currency = "HKD" - CurrencyIDR Currency = "IDR" - CurrencyINR Currency = "INR" - CurrencyJPY Currency = "JPY" - CurrencyKRW Currency = "KRW" - CurrencyMXN Currency = "MXN" - CurrencyMYR Currency = "MYR" - CurrencyNOK Currency = "NOK" - CurrencyNZD Currency = "NZD" - CurrencyRUB Currency = "RUB" - CurrencySAR Currency = "SAR" - CurrencySEK Currency = "SEK" - CurrencyTRY Currency = "TRY" - CurrencyTWD Currency = "TWD" - CurrencyUSD Currency = "USD" - CurrencyUnknown Currency = "Unknown" - CurrencyZAR Currency = "ZAR" + // ImportTypeValuesAzureMigrateCSV - AzureMigrateCSV value. + ImportTypeValuesAzureMigrateCSV ImportTypeValues = "AzureMigrateCSV" + // ImportTypeValuesRVToolsXlsx - RVToolsXlsx value. + ImportTypeValuesRVToolsXlsx ImportTypeValues = "RVToolsXlsx" ) -// PossibleCurrencyValues returns the possible values for the Currency const type. -func PossibleCurrencyValues() []Currency { - return []Currency{ - CurrencyARS, - CurrencyAUD, - CurrencyBRL, - CurrencyCAD, - CurrencyCHF, - CurrencyCNY, - CurrencyDKK, - CurrencyEUR, - CurrencyGBP, - CurrencyHKD, - CurrencyIDR, - CurrencyINR, - CurrencyJPY, - CurrencyKRW, - CurrencyMXN, - CurrencyMYR, - CurrencyNOK, - CurrencyNZD, - CurrencyRUB, - CurrencySAR, - CurrencySEK, - CurrencyTRY, - CurrencyTWD, - CurrencyUSD, - CurrencyUnknown, - CurrencyZAR, +// PossibleImportTypeValuesValues returns the possible values for the ImportTypeValues const type. +func PossibleImportTypeValuesValues() []ImportTypeValues { + return []ImportTypeValues{ + ImportTypeValuesAzureMigrateCSV, + ImportTypeValuesRVToolsXlsx, } } -// GroupStatus - Whether the group has been created and is valid. -type GroupStatus string +// JobResult - JobResultValues +type JobResult string const ( - GroupStatusCompleted GroupStatus = "Completed" - GroupStatusCreated GroupStatus = "Created" - GroupStatusInvalid GroupStatus = "Invalid" - GroupStatusRunning GroupStatus = "Running" - GroupStatusUpdated GroupStatus = "Updated" + // JobResultCompleted - Completed value. + JobResultCompleted JobResult = "Completed" + // JobResultCompletedWithErrors - CompletedWithErrors value. + JobResultCompletedWithErrors JobResult = "CompletedWithErrors" + // JobResultCompletedWithWarnings - CompletedWithWarnings value. + JobResultCompletedWithWarnings JobResult = "CompletedWithWarnings" + // JobResultFailed - Failed value. + JobResultFailed JobResult = "Failed" + // JobResultInProgress - InProgress value. + JobResultInProgress JobResult = "InProgress" + // JobResultUnknown - Unknown value. + JobResultUnknown JobResult = "Unknown" + // JobResultWaitingForBlobUpload - WaitingForBlobUpload value. + JobResultWaitingForBlobUpload JobResult = "WaitingForBlobUpload" ) -// PossibleGroupStatusValues returns the possible values for the GroupStatus const type. -func PossibleGroupStatusValues() []GroupStatus { - return []GroupStatus{ - GroupStatusCompleted, - GroupStatusCreated, - GroupStatusInvalid, - GroupStatusRunning, - GroupStatusUpdated, +// PossibleJobResultValues returns the possible values for the JobResult const type. +func PossibleJobResultValues() []JobResult { + return []JobResult{ + JobResultCompleted, + JobResultCompletedWithErrors, + JobResultCompletedWithWarnings, + JobResultFailed, + JobResultInProgress, + JobResultUnknown, + JobResultWaitingForBlobUpload, } } -// GroupUpdateOperation - Whether to add or remove the machines. -type GroupUpdateOperation string +// MasterSitePropertiesPublicNetworkAccess - PublicNetworkAccess +type MasterSitePropertiesPublicNetworkAccess string const ( - GroupUpdateOperationAdd GroupUpdateOperation = "Add" - GroupUpdateOperationRemove GroupUpdateOperation = "Remove" + // MasterSitePropertiesPublicNetworkAccessDisabled - Disabled value. + MasterSitePropertiesPublicNetworkAccessDisabled MasterSitePropertiesPublicNetworkAccess = "Disabled" + // MasterSitePropertiesPublicNetworkAccessEnabled - Enabled value. + MasterSitePropertiesPublicNetworkAccessEnabled MasterSitePropertiesPublicNetworkAccess = "Enabled" + // MasterSitePropertiesPublicNetworkAccessNotSpecified - NotSpecified value. + MasterSitePropertiesPublicNetworkAccessNotSpecified MasterSitePropertiesPublicNetworkAccess = "NotSpecified" ) -// PossibleGroupUpdateOperationValues returns the possible values for the GroupUpdateOperation const type. -func PossibleGroupUpdateOperationValues() []GroupUpdateOperation { - return []GroupUpdateOperation{ - GroupUpdateOperationAdd, - GroupUpdateOperationRemove, +// PossibleMasterSitePropertiesPublicNetworkAccessValues returns the possible values for the MasterSitePropertiesPublicNetworkAccess const type. +func PossibleMasterSitePropertiesPublicNetworkAccessValues() []MasterSitePropertiesPublicNetworkAccess { + return []MasterSitePropertiesPublicNetworkAccess{ + MasterSitePropertiesPublicNetworkAccessDisabled, + MasterSitePropertiesPublicNetworkAccessEnabled, + MasterSitePropertiesPublicNetworkAccessNotSpecified, } } -// MachineBootType - Boot type of the machine. -type MachineBootType string +// MicrosoftAzureFDSWebRoleHealthErrorDetailsSource - HealthError Details Source +type MicrosoftAzureFDSWebRoleHealthErrorDetailsSource string const ( - MachineBootTypeBIOS MachineBootType = "BIOS" - MachineBootTypeEFI MachineBootType = "EFI" - MachineBootTypeUnknown MachineBootType = "Unknown" + // MicrosoftAzureFDSWebRoleHealthErrorDetailsSourceRefreshFabricLayout - RefreshFabricLayout value. + MicrosoftAzureFDSWebRoleHealthErrorDetailsSourceRefreshFabricLayout MicrosoftAzureFDSWebRoleHealthErrorDetailsSource = "RefreshFabricLayout" + // MicrosoftAzureFDSWebRoleHealthErrorDetailsSourceRefreshFabricLayoutDependencyMap - RefreshFabricLayoutDependencyMap value. + MicrosoftAzureFDSWebRoleHealthErrorDetailsSourceRefreshFabricLayoutDependencyMap MicrosoftAzureFDSWebRoleHealthErrorDetailsSource = "RefreshFabricLayoutDependencyMap" + // MicrosoftAzureFDSWebRoleHealthErrorDetailsSourceRefreshFabricLayoutGuest - RefreshFabricLayoutGuest value. + MicrosoftAzureFDSWebRoleHealthErrorDetailsSourceRefreshFabricLayoutGuest MicrosoftAzureFDSWebRoleHealthErrorDetailsSource = "RefreshFabricLayoutGuest" ) -// PossibleMachineBootTypeValues returns the possible values for the MachineBootType const type. -func PossibleMachineBootTypeValues() []MachineBootType { - return []MachineBootType{ - MachineBootTypeBIOS, - MachineBootTypeEFI, - MachineBootTypeUnknown, +// PossibleMicrosoftAzureFDSWebRoleHealthErrorDetailsSourceValues returns the possible values for the MicrosoftAzureFDSWebRoleHealthErrorDetailsSource const type. +func PossibleMicrosoftAzureFDSWebRoleHealthErrorDetailsSourceValues() []MicrosoftAzureFDSWebRoleHealthErrorDetailsSource { + return []MicrosoftAzureFDSWebRoleHealthErrorDetailsSource{ + MicrosoftAzureFDSWebRoleHealthErrorDetailsSourceRefreshFabricLayout, + MicrosoftAzureFDSWebRoleHealthErrorDetailsSourceRefreshFabricLayoutDependencyMap, + MicrosoftAzureFDSWebRoleHealthErrorDetailsSourceRefreshFabricLayoutGuest, } } -// Percentile - Percentile of performance data used to recommend Azure size. -type Percentile string +// Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default +// value is "user,system" +type Origin string const ( - PercentilePercentile50 Percentile = "Percentile50" - PercentilePercentile90 Percentile = "Percentile90" - PercentilePercentile95 Percentile = "Percentile95" - PercentilePercentile99 Percentile = "Percentile99" + OriginSystem Origin = "system" + OriginUser Origin = "user" + OriginUserSystem Origin = "user,system" ) -// PossiblePercentileValues returns the possible values for the Percentile const type. -func PossiblePercentileValues() []Percentile { - return []Percentile{ - PercentilePercentile50, - PercentilePercentile90, - PercentilePercentile95, - PercentilePercentile99, +// PossibleOriginValues returns the possible values for the Origin const type. +func PossibleOriginValues() []Origin { + return []Origin{ + OriginSystem, + OriginUser, + OriginUserSystem, } } -// PrivateEndpointConnectionPropertiesProvisioningState - Indicates whether there is an ongoing operation on the private endpoint. -type PrivateEndpointConnectionPropertiesProvisioningState string - -const ( - PrivateEndpointConnectionPropertiesProvisioningStateAccepted PrivateEndpointConnectionPropertiesProvisioningState = "Accepted" - PrivateEndpointConnectionPropertiesProvisioningStateFailed PrivateEndpointConnectionPropertiesProvisioningState = "Failed" - PrivateEndpointConnectionPropertiesProvisioningStateInProgress PrivateEndpointConnectionPropertiesProvisioningState = "InProgress" - PrivateEndpointConnectionPropertiesProvisioningStateSucceeded PrivateEndpointConnectionPropertiesProvisioningState = "Succeeded" -) - -// PossiblePrivateEndpointConnectionPropertiesProvisioningStateValues returns the possible values for the PrivateEndpointConnectionPropertiesProvisioningState const type. -func PossiblePrivateEndpointConnectionPropertiesProvisioningStateValues() []PrivateEndpointConnectionPropertiesProvisioningState { - return []PrivateEndpointConnectionPropertiesProvisioningState{ - PrivateEndpointConnectionPropertiesProvisioningStateAccepted, - PrivateEndpointConnectionPropertiesProvisioningStateFailed, - PrivateEndpointConnectionPropertiesProvisioningStateInProgress, - PrivateEndpointConnectionPropertiesProvisioningStateSucceeded, - } -} - -// PrivateLinkServiceConnectionStateStatus - Connection status of the private endpoint connection. +// PrivateLinkServiceConnectionStateStatus - PrivateLinkServiceConnectionState type PrivateLinkServiceConnectionStateStatus string const ( - PrivateLinkServiceConnectionStateStatusApproved PrivateLinkServiceConnectionStateStatus = "Approved" + // PrivateLinkServiceConnectionStateStatusApproved - Approved value. + PrivateLinkServiceConnectionStateStatusApproved PrivateLinkServiceConnectionStateStatus = "Approved" + // PrivateLinkServiceConnectionStateStatusDisconnected - Disconnected value. PrivateLinkServiceConnectionStateStatusDisconnected PrivateLinkServiceConnectionStateStatus = "Disconnected" - PrivateLinkServiceConnectionStateStatusPending PrivateLinkServiceConnectionStateStatus = "Pending" - PrivateLinkServiceConnectionStateStatusRejected PrivateLinkServiceConnectionStateStatus = "Rejected" + // PrivateLinkServiceConnectionStateStatusPending - Pending value. + PrivateLinkServiceConnectionStateStatusPending PrivateLinkServiceConnectionStateStatus = "Pending" + // PrivateLinkServiceConnectionStateStatusRejected - Rejected value. + PrivateLinkServiceConnectionStateStatusRejected PrivateLinkServiceConnectionStateStatus = "Rejected" ) // PossiblePrivateLinkServiceConnectionStateStatusValues returns the possible values for the PrivateLinkServiceConnectionStateStatus const type. @@ -1151,80 +614,569 @@ func PossiblePrivateLinkServiceConnectionStateStatusValues() []PrivateLinkServic } } -// ProjectStatus - Assessment project status. -type ProjectStatus string - -const ( - ProjectStatusActive ProjectStatus = "Active" - ProjectStatusInactive ProjectStatus = "Inactive" -) - -// PossibleProjectStatusValues returns the possible values for the ProjectStatus const type. -func PossibleProjectStatusValues() []ProjectStatus { - return []ProjectStatus{ - ProjectStatusActive, - ProjectStatusInactive, - } -} - -// ProvisioningState - Provisioning state of the project. +// ProvisioningState - The status of the current operation. type ProvisioningState string const ( - ProvisioningStateAccepted ProvisioningState = "Accepted" - ProvisioningStateCreating ProvisioningState = "Creating" - ProvisioningStateDeleting ProvisioningState = "Deleting" - ProvisioningStateFailed ProvisioningState = "Failed" - ProvisioningStateMoving ProvisioningState = "Moving" + // ProvisioningStateCanceled - Canceled value. + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateCompleted - Completed value. + ProvisioningStateCompleted ProvisioningState = "Completed" + // ProvisioningStateCreated - Created value. + ProvisioningStateCreated ProvisioningState = "Created" + // ProvisioningStateFailed - Failed value. + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateRunning - Running value. + ProvisioningStateRunning ProvisioningState = "Running" + // ProvisioningStateSucceeded - Succeeded value. ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdated - Updated value. + ProvisioningStateUpdated ProvisioningState = "Updated" ) // PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. func PossibleProvisioningStateValues() []ProvisioningState { return []ProvisioningState{ - ProvisioningStateAccepted, - ProvisioningStateCreating, - ProvisioningStateDeleting, + ProvisioningStateCanceled, + ProvisioningStateCompleted, + ProvisioningStateCreated, ProvisioningStateFailed, - ProvisioningStateMoving, + ProvisioningStateRunning, ProvisioningStateSucceeded, + ProvisioningStateUpdated, + } +} + +// SQLAvailabilityGroupPropertiesAvailabilityGroupType - AvailabilityGroupType +type SQLAvailabilityGroupPropertiesAvailabilityGroupType string + +const ( + // SQLAvailabilityGroupPropertiesAvailabilityGroupTypeDistributed - Distributed value. + SQLAvailabilityGroupPropertiesAvailabilityGroupTypeDistributed SQLAvailabilityGroupPropertiesAvailabilityGroupType = "Distributed" + // SQLAvailabilityGroupPropertiesAvailabilityGroupTypeTraditional - Traditional value. + SQLAvailabilityGroupPropertiesAvailabilityGroupTypeTraditional SQLAvailabilityGroupPropertiesAvailabilityGroupType = "Traditional" + // SQLAvailabilityGroupPropertiesAvailabilityGroupTypeUnknown - Unknown value. + SQLAvailabilityGroupPropertiesAvailabilityGroupTypeUnknown SQLAvailabilityGroupPropertiesAvailabilityGroupType = "Unknown" +) + +// PossibleSQLAvailabilityGroupPropertiesAvailabilityGroupTypeValues returns the possible values for the SQLAvailabilityGroupPropertiesAvailabilityGroupType const type. +func PossibleSQLAvailabilityGroupPropertiesAvailabilityGroupTypeValues() []SQLAvailabilityGroupPropertiesAvailabilityGroupType { + return []SQLAvailabilityGroupPropertiesAvailabilityGroupType{ + SQLAvailabilityGroupPropertiesAvailabilityGroupTypeDistributed, + SQLAvailabilityGroupPropertiesAvailabilityGroupTypeTraditional, + SQLAvailabilityGroupPropertiesAvailabilityGroupTypeUnknown, + } +} + +// SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaCommitMode - ReplicaCommitMode +type SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaCommitMode string + +const ( + // SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaCommitModeAsynchronous - Asynchronous value. + SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaCommitModeAsynchronous SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaCommitMode = "Asynchronous" + // SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaCommitModeSynchronous - Synchronous value. + SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaCommitModeSynchronous SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaCommitMode = "Synchronous" + // SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaCommitModeUnknown - Unknown value. + SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaCommitModeUnknown SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaCommitMode = "Unknown" +) + +// PossibleSQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaCommitModeValues returns the possible values for the SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaCommitMode const type. +func PossibleSQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaCommitModeValues() []SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaCommitMode { + return []SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaCommitMode{ + SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaCommitModeAsynchronous, + SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaCommitModeSynchronous, + SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaCommitModeUnknown, + } +} + +// SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaReadMode - ReplicaReadMode +type SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaReadMode string + +const ( + // SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaReadModeNone - None value. + SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaReadModeNone SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaReadMode = "None" + // SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaReadModeReadOnly - ReadOnly value. + SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaReadModeReadOnly SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaReadMode = "ReadOnly" + // SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaReadModeReadWrite - ReadWrite value. + SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaReadModeReadWrite SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaReadMode = "ReadWrite" + // SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaReadModeUnknown - Unknown value. + SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaReadModeUnknown SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaReadMode = "Unknown" +) + +// PossibleSQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaReadModeValues returns the possible values for the SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaReadMode const type. +func PossibleSQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaReadModeValues() []SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaReadMode { + return []SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaReadMode{ + SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaReadModeNone, + SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaReadModeReadOnly, + SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaReadModeReadWrite, + SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaReadModeUnknown, + } +} + +// SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSeedMode - ReplicaSeedMode +type SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSeedMode string + +const ( + // SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSeedModeAutomatic - Automatic value. + SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSeedModeAutomatic SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSeedMode = "Automatic" + // SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSeedModeManual - Manual value. + SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSeedModeManual SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSeedMode = "Manual" + // SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSeedModeUnknown - Unknown value. + SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSeedModeUnknown SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSeedMode = "Unknown" +) + +// PossibleSQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSeedModeValues returns the possible values for the SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSeedMode const type. +func PossibleSQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSeedModeValues() []SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSeedMode { + return []SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSeedMode{ + SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSeedModeAutomatic, + SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSeedModeManual, + SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSeedModeUnknown, + } +} + +// SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaState - ReplicaState +type SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaState string + +const ( + // SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaStatePrimary - Primary value. + SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaStatePrimary SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaState = "Primary" + // SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaStateSecondary - Secondary value. + SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaStateSecondary SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaState = "Secondary" + // SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaStateUnknown - Unknown value. + SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaStateUnknown SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaState = "Unknown" +) + +// PossibleSQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaStateValues returns the possible values for the SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaState const type. +func PossibleSQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaStateValues() []SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaState { + return []SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaState{ + SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaStatePrimary, + SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaStateSecondary, + SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaStateUnknown, + } +} + +// SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSyncStatus - ReplicaSyncStatus +type SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSyncStatus string + +const ( + // SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSyncStatusSynchronized - Synchronized value. + SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSyncStatusSynchronized SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSyncStatus = "Synchronized" + // SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSyncStatusUnknown - Unknown value. + SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSyncStatusUnknown SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSyncStatus = "Unknown" + // SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSyncStatusUnsynchronized - Unsynchronized value. + SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSyncStatusUnsynchronized SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSyncStatus = "Unsynchronized" +) + +// PossibleSQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSyncStatusValues returns the possible values for the SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSyncStatus const type. +func PossibleSQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSyncStatusValues() []SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSyncStatus { + return []SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSyncStatus{ + SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSyncStatusSynchronized, + SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSyncStatusUnknown, + SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSyncStatusUnsynchronized, + } +} + +// SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaType - ReplicaType +type SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaType string + +const ( + // SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaTypeAvailabilityGroupReplica - AvailabilityGroupReplica value. + SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaTypeAvailabilityGroupReplica SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaType = "AvailabilityGroupReplica" + // SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaTypeDatabaseReplica - DatabaseReplica value. + SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaTypeDatabaseReplica SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaType = "DatabaseReplica" + // SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaTypeUnknown - Unknown value. + SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaTypeUnknown SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaType = "Unknown" +) + +// PossibleSQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaTypeValues returns the possible values for the SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaType const type. +func PossibleSQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaTypeValues() []SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaType { + return []SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaType{ + SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaTypeAvailabilityGroupReplica, + SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaTypeDatabaseReplica, + SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaTypeUnknown, + } +} + +// SQLAvailabilityReplicaOverviewReplicaState - Overview Replica State +type SQLAvailabilityReplicaOverviewReplicaState string + +const ( + // SQLAvailabilityReplicaOverviewReplicaStatePrimary - Primary value. + SQLAvailabilityReplicaOverviewReplicaStatePrimary SQLAvailabilityReplicaOverviewReplicaState = "Primary" + // SQLAvailabilityReplicaOverviewReplicaStateSecondary - Secondary value. + SQLAvailabilityReplicaOverviewReplicaStateSecondary SQLAvailabilityReplicaOverviewReplicaState = "Secondary" + // SQLAvailabilityReplicaOverviewReplicaStateUnknown - Unknown value. + SQLAvailabilityReplicaOverviewReplicaStateUnknown SQLAvailabilityReplicaOverviewReplicaState = "Unknown" +) + +// PossibleSQLAvailabilityReplicaOverviewReplicaStateValues returns the possible values for the SQLAvailabilityReplicaOverviewReplicaState const type. +func PossibleSQLAvailabilityReplicaOverviewReplicaStateValues() []SQLAvailabilityReplicaOverviewReplicaState { + return []SQLAvailabilityReplicaOverviewReplicaState{ + SQLAvailabilityReplicaOverviewReplicaStatePrimary, + SQLAvailabilityReplicaOverviewReplicaStateSecondary, + SQLAvailabilityReplicaOverviewReplicaStateUnknown, + } +} + +// SQLDiscoveryScopeStatus - SQLDiscoveryScope Status +type SQLDiscoveryScopeStatus string + +const ( + // SQLDiscoveryScopeStatusDisabled - Disabled value. + SQLDiscoveryScopeStatusDisabled SQLDiscoveryScopeStatus = "Disabled" + // SQLDiscoveryScopeStatusDiscoveryFailed - DiscoveryFailed value. + SQLDiscoveryScopeStatusDiscoveryFailed SQLDiscoveryScopeStatus = "DiscoveryFailed" + // SQLDiscoveryScopeStatusDiscoveryInProgress - DiscoveryInProgress value. + SQLDiscoveryScopeStatusDiscoveryInProgress SQLDiscoveryScopeStatus = "DiscoveryInProgress" + // SQLDiscoveryScopeStatusDiscoveryNotStarted - DiscoveryNotStarted value. + SQLDiscoveryScopeStatusDiscoveryNotStarted SQLDiscoveryScopeStatus = "DiscoveryNotStarted" + // SQLDiscoveryScopeStatusDiscoveryPartiallySucceded - DiscoveryPartiallySucceded value. + SQLDiscoveryScopeStatusDiscoveryPartiallySucceded SQLDiscoveryScopeStatus = "DiscoveryPartiallySucceded" + // SQLDiscoveryScopeStatusDiscoverySucceeded - DiscoverySucceeded value. + SQLDiscoveryScopeStatusDiscoverySucceeded SQLDiscoveryScopeStatus = "DiscoverySucceeded" + // SQLDiscoveryScopeStatusDiscoverySucceededAtleastOnce - DiscoverySucceededAtleastOnce value. + SQLDiscoveryScopeStatusDiscoverySucceededAtleastOnce SQLDiscoveryScopeStatus = "DiscoverySucceededAtleastOnce" + // SQLDiscoveryScopeStatusRunAsAccountNotAssociated - RunAsAccountNotAssociated value. + SQLDiscoveryScopeStatusRunAsAccountNotAssociated SQLDiscoveryScopeStatus = "RunAsAccountNotAssociated" +) + +// PossibleSQLDiscoveryScopeStatusValues returns the possible values for the SQLDiscoveryScopeStatus const type. +func PossibleSQLDiscoveryScopeStatusValues() []SQLDiscoveryScopeStatus { + return []SQLDiscoveryScopeStatus{ + SQLDiscoveryScopeStatusDisabled, + SQLDiscoveryScopeStatusDiscoveryFailed, + SQLDiscoveryScopeStatusDiscoveryInProgress, + SQLDiscoveryScopeStatusDiscoveryNotStarted, + SQLDiscoveryScopeStatusDiscoveryPartiallySucceded, + SQLDiscoveryScopeStatusDiscoverySucceeded, + SQLDiscoveryScopeStatusDiscoverySucceededAtleastOnce, + SQLDiscoveryScopeStatusRunAsAccountNotAssociated, + } +} + +// SQLMachineOverviewFciRole - sql fci role +type SQLMachineOverviewFciRole string + +const ( + // SQLMachineOverviewFciRoleActiveNode - ActiveNode value. + SQLMachineOverviewFciRoleActiveNode SQLMachineOverviewFciRole = "ActiveNode" + // SQLMachineOverviewFciRoleNotApplicable - NotApplicable value. + SQLMachineOverviewFciRoleNotApplicable SQLMachineOverviewFciRole = "NotApplicable" + // SQLMachineOverviewFciRolePossibleOwnerNode - PossibleOwnerNode value. + SQLMachineOverviewFciRolePossibleOwnerNode SQLMachineOverviewFciRole = "PossibleOwnerNode" + // SQLMachineOverviewFciRoleUnknown - Unknown value. + SQLMachineOverviewFciRoleUnknown SQLMachineOverviewFciRole = "Unknown" +) + +// PossibleSQLMachineOverviewFciRoleValues returns the possible values for the SQLMachineOverviewFciRole const type. +func PossibleSQLMachineOverviewFciRoleValues() []SQLMachineOverviewFciRole { + return []SQLMachineOverviewFciRole{ + SQLMachineOverviewFciRoleActiveNode, + SQLMachineOverviewFciRoleNotApplicable, + SQLMachineOverviewFciRolePossibleOwnerNode, + SQLMachineOverviewFciRoleUnknown, + } +} + +// SQLMetadataDiscoveryPipe - SQL metadata discovery pipe +type SQLMetadataDiscoveryPipe string + +const ( + // SQLMetadataDiscoveryPipeCIM - CIM value. + SQLMetadataDiscoveryPipeCIM SQLMetadataDiscoveryPipe = "CIM" + // SQLMetadataDiscoveryPipeOther - Other value. + SQLMetadataDiscoveryPipeOther SQLMetadataDiscoveryPipe = "Other" + // SQLMetadataDiscoveryPipePowerShell - PowerShell value. + SQLMetadataDiscoveryPipePowerShell SQLMetadataDiscoveryPipe = "PowerShell" + // SQLMetadataDiscoveryPipeSSH - SSH value. + SQLMetadataDiscoveryPipeSSH SQLMetadataDiscoveryPipe = "SSH" + // SQLMetadataDiscoveryPipeUnknown - Unknown value. + SQLMetadataDiscoveryPipeUnknown SQLMetadataDiscoveryPipe = "Unknown" + // SQLMetadataDiscoveryPipeVMware - VMware value. + SQLMetadataDiscoveryPipeVMware SQLMetadataDiscoveryPipe = "VMware" +) + +// PossibleSQLMetadataDiscoveryPipeValues returns the possible values for the SQLMetadataDiscoveryPipe const type. +func PossibleSQLMetadataDiscoveryPipeValues() []SQLMetadataDiscoveryPipe { + return []SQLMetadataDiscoveryPipe{ + SQLMetadataDiscoveryPipeCIM, + SQLMetadataDiscoveryPipeOther, + SQLMetadataDiscoveryPipePowerShell, + SQLMetadataDiscoveryPipeSSH, + SQLMetadataDiscoveryPipeUnknown, + SQLMetadataDiscoveryPipeVMware, + } +} + +// SQLServerStatus - sql server status +type SQLServerStatus string + +const ( + // SQLServerStatusContinuePending - ContinuePending value. + SQLServerStatusContinuePending SQLServerStatus = "ContinuePending" + // SQLServerStatusPausePending - PausePending value. + SQLServerStatusPausePending SQLServerStatus = "PausePending" + // SQLServerStatusPaused - Paused value. + SQLServerStatusPaused SQLServerStatus = "Paused" + // SQLServerStatusRunning - Running value. + SQLServerStatusRunning SQLServerStatus = "Running" + // SQLServerStatusStartPending - StartPending value. + SQLServerStatusStartPending SQLServerStatus = "StartPending" + // SQLServerStatusStopPending - StopPending value. + SQLServerStatusStopPending SQLServerStatus = "StopPending" + // SQLServerStatusStopped - Stopped value. + SQLServerStatusStopped SQLServerStatus = "Stopped" + // SQLServerStatusUnknown - Unknown value. + SQLServerStatusUnknown SQLServerStatus = "Unknown" +) + +// PossibleSQLServerStatusValues returns the possible values for the SQLServerStatus const type. +func PossibleSQLServerStatusValues() []SQLServerStatus { + return []SQLServerStatus{ + SQLServerStatusContinuePending, + SQLServerStatusPausePending, + SQLServerStatusPaused, + SQLServerStatusRunning, + SQLServerStatusStartPending, + SQLServerStatusStopPending, + SQLServerStatusStopped, + SQLServerStatusUnknown, + } +} + +// SQLSitePropertiesDiscoveryScenario - SqlSiteProperties DiscoveryScenario +type SQLSitePropertiesDiscoveryScenario string + +const ( + // SQLSitePropertiesDiscoveryScenarioDR - DR value. + SQLSitePropertiesDiscoveryScenarioDR SQLSitePropertiesDiscoveryScenario = "DR" + // SQLSitePropertiesDiscoveryScenarioMigrate - Migrate value. + SQLSitePropertiesDiscoveryScenarioMigrate SQLSitePropertiesDiscoveryScenario = "Migrate" +) + +// PossibleSQLSitePropertiesDiscoveryScenarioValues returns the possible values for the SQLSitePropertiesDiscoveryScenario const type. +func PossibleSQLSitePropertiesDiscoveryScenarioValues() []SQLSitePropertiesDiscoveryScenario { + return []SQLSitePropertiesDiscoveryScenario{ + SQLSitePropertiesDiscoveryScenarioDR, + SQLSitePropertiesDiscoveryScenarioMigrate, + } +} + +// ShallowDiscoveryStatus - Shallow Discovery Status. +type ShallowDiscoveryStatus string + +const ( + // ShallowDiscoveryStatusDisabled - Disabled value. + ShallowDiscoveryStatusDisabled ShallowDiscoveryStatus = "Disabled" + // ShallowDiscoveryStatusDiscoveryFailed - DiscoveryFailed value. + ShallowDiscoveryStatusDiscoveryFailed ShallowDiscoveryStatus = "DiscoveryFailed" + // ShallowDiscoveryStatusDiscoveryInProgress - DiscoveryInProgress value. + ShallowDiscoveryStatusDiscoveryInProgress ShallowDiscoveryStatus = "DiscoveryInProgress" + // ShallowDiscoveryStatusDiscoveryNotStarted - DiscoveryNotStarted value. + ShallowDiscoveryStatusDiscoveryNotStarted ShallowDiscoveryStatus = "DiscoveryNotStarted" + // ShallowDiscoveryStatusDiscoveryPartiallySucceded - DiscoveryPartiallySucceded value. + ShallowDiscoveryStatusDiscoveryPartiallySucceded ShallowDiscoveryStatus = "DiscoveryPartiallySucceded" + // ShallowDiscoveryStatusDiscoverySucceeded - DiscoverySucceeded value. + ShallowDiscoveryStatusDiscoverySucceeded ShallowDiscoveryStatus = "DiscoverySucceeded" + // ShallowDiscoveryStatusDiscoverySucceededAtleastOnce - DiscoverySucceededAtleastOnce value. + ShallowDiscoveryStatusDiscoverySucceededAtleastOnce ShallowDiscoveryStatus = "DiscoverySucceededAtleastOnce" + // ShallowDiscoveryStatusRunAsAccountNotAssociated - RunAsAccountNotAssociated value. + ShallowDiscoveryStatusRunAsAccountNotAssociated ShallowDiscoveryStatus = "RunAsAccountNotAssociated" +) + +// PossibleShallowDiscoveryStatusValues returns the possible values for the ShallowDiscoveryStatus const type. +func PossibleShallowDiscoveryStatusValues() []ShallowDiscoveryStatus { + return []ShallowDiscoveryStatus{ + ShallowDiscoveryStatusDisabled, + ShallowDiscoveryStatusDiscoveryFailed, + ShallowDiscoveryStatusDiscoveryInProgress, + ShallowDiscoveryStatusDiscoveryNotStarted, + ShallowDiscoveryStatusDiscoveryPartiallySucceded, + ShallowDiscoveryStatusDiscoverySucceeded, + ShallowDiscoveryStatusDiscoverySucceededAtleastOnce, + ShallowDiscoveryStatusRunAsAccountNotAssociated, + } +} + +// SiteHealthSummaryFabricLayoutUpdateSourcesItem - SiteHealthSummary FabricLayout UpdateSources +type SiteHealthSummaryFabricLayoutUpdateSourcesItem string + +const ( + // SiteHealthSummaryFabricLayoutUpdateSourcesItemRefreshFabricLayout - RefreshFabricLayout value. + SiteHealthSummaryFabricLayoutUpdateSourcesItemRefreshFabricLayout SiteHealthSummaryFabricLayoutUpdateSourcesItem = "RefreshFabricLayout" + // SiteHealthSummaryFabricLayoutUpdateSourcesItemRefreshFabricLayoutDependencyMap - RefreshFabricLayoutDependencyMap value. + SiteHealthSummaryFabricLayoutUpdateSourcesItemRefreshFabricLayoutDependencyMap SiteHealthSummaryFabricLayoutUpdateSourcesItem = "RefreshFabricLayoutDependencyMap" + // SiteHealthSummaryFabricLayoutUpdateSourcesItemRefreshFabricLayoutGuest - RefreshFabricLayoutGuest value. + SiteHealthSummaryFabricLayoutUpdateSourcesItemRefreshFabricLayoutGuest SiteHealthSummaryFabricLayoutUpdateSourcesItem = "RefreshFabricLayoutGuest" +) + +// PossibleSiteHealthSummaryFabricLayoutUpdateSourcesItemValues returns the possible values for the SiteHealthSummaryFabricLayoutUpdateSourcesItem const type. +func PossibleSiteHealthSummaryFabricLayoutUpdateSourcesItemValues() []SiteHealthSummaryFabricLayoutUpdateSourcesItem { + return []SiteHealthSummaryFabricLayoutUpdateSourcesItem{ + SiteHealthSummaryFabricLayoutUpdateSourcesItemRefreshFabricLayout, + SiteHealthSummaryFabricLayoutUpdateSourcesItemRefreshFabricLayoutDependencyMap, + SiteHealthSummaryFabricLayoutUpdateSourcesItemRefreshFabricLayoutGuest, + } +} + +// StaticDiscoveryScopeStatus - Static DiscoveryScopeStatus +type StaticDiscoveryScopeStatus string + +const ( + // StaticDiscoveryScopeStatusDisabled - Disabled value. + StaticDiscoveryScopeStatusDisabled StaticDiscoveryScopeStatus = "Disabled" + // StaticDiscoveryScopeStatusDiscoveryFailed - DiscoveryFailed value. + StaticDiscoveryScopeStatusDiscoveryFailed StaticDiscoveryScopeStatus = "DiscoveryFailed" + // StaticDiscoveryScopeStatusDiscoveryInProgress - DiscoveryInProgress value. + StaticDiscoveryScopeStatusDiscoveryInProgress StaticDiscoveryScopeStatus = "DiscoveryInProgress" + // StaticDiscoveryScopeStatusDiscoveryNotStarted - DiscoveryNotStarted value. + StaticDiscoveryScopeStatusDiscoveryNotStarted StaticDiscoveryScopeStatus = "DiscoveryNotStarted" + // StaticDiscoveryScopeStatusDiscoveryPartiallySucceded - DiscoveryPartiallySucceded value. + StaticDiscoveryScopeStatusDiscoveryPartiallySucceded StaticDiscoveryScopeStatus = "DiscoveryPartiallySucceded" + // StaticDiscoveryScopeStatusDiscoverySucceeded - DiscoverySucceeded value. + StaticDiscoveryScopeStatusDiscoverySucceeded StaticDiscoveryScopeStatus = "DiscoverySucceeded" + // StaticDiscoveryScopeStatusDiscoverySucceededAtleastOnce - DiscoverySucceededAtleastOnce value. + StaticDiscoveryScopeStatusDiscoverySucceededAtleastOnce StaticDiscoveryScopeStatus = "DiscoverySucceededAtleastOnce" + // StaticDiscoveryScopeStatusRunAsAccountNotAssociated - RunAsAccountNotAssociated value. + StaticDiscoveryScopeStatusRunAsAccountNotAssociated StaticDiscoveryScopeStatus = "RunAsAccountNotAssociated" +) + +// PossibleStaticDiscoveryScopeStatusValues returns the possible values for the StaticDiscoveryScopeStatus const type. +func PossibleStaticDiscoveryScopeStatusValues() []StaticDiscoveryScopeStatus { + return []StaticDiscoveryScopeStatus{ + StaticDiscoveryScopeStatusDisabled, + StaticDiscoveryScopeStatusDiscoveryFailed, + StaticDiscoveryScopeStatusDiscoveryInProgress, + StaticDiscoveryScopeStatusDiscoveryNotStarted, + StaticDiscoveryScopeStatusDiscoveryPartiallySucceded, + StaticDiscoveryScopeStatusDiscoverySucceeded, + StaticDiscoveryScopeStatusDiscoverySucceededAtleastOnce, + StaticDiscoveryScopeStatusRunAsAccountNotAssociated, + } +} + +// SupportStatus - support status +type SupportStatus string + +const ( + // SupportStatusExtended - Extended value. + SupportStatusExtended SupportStatus = "Extended" + // SupportStatusMainstream - Mainstream value. + SupportStatusMainstream SupportStatus = "Mainstream" + // SupportStatusUnknown - Unknown value. + SupportStatusUnknown SupportStatus = "Unknown" +) + +// PossibleSupportStatusValues returns the possible values for the SupportStatus const type. +func PossibleSupportStatusValues() []SupportStatus { + return []SupportStatus{ + SupportStatusExtended, + SupportStatusMainstream, + SupportStatusUnknown, + } +} + +// VMwareDatastoreType - vmware datastore type +type VMwareDatastoreType string + +const ( + // VMwareDatastoreTypeCifs - CIFS value. + VMwareDatastoreTypeCifs VMwareDatastoreType = "CIFS" + // VMwareDatastoreTypeNFS - NFS value. + VMwareDatastoreTypeNFS VMwareDatastoreType = "NFS" + // VMwareDatastoreTypeNFS41 - NFS41 value. + VMwareDatastoreTypeNFS41 VMwareDatastoreType = "NFS41" + // VMwareDatastoreTypePmem - PMEM value. + VMwareDatastoreTypePmem VMwareDatastoreType = "PMEM" + // VMwareDatastoreTypeUnknown - Unknown value. + VMwareDatastoreTypeUnknown VMwareDatastoreType = "Unknown" + // VMwareDatastoreTypeVffs - VFFS value. + VMwareDatastoreTypeVffs VMwareDatastoreType = "VFFS" + // VMwareDatastoreTypeVmfs - VMFS value. + VMwareDatastoreTypeVmfs VMwareDatastoreType = "VMFS" + // VMwareDatastoreTypeVsan - VSAN value. + VMwareDatastoreTypeVsan VMwareDatastoreType = "VSAN" + // VMwareDatastoreTypeVvol - VVOL value. + VMwareDatastoreTypeVvol VMwareDatastoreType = "VVOL" +) + +// PossibleVMwareDatastoreTypeValues returns the possible values for the VMwareDatastoreType const type. +func PossibleVMwareDatastoreTypeValues() []VMwareDatastoreType { + return []VMwareDatastoreType{ + VMwareDatastoreTypeCifs, + VMwareDatastoreTypeNFS, + VMwareDatastoreTypeNFS41, + VMwareDatastoreTypePmem, + VMwareDatastoreTypeUnknown, + VMwareDatastoreTypeVffs, + VMwareDatastoreTypeVmfs, + VMwareDatastoreTypeVsan, + VMwareDatastoreTypeVvol, } } -// ReservedInstance - Azure reserved instance. -type ReservedInstance string +// Versions - service api versions +type Versions string const ( - ReservedInstanceNone ReservedInstance = "None" - ReservedInstanceRI1Year ReservedInstance = "RI1Year" - ReservedInstanceRI3Year ReservedInstance = "RI3Year" + // VersionsV20180501Preview - Api version 2018-05-01-preview. + VersionsV20180501Preview Versions = "2018-05-01-preview" + // VersionsV20190501Preview - Api version 2019-05-01-preview. + VersionsV20190501Preview Versions = "2019-05-01-preview" + // VersionsV20200101 - Api version 2020-01-01. + VersionsV20200101 Versions = "2020-01-01" + // VersionsV20200101Preview - Api version 2020-01-01-preview. + VersionsV20200101Preview Versions = "2020-01-01-preview" + // VersionsV20200201 - Api version 2020-02-01. + VersionsV20200201 Versions = "2020-02-01" + // VersionsV20200707 - Api version 2020-07-07. + VersionsV20200707 Versions = "2020-07-07" + // VersionsV20200710 - Api version 2020-07-10. + VersionsV20200710 Versions = "2020-07-10" + // VersionsV20200801Preview - Api version 2020-08-01-preview. + VersionsV20200801Preview Versions = "2020-08-01-preview" + // VersionsV20201111Preview - Api version 2020-11-11-preview. + VersionsV20201111Preview Versions = "2020-11-11-preview" + // VersionsV20221027 - Api version 2022-10-27. + VersionsV20221027 Versions = "2022-10-27" + // VersionsV20230606 - Api version 2023-06-06. + VersionsV20230606 Versions = "2023-06-06" + // VersionsV20231001Preview - Api version 2023-10-01-preview. + VersionsV20231001Preview Versions = "2023-10-01-preview" ) -// PossibleReservedInstanceValues returns the possible values for the ReservedInstance const type. -func PossibleReservedInstanceValues() []ReservedInstance { - return []ReservedInstance{ - ReservedInstanceNone, - ReservedInstanceRI1Year, - ReservedInstanceRI3Year, +// PossibleVersionsValues returns the possible values for the Versions const type. +func PossibleVersionsValues() []Versions { + return []Versions{ + VersionsV20180501Preview, + VersionsV20190501Preview, + VersionsV20200101, + VersionsV20200101Preview, + VersionsV20200201, + VersionsV20200707, + VersionsV20200710, + VersionsV20200801Preview, + VersionsV20201111Preview, + VersionsV20221027, + VersionsV20230606, + VersionsV20231001Preview, } } -// TimeRange - Time range of performance data used to recommend a size. -type TimeRange string +// WebAppSitePropertiesDiscoveryScenario - Discovery Scenario +type WebAppSitePropertiesDiscoveryScenario string const ( - TimeRangeCustom TimeRange = "Custom" - TimeRangeDay TimeRange = "Day" - TimeRangeMonth TimeRange = "Month" - TimeRangeWeek TimeRange = "Week" + // WebAppSitePropertiesDiscoveryScenarioDR - DR value. + WebAppSitePropertiesDiscoveryScenarioDR WebAppSitePropertiesDiscoveryScenario = "DR" + // WebAppSitePropertiesDiscoveryScenarioMigrate - Migrate value. + WebAppSitePropertiesDiscoveryScenarioMigrate WebAppSitePropertiesDiscoveryScenario = "Migrate" ) -// PossibleTimeRangeValues returns the possible values for the TimeRange const type. -func PossibleTimeRangeValues() []TimeRange { - return []TimeRange{ - TimeRangeCustom, - TimeRangeDay, - TimeRangeMonth, - TimeRangeWeek, +// PossibleWebAppSitePropertiesDiscoveryScenarioValues returns the possible values for the WebAppSitePropertiesDiscoveryScenario const type. +func PossibleWebAppSitePropertiesDiscoveryScenarioValues() []WebAppSitePropertiesDiscoveryScenario { + return []WebAppSitePropertiesDiscoveryScenario{ + WebAppSitePropertiesDiscoveryScenarioDR, + WebAppSitePropertiesDiscoveryScenarioMigrate, } } diff --git a/sdk/resourcemanager/migrate/armmigrate/dependencymapcontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/dependencymapcontroller_client.go new file mode 100644 index 000000000000..7f686552aed2 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/dependencymapcontroller_client.go @@ -0,0 +1,449 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// DependencyMapControllerClient contains the methods for the DependencyMapController group. +// Don't use this type directly, use NewDependencyMapControllerClient() instead. +type DependencyMapControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewDependencyMapControllerClient creates a new instance of DependencyMapControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewDependencyMapControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DependencyMapControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &DependencyMapControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginClientGroupMembers - API to list client group members for the selected client group. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - mapRequest - The content of the action request +// - options - DependencyMapControllerClientBeginClientGroupMembersOptions contains the optional parameters for the DependencyMapControllerClient.BeginClientGroupMembers +// method. +func (client *DependencyMapControllerClient) BeginClientGroupMembers(ctx context.Context, resourceGroupName string, siteName string, mapRequest DependencyMapServiceMapextensionsClientGroupMembersRequest, options *DependencyMapControllerClientBeginClientGroupMembersOptions) (*runtime.Poller[DependencyMapControllerClientClientGroupMembersResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.clientGroupMembers(ctx, resourceGroupName, siteName, mapRequest, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DependencyMapControllerClientClientGroupMembersResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DependencyMapControllerClientClientGroupMembersResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ClientGroupMembers - API to list client group members for the selected client group. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *DependencyMapControllerClient) clientGroupMembers(ctx context.Context, resourceGroupName string, siteName string, mapRequest DependencyMapServiceMapextensionsClientGroupMembersRequest, options *DependencyMapControllerClientBeginClientGroupMembersOptions) (*http.Response, error) { + var err error + const operationName = "DependencyMapControllerClient.BeginClientGroupMembers" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.clientGroupMembersCreateRequest(ctx, resourceGroupName, siteName, mapRequest, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// clientGroupMembersCreateRequest creates the ClientGroupMembers request. +func (client *DependencyMapControllerClient) clientGroupMembersCreateRequest(ctx context.Context, resourceGroupName string, siteName string, mapRequest DependencyMapServiceMapextensionsClientGroupMembersRequest, options *DependencyMapControllerClientBeginClientGroupMembersOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/vmwareSites/{siteName}/clientGroupMembers" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, mapRequest); err != nil { + return nil, err + } + return req, nil +} + +// BeginExportDependencies - API to generate report containing agentless dependencies. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - requestBody - The content of the action request +// - options - DependencyMapControllerClientBeginExportDependenciesOptions contains the optional parameters for the DependencyMapControllerClient.BeginExportDependencies +// method. +func (client *DependencyMapControllerClient) BeginExportDependencies(ctx context.Context, resourceGroupName string, siteName string, requestBody DependencyMapServiceMapextensionsExportDependenciesRequest, options *DependencyMapControllerClientBeginExportDependenciesOptions) (*runtime.Poller[DependencyMapControllerClientExportDependenciesResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.exportDependencies(ctx, resourceGroupName, siteName, requestBody, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DependencyMapControllerClientExportDependenciesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DependencyMapControllerClientExportDependenciesResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ExportDependencies - API to generate report containing agentless dependencies. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *DependencyMapControllerClient) exportDependencies(ctx context.Context, resourceGroupName string, siteName string, requestBody DependencyMapServiceMapextensionsExportDependenciesRequest, options *DependencyMapControllerClientBeginExportDependenciesOptions) (*http.Response, error) { + var err error + const operationName = "DependencyMapControllerClient.BeginExportDependencies" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.exportDependenciesCreateRequest(ctx, resourceGroupName, siteName, requestBody, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// exportDependenciesCreateRequest creates the ExportDependencies request. +func (client *DependencyMapControllerClient) exportDependenciesCreateRequest(ctx context.Context, resourceGroupName string, siteName string, requestBody DependencyMapServiceMapextensionsExportDependenciesRequest, options *DependencyMapControllerClientBeginExportDependenciesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/vmwareSites/{siteName}/exportDependencies" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, requestBody); err != nil { + return nil, err + } + return req, nil +} + +// BeginGenerateCoarseMap - API to generate coarse map for the list of machines. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - mapRequest - The content of the action request +// - options - DependencyMapControllerClientBeginGenerateCoarseMapOptions contains the optional parameters for the DependencyMapControllerClient.BeginGenerateCoarseMap +// method. +func (client *DependencyMapControllerClient) BeginGenerateCoarseMap(ctx context.Context, resourceGroupName string, siteName string, mapRequest DependencyMapServiceMapextensionsScopeMapRequest, options *DependencyMapControllerClientBeginGenerateCoarseMapOptions) (*runtime.Poller[DependencyMapControllerClientGenerateCoarseMapResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.generateCoarseMap(ctx, resourceGroupName, siteName, mapRequest, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DependencyMapControllerClientGenerateCoarseMapResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DependencyMapControllerClientGenerateCoarseMapResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// GenerateCoarseMap - API to generate coarse map for the list of machines. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *DependencyMapControllerClient) generateCoarseMap(ctx context.Context, resourceGroupName string, siteName string, mapRequest DependencyMapServiceMapextensionsScopeMapRequest, options *DependencyMapControllerClientBeginGenerateCoarseMapOptions) (*http.Response, error) { + var err error + const operationName = "DependencyMapControllerClient.BeginGenerateCoarseMap" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.generateCoarseMapCreateRequest(ctx, resourceGroupName, siteName, mapRequest, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// generateCoarseMapCreateRequest creates the GenerateCoarseMap request. +func (client *DependencyMapControllerClient) generateCoarseMapCreateRequest(ctx context.Context, resourceGroupName string, siteName string, mapRequest DependencyMapServiceMapextensionsScopeMapRequest, options *DependencyMapControllerClientBeginGenerateCoarseMapOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/vmwareSites/{siteName}/generateCoarseMap" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, mapRequest); err != nil { + return nil, err + } + return req, nil +} + +// BeginGenerateDetailedMap - API to generate detailed map for a selected machine. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - mapRequest - The content of the action request +// - options - DependencyMapControllerClientBeginGenerateDetailedMapOptions contains the optional parameters for the DependencyMapControllerClient.BeginGenerateDetailedMap +// method. +func (client *DependencyMapControllerClient) BeginGenerateDetailedMap(ctx context.Context, resourceGroupName string, siteName string, mapRequest DependencyMapServiceMapextensionsSingleMachineDetailedMapRequest, options *DependencyMapControllerClientBeginGenerateDetailedMapOptions) (*runtime.Poller[DependencyMapControllerClientGenerateDetailedMapResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.generateDetailedMap(ctx, resourceGroupName, siteName, mapRequest, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DependencyMapControllerClientGenerateDetailedMapResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DependencyMapControllerClientGenerateDetailedMapResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// GenerateDetailedMap - API to generate detailed map for a selected machine. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *DependencyMapControllerClient) generateDetailedMap(ctx context.Context, resourceGroupName string, siteName string, mapRequest DependencyMapServiceMapextensionsSingleMachineDetailedMapRequest, options *DependencyMapControllerClientBeginGenerateDetailedMapOptions) (*http.Response, error) { + var err error + const operationName = "DependencyMapControllerClient.BeginGenerateDetailedMap" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.generateDetailedMapCreateRequest(ctx, resourceGroupName, siteName, mapRequest, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// generateDetailedMapCreateRequest creates the GenerateDetailedMap request. +func (client *DependencyMapControllerClient) generateDetailedMapCreateRequest(ctx context.Context, resourceGroupName string, siteName string, mapRequest DependencyMapServiceMapextensionsSingleMachineDetailedMapRequest, options *DependencyMapControllerClientBeginGenerateDetailedMapOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/vmwareSites/{siteName}/generateDetailedMap" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, mapRequest); err != nil { + return nil, err + } + return req, nil +} + +// BeginServerGroupMembers - API to list server group members for the selected server group. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - mapRequest - The content of the action request +// - options - DependencyMapControllerClientBeginServerGroupMembersOptions contains the optional parameters for the DependencyMapControllerClient.BeginServerGroupMembers +// method. +func (client *DependencyMapControllerClient) BeginServerGroupMembers(ctx context.Context, resourceGroupName string, siteName string, mapRequest DependencyMapServiceMapextensionsServerGroupMembersRequest, options *DependencyMapControllerClientBeginServerGroupMembersOptions) (*runtime.Poller[DependencyMapControllerClientServerGroupMembersResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.serverGroupMembers(ctx, resourceGroupName, siteName, mapRequest, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DependencyMapControllerClientServerGroupMembersResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DependencyMapControllerClientServerGroupMembersResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ServerGroupMembers - API to list server group members for the selected server group. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *DependencyMapControllerClient) serverGroupMembers(ctx context.Context, resourceGroupName string, siteName string, mapRequest DependencyMapServiceMapextensionsServerGroupMembersRequest, options *DependencyMapControllerClientBeginServerGroupMembersOptions) (*http.Response, error) { + var err error + const operationName = "DependencyMapControllerClient.BeginServerGroupMembers" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.serverGroupMembersCreateRequest(ctx, resourceGroupName, siteName, mapRequest, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// serverGroupMembersCreateRequest creates the ServerGroupMembers request. +func (client *DependencyMapControllerClient) serverGroupMembersCreateRequest(ctx context.Context, resourceGroupName string, siteName string, mapRequest DependencyMapServiceMapextensionsServerGroupMembersRequest, options *DependencyMapControllerClientBeginServerGroupMembersOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/vmwareSites/{siteName}/serverGroupMembers" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, mapRequest); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/assessedmachines_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/assessedmachines_server.go deleted file mode 100644 index 6b7631a4c6c7..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/fake/assessedmachines_server.go +++ /dev/null @@ -1,175 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" - "net/http" - "net/url" - "regexp" -) - -// AssessedMachinesServer is a fake server for instances of the armmigrate.AssessedMachinesClient type. -type AssessedMachinesServer struct { - // Get is the fake for method AssessedMachinesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, assessedMachineName string, options *armmigrate.AssessedMachinesClientGetOptions) (resp azfake.Responder[armmigrate.AssessedMachinesClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByAssessmentPager is the fake for method AssessedMachinesClient.NewListByAssessmentPager - // HTTP status codes to indicate success: http.StatusOK - NewListByAssessmentPager func(resourceGroupName string, projectName string, groupName string, assessmentName string, options *armmigrate.AssessedMachinesClientListByAssessmentOptions) (resp azfake.PagerResponder[armmigrate.AssessedMachinesClientListByAssessmentResponse]) -} - -// NewAssessedMachinesServerTransport creates a new instance of AssessedMachinesServerTransport with the provided implementation. -// The returned AssessedMachinesServerTransport instance is connected to an instance of armmigrate.AssessedMachinesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewAssessedMachinesServerTransport(srv *AssessedMachinesServer) *AssessedMachinesServerTransport { - return &AssessedMachinesServerTransport{ - srv: srv, - newListByAssessmentPager: newTracker[azfake.PagerResponder[armmigrate.AssessedMachinesClientListByAssessmentResponse]](), - } -} - -// AssessedMachinesServerTransport connects instances of armmigrate.AssessedMachinesClient to instances of AssessedMachinesServer. -// Don't use this type directly, use NewAssessedMachinesServerTransport instead. -type AssessedMachinesServerTransport struct { - srv *AssessedMachinesServer - newListByAssessmentPager *tracker[azfake.PagerResponder[armmigrate.AssessedMachinesClientListByAssessmentResponse]] -} - -// Do implements the policy.Transporter interface for AssessedMachinesServerTransport. -func (a *AssessedMachinesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "AssessedMachinesClient.Get": - resp, err = a.dispatchGet(req) - case "AssessedMachinesClient.NewListByAssessmentPager": - resp, err = a.dispatchNewListByAssessmentPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (a *AssessedMachinesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if a.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/groups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/assessments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/assessedMachines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - groupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("groupName")]) - if err != nil { - return nil, err - } - assessmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("assessmentName")]) - if err != nil { - return nil, err - } - assessedMachineNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("assessedMachineName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, projectNameParam, groupNameParam, assessmentNameParam, assessedMachineNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AssessedMachine, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (a *AssessedMachinesServerTransport) dispatchNewListByAssessmentPager(req *http.Request) (*http.Response, error) { - if a.srv.NewListByAssessmentPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByAssessmentPager not implemented")} - } - newListByAssessmentPager := a.newListByAssessmentPager.get(req) - if newListByAssessmentPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/groups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/assessments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/assessedMachines` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - groupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("groupName")]) - if err != nil { - return nil, err - } - assessmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("assessmentName")]) - if err != nil { - return nil, err - } - resp := a.srv.NewListByAssessmentPager(resourceGroupNameParam, projectNameParam, groupNameParam, assessmentNameParam, nil) - newListByAssessmentPager = &resp - a.newListByAssessmentPager.add(req, newListByAssessmentPager) - server.PagerResponderInjectNextLinks(newListByAssessmentPager, req, func(page *armmigrate.AssessedMachinesClientListByAssessmentResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListByAssessmentPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - a.newListByAssessmentPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByAssessmentPager) { - a.newListByAssessmentPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/assessments_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/assessments_server.go deleted file mode 100644 index 4909db066929..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/fake/assessments_server.go +++ /dev/null @@ -1,370 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" - "net/http" - "net/url" - "reflect" - "regexp" -) - -// AssessmentsServer is a fake server for instances of the armmigrate.AssessmentsClient type. -type AssessmentsServer struct { - // Create is the fake for method AssessmentsClient.Create - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - Create func(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, options *armmigrate.AssessmentsClientCreateOptions) (resp azfake.Responder[armmigrate.AssessmentsClientCreateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method AssessmentsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, options *armmigrate.AssessmentsClientDeleteOptions) (resp azfake.Responder[armmigrate.AssessmentsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method AssessmentsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, options *armmigrate.AssessmentsClientGetOptions) (resp azfake.Responder[armmigrate.AssessmentsClientGetResponse], errResp azfake.ErrorResponder) - - // GetReportDownloadURL is the fake for method AssessmentsClient.GetReportDownloadURL - // HTTP status codes to indicate success: http.StatusOK - GetReportDownloadURL func(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, options *armmigrate.AssessmentsClientGetReportDownloadURLOptions) (resp azfake.Responder[armmigrate.AssessmentsClientGetReportDownloadURLResponse], errResp azfake.ErrorResponder) - - // NewListByGroupPager is the fake for method AssessmentsClient.NewListByGroupPager - // HTTP status codes to indicate success: http.StatusOK - NewListByGroupPager func(resourceGroupName string, projectName string, groupName string, options *armmigrate.AssessmentsClientListByGroupOptions) (resp azfake.PagerResponder[armmigrate.AssessmentsClientListByGroupResponse]) - - // NewListByProjectPager is the fake for method AssessmentsClient.NewListByProjectPager - // HTTP status codes to indicate success: http.StatusOK - NewListByProjectPager func(resourceGroupName string, projectName string, options *armmigrate.AssessmentsClientListByProjectOptions) (resp azfake.PagerResponder[armmigrate.AssessmentsClientListByProjectResponse]) -} - -// NewAssessmentsServerTransport creates a new instance of AssessmentsServerTransport with the provided implementation. -// The returned AssessmentsServerTransport instance is connected to an instance of armmigrate.AssessmentsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewAssessmentsServerTransport(srv *AssessmentsServer) *AssessmentsServerTransport { - return &AssessmentsServerTransport{ - srv: srv, - newListByGroupPager: newTracker[azfake.PagerResponder[armmigrate.AssessmentsClientListByGroupResponse]](), - newListByProjectPager: newTracker[azfake.PagerResponder[armmigrate.AssessmentsClientListByProjectResponse]](), - } -} - -// AssessmentsServerTransport connects instances of armmigrate.AssessmentsClient to instances of AssessmentsServer. -// Don't use this type directly, use NewAssessmentsServerTransport instead. -type AssessmentsServerTransport struct { - srv *AssessmentsServer - newListByGroupPager *tracker[azfake.PagerResponder[armmigrate.AssessmentsClientListByGroupResponse]] - newListByProjectPager *tracker[azfake.PagerResponder[armmigrate.AssessmentsClientListByProjectResponse]] -} - -// Do implements the policy.Transporter interface for AssessmentsServerTransport. -func (a *AssessmentsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "AssessmentsClient.Create": - resp, err = a.dispatchCreate(req) - case "AssessmentsClient.Delete": - resp, err = a.dispatchDelete(req) - case "AssessmentsClient.Get": - resp, err = a.dispatchGet(req) - case "AssessmentsClient.GetReportDownloadURL": - resp, err = a.dispatchGetReportDownloadURL(req) - case "AssessmentsClient.NewListByGroupPager": - resp, err = a.dispatchNewListByGroupPager(req) - case "AssessmentsClient.NewListByProjectPager": - resp, err = a.dispatchNewListByProjectPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (a *AssessmentsServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { - if a.srv.Create == nil { - return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/groups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/assessments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmigrate.Assessment](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - groupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("groupName")]) - if err != nil { - return nil, err - } - assessmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("assessmentName")]) - if err != nil { - return nil, err - } - var options *armmigrate.AssessmentsClientCreateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armmigrate.AssessmentsClientCreateOptions{ - Assessment: &body, - } - } - respr, errRespr := a.srv.Create(req.Context(), resourceGroupNameParam, projectNameParam, groupNameParam, assessmentNameParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Assessment, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (a *AssessmentsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if a.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/groups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/assessments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - groupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("groupName")]) - if err != nil { - return nil, err - } - assessmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("assessmentName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Delete(req.Context(), resourceGroupNameParam, projectNameParam, groupNameParam, assessmentNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (a *AssessmentsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if a.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/groups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/assessments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - groupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("groupName")]) - if err != nil { - return nil, err - } - assessmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("assessmentName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, projectNameParam, groupNameParam, assessmentNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Assessment, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (a *AssessmentsServerTransport) dispatchGetReportDownloadURL(req *http.Request) (*http.Response, error) { - if a.srv.GetReportDownloadURL == nil { - return nil, &nonRetriableError{errors.New("fake for method GetReportDownloadURL not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/groups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/assessments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/downloadUrl` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - groupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("groupName")]) - if err != nil { - return nil, err - } - assessmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("assessmentName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.GetReportDownloadURL(req.Context(), resourceGroupNameParam, projectNameParam, groupNameParam, assessmentNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DownloadURL, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (a *AssessmentsServerTransport) dispatchNewListByGroupPager(req *http.Request) (*http.Response, error) { - if a.srv.NewListByGroupPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByGroupPager not implemented")} - } - newListByGroupPager := a.newListByGroupPager.get(req) - if newListByGroupPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/groups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/assessments` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - groupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("groupName")]) - if err != nil { - return nil, err - } - resp := a.srv.NewListByGroupPager(resourceGroupNameParam, projectNameParam, groupNameParam, nil) - newListByGroupPager = &resp - a.newListByGroupPager.add(req, newListByGroupPager) - } - resp, err := server.PagerResponderNext(newListByGroupPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - a.newListByGroupPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByGroupPager) { - a.newListByGroupPager.remove(req) - } - return resp, nil -} - -func (a *AssessmentsServerTransport) dispatchNewListByProjectPager(req *http.Request) (*http.Response, error) { - if a.srv.NewListByProjectPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByProjectPager not implemented")} - } - newListByProjectPager := a.newListByProjectPager.get(req) - if newListByProjectPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/assessments` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - resp := a.srv.NewListByProjectPager(resourceGroupNameParam, projectNameParam, nil) - newListByProjectPager = &resp - a.newListByProjectPager.add(req, newListByProjectPager) - } - resp, err := server.PagerResponderNext(newListByProjectPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - a.newListByProjectPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByProjectPager) { - a.newListByProjectPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/dependencymapcontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/dependencymapcontroller_server.go new file mode 100644 index 000000000000..417f54c4096d --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/dependencymapcontroller_server.go @@ -0,0 +1,343 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" +) + +// DependencyMapControllerServer is a fake server for instances of the armmigrate.DependencyMapControllerClient type. +type DependencyMapControllerServer struct { + // BeginClientGroupMembers is the fake for method DependencyMapControllerClient.BeginClientGroupMembers + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginClientGroupMembers func(ctx context.Context, resourceGroupName string, siteName string, mapRequest armmigrate.DependencyMapServiceMapextensionsClientGroupMembersRequest, options *armmigrate.DependencyMapControllerClientBeginClientGroupMembersOptions) (resp azfake.PollerResponder[armmigrate.DependencyMapControllerClientClientGroupMembersResponse], errResp azfake.ErrorResponder) + + // BeginExportDependencies is the fake for method DependencyMapControllerClient.BeginExportDependencies + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginExportDependencies func(ctx context.Context, resourceGroupName string, siteName string, requestBody armmigrate.DependencyMapServiceMapextensionsExportDependenciesRequest, options *armmigrate.DependencyMapControllerClientBeginExportDependenciesOptions) (resp azfake.PollerResponder[armmigrate.DependencyMapControllerClientExportDependenciesResponse], errResp azfake.ErrorResponder) + + // BeginGenerateCoarseMap is the fake for method DependencyMapControllerClient.BeginGenerateCoarseMap + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginGenerateCoarseMap func(ctx context.Context, resourceGroupName string, siteName string, mapRequest armmigrate.DependencyMapServiceMapextensionsScopeMapRequest, options *armmigrate.DependencyMapControllerClientBeginGenerateCoarseMapOptions) (resp azfake.PollerResponder[armmigrate.DependencyMapControllerClientGenerateCoarseMapResponse], errResp azfake.ErrorResponder) + + // BeginGenerateDetailedMap is the fake for method DependencyMapControllerClient.BeginGenerateDetailedMap + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginGenerateDetailedMap func(ctx context.Context, resourceGroupName string, siteName string, mapRequest armmigrate.DependencyMapServiceMapextensionsSingleMachineDetailedMapRequest, options *armmigrate.DependencyMapControllerClientBeginGenerateDetailedMapOptions) (resp azfake.PollerResponder[armmigrate.DependencyMapControllerClientGenerateDetailedMapResponse], errResp azfake.ErrorResponder) + + // BeginServerGroupMembers is the fake for method DependencyMapControllerClient.BeginServerGroupMembers + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginServerGroupMembers func(ctx context.Context, resourceGroupName string, siteName string, mapRequest armmigrate.DependencyMapServiceMapextensionsServerGroupMembersRequest, options *armmigrate.DependencyMapControllerClientBeginServerGroupMembersOptions) (resp azfake.PollerResponder[armmigrate.DependencyMapControllerClientServerGroupMembersResponse], errResp azfake.ErrorResponder) +} + +// NewDependencyMapControllerServerTransport creates a new instance of DependencyMapControllerServerTransport with the provided implementation. +// The returned DependencyMapControllerServerTransport instance is connected to an instance of armmigrate.DependencyMapControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewDependencyMapControllerServerTransport(srv *DependencyMapControllerServer) *DependencyMapControllerServerTransport { + return &DependencyMapControllerServerTransport{ + srv: srv, + beginClientGroupMembers: newTracker[azfake.PollerResponder[armmigrate.DependencyMapControllerClientClientGroupMembersResponse]](), + beginExportDependencies: newTracker[azfake.PollerResponder[armmigrate.DependencyMapControllerClientExportDependenciesResponse]](), + beginGenerateCoarseMap: newTracker[azfake.PollerResponder[armmigrate.DependencyMapControllerClientGenerateCoarseMapResponse]](), + beginGenerateDetailedMap: newTracker[azfake.PollerResponder[armmigrate.DependencyMapControllerClientGenerateDetailedMapResponse]](), + beginServerGroupMembers: newTracker[azfake.PollerResponder[armmigrate.DependencyMapControllerClientServerGroupMembersResponse]](), + } +} + +// DependencyMapControllerServerTransport connects instances of armmigrate.DependencyMapControllerClient to instances of DependencyMapControllerServer. +// Don't use this type directly, use NewDependencyMapControllerServerTransport instead. +type DependencyMapControllerServerTransport struct { + srv *DependencyMapControllerServer + beginClientGroupMembers *tracker[azfake.PollerResponder[armmigrate.DependencyMapControllerClientClientGroupMembersResponse]] + beginExportDependencies *tracker[azfake.PollerResponder[armmigrate.DependencyMapControllerClientExportDependenciesResponse]] + beginGenerateCoarseMap *tracker[azfake.PollerResponder[armmigrate.DependencyMapControllerClientGenerateCoarseMapResponse]] + beginGenerateDetailedMap *tracker[azfake.PollerResponder[armmigrate.DependencyMapControllerClientGenerateDetailedMapResponse]] + beginServerGroupMembers *tracker[azfake.PollerResponder[armmigrate.DependencyMapControllerClientServerGroupMembersResponse]] +} + +// Do implements the policy.Transporter interface for DependencyMapControllerServerTransport. +func (d *DependencyMapControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "DependencyMapControllerClient.BeginClientGroupMembers": + resp, err = d.dispatchBeginClientGroupMembers(req) + case "DependencyMapControllerClient.BeginExportDependencies": + resp, err = d.dispatchBeginExportDependencies(req) + case "DependencyMapControllerClient.BeginGenerateCoarseMap": + resp, err = d.dispatchBeginGenerateCoarseMap(req) + case "DependencyMapControllerClient.BeginGenerateDetailedMap": + resp, err = d.dispatchBeginGenerateDetailedMap(req) + case "DependencyMapControllerClient.BeginServerGroupMembers": + resp, err = d.dispatchBeginServerGroupMembers(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (d *DependencyMapControllerServerTransport) dispatchBeginClientGroupMembers(req *http.Request) (*http.Response, error) { + if d.srv.BeginClientGroupMembers == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginClientGroupMembers not implemented")} + } + beginClientGroupMembers := d.beginClientGroupMembers.get(req) + if beginClientGroupMembers == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/vmwareSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/clientGroupMembers` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.DependencyMapServiceMapextensionsClientGroupMembersRequest](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.BeginClientGroupMembers(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginClientGroupMembers = &respr + d.beginClientGroupMembers.add(req, beginClientGroupMembers) + } + + resp, err := server.PollerResponderNext(beginClientGroupMembers, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + d.beginClientGroupMembers.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginClientGroupMembers) { + d.beginClientGroupMembers.remove(req) + } + + return resp, nil +} + +func (d *DependencyMapControllerServerTransport) dispatchBeginExportDependencies(req *http.Request) (*http.Response, error) { + if d.srv.BeginExportDependencies == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginExportDependencies not implemented")} + } + beginExportDependencies := d.beginExportDependencies.get(req) + if beginExportDependencies == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/vmwareSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/exportDependencies` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.DependencyMapServiceMapextensionsExportDependenciesRequest](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.BeginExportDependencies(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginExportDependencies = &respr + d.beginExportDependencies.add(req, beginExportDependencies) + } + + resp, err := server.PollerResponderNext(beginExportDependencies, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + d.beginExportDependencies.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginExportDependencies) { + d.beginExportDependencies.remove(req) + } + + return resp, nil +} + +func (d *DependencyMapControllerServerTransport) dispatchBeginGenerateCoarseMap(req *http.Request) (*http.Response, error) { + if d.srv.BeginGenerateCoarseMap == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginGenerateCoarseMap not implemented")} + } + beginGenerateCoarseMap := d.beginGenerateCoarseMap.get(req) + if beginGenerateCoarseMap == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/vmwareSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/generateCoarseMap` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.DependencyMapServiceMapextensionsScopeMapRequest](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.BeginGenerateCoarseMap(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginGenerateCoarseMap = &respr + d.beginGenerateCoarseMap.add(req, beginGenerateCoarseMap) + } + + resp, err := server.PollerResponderNext(beginGenerateCoarseMap, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + d.beginGenerateCoarseMap.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginGenerateCoarseMap) { + d.beginGenerateCoarseMap.remove(req) + } + + return resp, nil +} + +func (d *DependencyMapControllerServerTransport) dispatchBeginGenerateDetailedMap(req *http.Request) (*http.Response, error) { + if d.srv.BeginGenerateDetailedMap == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginGenerateDetailedMap not implemented")} + } + beginGenerateDetailedMap := d.beginGenerateDetailedMap.get(req) + if beginGenerateDetailedMap == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/vmwareSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/generateDetailedMap` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.DependencyMapServiceMapextensionsSingleMachineDetailedMapRequest](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.BeginGenerateDetailedMap(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginGenerateDetailedMap = &respr + d.beginGenerateDetailedMap.add(req, beginGenerateDetailedMap) + } + + resp, err := server.PollerResponderNext(beginGenerateDetailedMap, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + d.beginGenerateDetailedMap.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginGenerateDetailedMap) { + d.beginGenerateDetailedMap.remove(req) + } + + return resp, nil +} + +func (d *DependencyMapControllerServerTransport) dispatchBeginServerGroupMembers(req *http.Request) (*http.Response, error) { + if d.srv.BeginServerGroupMembers == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginServerGroupMembers not implemented")} + } + beginServerGroupMembers := d.beginServerGroupMembers.get(req) + if beginServerGroupMembers == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/vmwareSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/serverGroupMembers` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.DependencyMapServiceMapextensionsServerGroupMembersRequest](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.BeginServerGroupMembers(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginServerGroupMembers = &respr + d.beginServerGroupMembers.add(req, beginServerGroupMembers) + } + + resp, err := server.PollerResponderNext(beginServerGroupMembers, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + d.beginServerGroupMembers.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginServerGroupMembers) { + d.beginServerGroupMembers.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/groups_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/groups_server.go deleted file mode 100644 index efe64e023873..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/fake/groups_server.go +++ /dev/null @@ -1,314 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" - "net/http" - "net/url" - "reflect" - "regexp" -) - -// GroupsServer is a fake server for instances of the armmigrate.GroupsClient type. -type GroupsServer struct { - // Create is the fake for method GroupsClient.Create - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - Create func(ctx context.Context, resourceGroupName string, projectName string, groupName string, options *armmigrate.GroupsClientCreateOptions) (resp azfake.Responder[armmigrate.GroupsClientCreateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method GroupsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, projectName string, groupName string, options *armmigrate.GroupsClientDeleteOptions) (resp azfake.Responder[armmigrate.GroupsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method GroupsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, projectName string, groupName string, options *armmigrate.GroupsClientGetOptions) (resp azfake.Responder[armmigrate.GroupsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByProjectPager is the fake for method GroupsClient.NewListByProjectPager - // HTTP status codes to indicate success: http.StatusOK - NewListByProjectPager func(resourceGroupName string, projectName string, options *armmigrate.GroupsClientListByProjectOptions) (resp azfake.PagerResponder[armmigrate.GroupsClientListByProjectResponse]) - - // UpdateMachines is the fake for method GroupsClient.UpdateMachines - // HTTP status codes to indicate success: http.StatusOK - UpdateMachines func(ctx context.Context, resourceGroupName string, projectName string, groupName string, options *armmigrate.GroupsClientUpdateMachinesOptions) (resp azfake.Responder[armmigrate.GroupsClientUpdateMachinesResponse], errResp azfake.ErrorResponder) -} - -// NewGroupsServerTransport creates a new instance of GroupsServerTransport with the provided implementation. -// The returned GroupsServerTransport instance is connected to an instance of armmigrate.GroupsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewGroupsServerTransport(srv *GroupsServer) *GroupsServerTransport { - return &GroupsServerTransport{ - srv: srv, - newListByProjectPager: newTracker[azfake.PagerResponder[armmigrate.GroupsClientListByProjectResponse]](), - } -} - -// GroupsServerTransport connects instances of armmigrate.GroupsClient to instances of GroupsServer. -// Don't use this type directly, use NewGroupsServerTransport instead. -type GroupsServerTransport struct { - srv *GroupsServer - newListByProjectPager *tracker[azfake.PagerResponder[armmigrate.GroupsClientListByProjectResponse]] -} - -// Do implements the policy.Transporter interface for GroupsServerTransport. -func (g *GroupsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "GroupsClient.Create": - resp, err = g.dispatchCreate(req) - case "GroupsClient.Delete": - resp, err = g.dispatchDelete(req) - case "GroupsClient.Get": - resp, err = g.dispatchGet(req) - case "GroupsClient.NewListByProjectPager": - resp, err = g.dispatchNewListByProjectPager(req) - case "GroupsClient.UpdateMachines": - resp, err = g.dispatchUpdateMachines(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (g *GroupsServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { - if g.srv.Create == nil { - return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/groups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmigrate.Group](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - groupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("groupName")]) - if err != nil { - return nil, err - } - var options *armmigrate.GroupsClientCreateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armmigrate.GroupsClientCreateOptions{ - Group: &body, - } - } - respr, errRespr := g.srv.Create(req.Context(), resourceGroupNameParam, projectNameParam, groupNameParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Group, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (g *GroupsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if g.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/groups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - groupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("groupName")]) - if err != nil { - return nil, err - } - respr, errRespr := g.srv.Delete(req.Context(), resourceGroupNameParam, projectNameParam, groupNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (g *GroupsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if g.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/groups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - groupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("groupName")]) - if err != nil { - return nil, err - } - respr, errRespr := g.srv.Get(req.Context(), resourceGroupNameParam, projectNameParam, groupNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Group, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (g *GroupsServerTransport) dispatchNewListByProjectPager(req *http.Request) (*http.Response, error) { - if g.srv.NewListByProjectPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByProjectPager not implemented")} - } - newListByProjectPager := g.newListByProjectPager.get(req) - if newListByProjectPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/groups` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - resp := g.srv.NewListByProjectPager(resourceGroupNameParam, projectNameParam, nil) - newListByProjectPager = &resp - g.newListByProjectPager.add(req, newListByProjectPager) - } - resp, err := server.PagerResponderNext(newListByProjectPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - g.newListByProjectPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByProjectPager) { - g.newListByProjectPager.remove(req) - } - return resp, nil -} - -func (g *GroupsServerTransport) dispatchUpdateMachines(req *http.Request) (*http.Response, error) { - if g.srv.UpdateMachines == nil { - return nil, &nonRetriableError{errors.New("fake for method UpdateMachines not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/groups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updateMachines` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmigrate.UpdateGroupBody](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - groupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("groupName")]) - if err != nil { - return nil, err - } - var options *armmigrate.GroupsClientUpdateMachinesOptions - if !reflect.ValueOf(body).IsZero() { - options = &armmigrate.GroupsClientUpdateMachinesOptions{ - GroupUpdateProperties: &body, - } - } - respr, errRespr := g.srv.UpdateMachines(req.Context(), resourceGroupNameParam, projectNameParam, groupNameParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Group, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/hypervclustercontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/hypervclustercontroller_server.go new file mode 100644 index 000000000000..e81b5bfc3534 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/hypervclustercontroller_server.go @@ -0,0 +1,271 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" +) + +// HypervClusterControllerServer is a fake server for instances of the armmigrate.HypervClusterControllerClient type. +type HypervClusterControllerServer struct { + // BeginCreateCluster is the fake for method HypervClusterControllerClient.BeginCreateCluster + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateCluster func(ctx context.Context, resourceGroupName string, siteName string, clusterName string, body armmigrate.HypervCluster, options *armmigrate.HypervClusterControllerClientBeginCreateClusterOptions) (resp azfake.PollerResponder[armmigrate.HypervClusterControllerClientCreateClusterResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method HypervClusterControllerClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, siteName string, clusterName string, options *armmigrate.HypervClusterControllerClientDeleteOptions) (resp azfake.Responder[armmigrate.HypervClusterControllerClientDeleteResponse], errResp azfake.ErrorResponder) + + // GetCluster is the fake for method HypervClusterControllerClient.GetCluster + // HTTP status codes to indicate success: http.StatusOK + GetCluster func(ctx context.Context, resourceGroupName string, siteName string, clusterName string, options *armmigrate.HypervClusterControllerClientGetClusterOptions) (resp azfake.Responder[armmigrate.HypervClusterControllerClientGetClusterResponse], errResp azfake.ErrorResponder) + + // NewListByHypervSitePager is the fake for method HypervClusterControllerClient.NewListByHypervSitePager + // HTTP status codes to indicate success: http.StatusOK + NewListByHypervSitePager func(resourceGroupName string, siteName string, options *armmigrate.HypervClusterControllerClientListByHypervSiteOptions) (resp azfake.PagerResponder[armmigrate.HypervClusterControllerClientListByHypervSiteResponse]) +} + +// NewHypervClusterControllerServerTransport creates a new instance of HypervClusterControllerServerTransport with the provided implementation. +// The returned HypervClusterControllerServerTransport instance is connected to an instance of armmigrate.HypervClusterControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewHypervClusterControllerServerTransport(srv *HypervClusterControllerServer) *HypervClusterControllerServerTransport { + return &HypervClusterControllerServerTransport{ + srv: srv, + beginCreateCluster: newTracker[azfake.PollerResponder[armmigrate.HypervClusterControllerClientCreateClusterResponse]](), + newListByHypervSitePager: newTracker[azfake.PagerResponder[armmigrate.HypervClusterControllerClientListByHypervSiteResponse]](), + } +} + +// HypervClusterControllerServerTransport connects instances of armmigrate.HypervClusterControllerClient to instances of HypervClusterControllerServer. +// Don't use this type directly, use NewHypervClusterControllerServerTransport instead. +type HypervClusterControllerServerTransport struct { + srv *HypervClusterControllerServer + beginCreateCluster *tracker[azfake.PollerResponder[armmigrate.HypervClusterControllerClientCreateClusterResponse]] + newListByHypervSitePager *tracker[azfake.PagerResponder[armmigrate.HypervClusterControllerClientListByHypervSiteResponse]] +} + +// Do implements the policy.Transporter interface for HypervClusterControllerServerTransport. +func (h *HypervClusterControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "HypervClusterControllerClient.BeginCreateCluster": + resp, err = h.dispatchBeginCreateCluster(req) + case "HypervClusterControllerClient.Delete": + resp, err = h.dispatchDelete(req) + case "HypervClusterControllerClient.GetCluster": + resp, err = h.dispatchGetCluster(req) + case "HypervClusterControllerClient.NewListByHypervSitePager": + resp, err = h.dispatchNewListByHypervSitePager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (h *HypervClusterControllerServerTransport) dispatchBeginCreateCluster(req *http.Request) (*http.Response, error) { + if h.srv.BeginCreateCluster == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateCluster not implemented")} + } + beginCreateCluster := h.beginCreateCluster.get(req) + if beginCreateCluster == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/hypervSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.HypervCluster](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + respr, errRespr := h.srv.BeginCreateCluster(req.Context(), resourceGroupNameParam, siteNameParam, clusterNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateCluster = &respr + h.beginCreateCluster.add(req, beginCreateCluster) + } + + resp, err := server.PollerResponderNext(beginCreateCluster, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + h.beginCreateCluster.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateCluster) { + h.beginCreateCluster.remove(req) + } + + return resp, nil +} + +func (h *HypervClusterControllerServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if h.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/hypervSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + respr, errRespr := h.srv.Delete(req.Context(), resourceGroupNameParam, siteNameParam, clusterNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (h *HypervClusterControllerServerTransport) dispatchGetCluster(req *http.Request) (*http.Response, error) { + if h.srv.GetCluster == nil { + return nil, &nonRetriableError{errors.New("fake for method GetCluster not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/hypervSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + respr, errRespr := h.srv.GetCluster(req.Context(), resourceGroupNameParam, siteNameParam, clusterNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).HypervCluster, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (h *HypervClusterControllerServerTransport) dispatchNewListByHypervSitePager(req *http.Request) (*http.Response, error) { + if h.srv.NewListByHypervSitePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByHypervSitePager not implemented")} + } + newListByHypervSitePager := h.newListByHypervSitePager.get(req) + if newListByHypervSitePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/hypervSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/clusters` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + var options *armmigrate.HypervClusterControllerClientListByHypervSiteOptions + if filterParam != nil { + options = &armmigrate.HypervClusterControllerClientListByHypervSiteOptions{ + Filter: filterParam, + } + } + resp := h.srv.NewListByHypervSitePager(resourceGroupNameParam, siteNameParam, options) + newListByHypervSitePager = &resp + h.newListByHypervSitePager.add(req, newListByHypervSitePager) + server.PagerResponderInjectNextLinks(newListByHypervSitePager, req, func(page *armmigrate.HypervClusterControllerClientListByHypervSiteResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByHypervSitePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + h.newListByHypervSitePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByHypervSitePager) { + h.newListByHypervSitePager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/hypervcollectors_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/hypervcollectors_server.go deleted file mode 100644 index 29de5c408260..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/fake/hypervcollectors_server.go +++ /dev/null @@ -1,258 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" - "net/http" - "net/url" - "reflect" - "regexp" -) - -// HyperVCollectorsServer is a fake server for instances of the armmigrate.HyperVCollectorsClient type. -type HyperVCollectorsServer struct { - // Create is the fake for method HyperVCollectorsClient.Create - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - Create func(ctx context.Context, resourceGroupName string, projectName string, hyperVCollectorName string, options *armmigrate.HyperVCollectorsClientCreateOptions) (resp azfake.Responder[armmigrate.HyperVCollectorsClientCreateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method HyperVCollectorsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, projectName string, hyperVCollectorName string, options *armmigrate.HyperVCollectorsClientDeleteOptions) (resp azfake.Responder[armmigrate.HyperVCollectorsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method HyperVCollectorsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, projectName string, hyperVCollectorName string, options *armmigrate.HyperVCollectorsClientGetOptions) (resp azfake.Responder[armmigrate.HyperVCollectorsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByProjectPager is the fake for method HyperVCollectorsClient.NewListByProjectPager - // HTTP status codes to indicate success: http.StatusOK - NewListByProjectPager func(resourceGroupName string, projectName string, options *armmigrate.HyperVCollectorsClientListByProjectOptions) (resp azfake.PagerResponder[armmigrate.HyperVCollectorsClientListByProjectResponse]) -} - -// NewHyperVCollectorsServerTransport creates a new instance of HyperVCollectorsServerTransport with the provided implementation. -// The returned HyperVCollectorsServerTransport instance is connected to an instance of armmigrate.HyperVCollectorsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewHyperVCollectorsServerTransport(srv *HyperVCollectorsServer) *HyperVCollectorsServerTransport { - return &HyperVCollectorsServerTransport{ - srv: srv, - newListByProjectPager: newTracker[azfake.PagerResponder[armmigrate.HyperVCollectorsClientListByProjectResponse]](), - } -} - -// HyperVCollectorsServerTransport connects instances of armmigrate.HyperVCollectorsClient to instances of HyperVCollectorsServer. -// Don't use this type directly, use NewHyperVCollectorsServerTransport instead. -type HyperVCollectorsServerTransport struct { - srv *HyperVCollectorsServer - newListByProjectPager *tracker[azfake.PagerResponder[armmigrate.HyperVCollectorsClientListByProjectResponse]] -} - -// Do implements the policy.Transporter interface for HyperVCollectorsServerTransport. -func (h *HyperVCollectorsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "HyperVCollectorsClient.Create": - resp, err = h.dispatchCreate(req) - case "HyperVCollectorsClient.Delete": - resp, err = h.dispatchDelete(req) - case "HyperVCollectorsClient.Get": - resp, err = h.dispatchGet(req) - case "HyperVCollectorsClient.NewListByProjectPager": - resp, err = h.dispatchNewListByProjectPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (h *HyperVCollectorsServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { - if h.srv.Create == nil { - return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/hypervcollectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmigrate.HyperVCollector](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - hyperVCollectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("hyperVCollectorName")]) - if err != nil { - return nil, err - } - var options *armmigrate.HyperVCollectorsClientCreateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armmigrate.HyperVCollectorsClientCreateOptions{ - CollectorBody: &body, - } - } - respr, errRespr := h.srv.Create(req.Context(), resourceGroupNameParam, projectNameParam, hyperVCollectorNameParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).HyperVCollector, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (h *HyperVCollectorsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if h.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/hypervcollectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - hyperVCollectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("hyperVCollectorName")]) - if err != nil { - return nil, err - } - respr, errRespr := h.srv.Delete(req.Context(), resourceGroupNameParam, projectNameParam, hyperVCollectorNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (h *HyperVCollectorsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if h.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/hypervcollectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - hyperVCollectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("hyperVCollectorName")]) - if err != nil { - return nil, err - } - respr, errRespr := h.srv.Get(req.Context(), resourceGroupNameParam, projectNameParam, hyperVCollectorNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).HyperVCollector, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (h *HyperVCollectorsServerTransport) dispatchNewListByProjectPager(req *http.Request) (*http.Response, error) { - if h.srv.NewListByProjectPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByProjectPager not implemented")} - } - newListByProjectPager := h.newListByProjectPager.get(req) - if newListByProjectPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/hypervcollectors` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - resp := h.srv.NewListByProjectPager(resourceGroupNameParam, projectNameParam, nil) - newListByProjectPager = &resp - h.newListByProjectPager.add(req, newListByProjectPager) - } - resp, err := server.PagerResponderNext(newListByProjectPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - h.newListByProjectPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByProjectPager) { - h.newListByProjectPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/hypervdependencymapcontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/hypervdependencymapcontroller_server.go new file mode 100644 index 000000000000..c1e9656e7e03 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/hypervdependencymapcontroller_server.go @@ -0,0 +1,399 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" +) + +// HypervDependencyMapControllerServer is a fake server for instances of the armmigrate.HypervDependencyMapControllerClient type. +type HypervDependencyMapControllerServer struct { + // BeginClientGroupMembers is the fake for method HypervDependencyMapControllerClient.BeginClientGroupMembers + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginClientGroupMembers func(ctx context.Context, resourceGroupName string, siteName string, mapRequest armmigrate.DependencyMapServiceMapextensionsClientGroupMembersRequest, options *armmigrate.HypervDependencyMapControllerClientBeginClientGroupMembersOptions) (resp azfake.PollerResponder[armmigrate.HypervDependencyMapControllerClientClientGroupMembersResponse], errResp azfake.ErrorResponder) + + // BeginExportDependencies is the fake for method HypervDependencyMapControllerClient.BeginExportDependencies + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginExportDependencies func(ctx context.Context, resourceGroupName string, siteName string, requestBody armmigrate.DependencyMapServiceMapextensionsExportDependenciesRequest, options *armmigrate.HypervDependencyMapControllerClientBeginExportDependenciesOptions) (resp azfake.PollerResponder[armmigrate.HypervDependencyMapControllerClientExportDependenciesResponse], errResp azfake.ErrorResponder) + + // BeginGenerateCoarseMap is the fake for method HypervDependencyMapControllerClient.BeginGenerateCoarseMap + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginGenerateCoarseMap func(ctx context.Context, resourceGroupName string, siteName string, mapRequest armmigrate.DependencyMapServiceMapextensionsScopeMapRequest, options *armmigrate.HypervDependencyMapControllerClientBeginGenerateCoarseMapOptions) (resp azfake.PollerResponder[armmigrate.HypervDependencyMapControllerClientGenerateCoarseMapResponse], errResp azfake.ErrorResponder) + + // BeginGenerateDetailedMap is the fake for method HypervDependencyMapControllerClient.BeginGenerateDetailedMap + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginGenerateDetailedMap func(ctx context.Context, resourceGroupName string, siteName string, mapRequest armmigrate.DependencyMapServiceMapextensionsSingleMachineDetailedMapRequest, options *armmigrate.HypervDependencyMapControllerClientBeginGenerateDetailedMapOptions) (resp azfake.PollerResponder[armmigrate.HypervDependencyMapControllerClientGenerateDetailedMapResponse], errResp azfake.ErrorResponder) + + // BeginServerGroupMembers is the fake for method HypervDependencyMapControllerClient.BeginServerGroupMembers + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginServerGroupMembers func(ctx context.Context, resourceGroupName string, siteName string, mapRequest armmigrate.DependencyMapServiceMapextensionsServerGroupMembersRequest, options *armmigrate.HypervDependencyMapControllerClientBeginServerGroupMembersOptions) (resp azfake.PollerResponder[armmigrate.HypervDependencyMapControllerClientServerGroupMembersResponse], errResp azfake.ErrorResponder) + + // BeginUpdateDependencyMapStatus is the fake for method HypervDependencyMapControllerClient.BeginUpdateDependencyMapStatus + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdateDependencyMapStatus func(ctx context.Context, resourceGroupName string, siteName string, mapRequest armmigrate.UpdateMachineDepMapStatus, options *armmigrate.HypervDependencyMapControllerClientBeginUpdateDependencyMapStatusOptions) (resp azfake.PollerResponder[armmigrate.HypervDependencyMapControllerClientUpdateDependencyMapStatusResponse], errResp azfake.ErrorResponder) +} + +// NewHypervDependencyMapControllerServerTransport creates a new instance of HypervDependencyMapControllerServerTransport with the provided implementation. +// The returned HypervDependencyMapControllerServerTransport instance is connected to an instance of armmigrate.HypervDependencyMapControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewHypervDependencyMapControllerServerTransport(srv *HypervDependencyMapControllerServer) *HypervDependencyMapControllerServerTransport { + return &HypervDependencyMapControllerServerTransport{ + srv: srv, + beginClientGroupMembers: newTracker[azfake.PollerResponder[armmigrate.HypervDependencyMapControllerClientClientGroupMembersResponse]](), + beginExportDependencies: newTracker[azfake.PollerResponder[armmigrate.HypervDependencyMapControllerClientExportDependenciesResponse]](), + beginGenerateCoarseMap: newTracker[azfake.PollerResponder[armmigrate.HypervDependencyMapControllerClientGenerateCoarseMapResponse]](), + beginGenerateDetailedMap: newTracker[azfake.PollerResponder[armmigrate.HypervDependencyMapControllerClientGenerateDetailedMapResponse]](), + beginServerGroupMembers: newTracker[azfake.PollerResponder[armmigrate.HypervDependencyMapControllerClientServerGroupMembersResponse]](), + beginUpdateDependencyMapStatus: newTracker[azfake.PollerResponder[armmigrate.HypervDependencyMapControllerClientUpdateDependencyMapStatusResponse]](), + } +} + +// HypervDependencyMapControllerServerTransport connects instances of armmigrate.HypervDependencyMapControllerClient to instances of HypervDependencyMapControllerServer. +// Don't use this type directly, use NewHypervDependencyMapControllerServerTransport instead. +type HypervDependencyMapControllerServerTransport struct { + srv *HypervDependencyMapControllerServer + beginClientGroupMembers *tracker[azfake.PollerResponder[armmigrate.HypervDependencyMapControllerClientClientGroupMembersResponse]] + beginExportDependencies *tracker[azfake.PollerResponder[armmigrate.HypervDependencyMapControllerClientExportDependenciesResponse]] + beginGenerateCoarseMap *tracker[azfake.PollerResponder[armmigrate.HypervDependencyMapControllerClientGenerateCoarseMapResponse]] + beginGenerateDetailedMap *tracker[azfake.PollerResponder[armmigrate.HypervDependencyMapControllerClientGenerateDetailedMapResponse]] + beginServerGroupMembers *tracker[azfake.PollerResponder[armmigrate.HypervDependencyMapControllerClientServerGroupMembersResponse]] + beginUpdateDependencyMapStatus *tracker[azfake.PollerResponder[armmigrate.HypervDependencyMapControllerClientUpdateDependencyMapStatusResponse]] +} + +// Do implements the policy.Transporter interface for HypervDependencyMapControllerServerTransport. +func (h *HypervDependencyMapControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "HypervDependencyMapControllerClient.BeginClientGroupMembers": + resp, err = h.dispatchBeginClientGroupMembers(req) + case "HypervDependencyMapControllerClient.BeginExportDependencies": + resp, err = h.dispatchBeginExportDependencies(req) + case "HypervDependencyMapControllerClient.BeginGenerateCoarseMap": + resp, err = h.dispatchBeginGenerateCoarseMap(req) + case "HypervDependencyMapControllerClient.BeginGenerateDetailedMap": + resp, err = h.dispatchBeginGenerateDetailedMap(req) + case "HypervDependencyMapControllerClient.BeginServerGroupMembers": + resp, err = h.dispatchBeginServerGroupMembers(req) + case "HypervDependencyMapControllerClient.BeginUpdateDependencyMapStatus": + resp, err = h.dispatchBeginUpdateDependencyMapStatus(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (h *HypervDependencyMapControllerServerTransport) dispatchBeginClientGroupMembers(req *http.Request) (*http.Response, error) { + if h.srv.BeginClientGroupMembers == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginClientGroupMembers not implemented")} + } + beginClientGroupMembers := h.beginClientGroupMembers.get(req) + if beginClientGroupMembers == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/hypervSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/clientGroupMembers` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.DependencyMapServiceMapextensionsClientGroupMembersRequest](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := h.srv.BeginClientGroupMembers(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginClientGroupMembers = &respr + h.beginClientGroupMembers.add(req, beginClientGroupMembers) + } + + resp, err := server.PollerResponderNext(beginClientGroupMembers, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + h.beginClientGroupMembers.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginClientGroupMembers) { + h.beginClientGroupMembers.remove(req) + } + + return resp, nil +} + +func (h *HypervDependencyMapControllerServerTransport) dispatchBeginExportDependencies(req *http.Request) (*http.Response, error) { + if h.srv.BeginExportDependencies == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginExportDependencies not implemented")} + } + beginExportDependencies := h.beginExportDependencies.get(req) + if beginExportDependencies == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/hypervSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/exportDependencies` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.DependencyMapServiceMapextensionsExportDependenciesRequest](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := h.srv.BeginExportDependencies(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginExportDependencies = &respr + h.beginExportDependencies.add(req, beginExportDependencies) + } + + resp, err := server.PollerResponderNext(beginExportDependencies, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + h.beginExportDependencies.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginExportDependencies) { + h.beginExportDependencies.remove(req) + } + + return resp, nil +} + +func (h *HypervDependencyMapControllerServerTransport) dispatchBeginGenerateCoarseMap(req *http.Request) (*http.Response, error) { + if h.srv.BeginGenerateCoarseMap == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginGenerateCoarseMap not implemented")} + } + beginGenerateCoarseMap := h.beginGenerateCoarseMap.get(req) + if beginGenerateCoarseMap == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/hypervSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/generateCoarseMap` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.DependencyMapServiceMapextensionsScopeMapRequest](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := h.srv.BeginGenerateCoarseMap(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginGenerateCoarseMap = &respr + h.beginGenerateCoarseMap.add(req, beginGenerateCoarseMap) + } + + resp, err := server.PollerResponderNext(beginGenerateCoarseMap, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + h.beginGenerateCoarseMap.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginGenerateCoarseMap) { + h.beginGenerateCoarseMap.remove(req) + } + + return resp, nil +} + +func (h *HypervDependencyMapControllerServerTransport) dispatchBeginGenerateDetailedMap(req *http.Request) (*http.Response, error) { + if h.srv.BeginGenerateDetailedMap == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginGenerateDetailedMap not implemented")} + } + beginGenerateDetailedMap := h.beginGenerateDetailedMap.get(req) + if beginGenerateDetailedMap == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/hypervSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/generateDetailedMap` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.DependencyMapServiceMapextensionsSingleMachineDetailedMapRequest](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := h.srv.BeginGenerateDetailedMap(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginGenerateDetailedMap = &respr + h.beginGenerateDetailedMap.add(req, beginGenerateDetailedMap) + } + + resp, err := server.PollerResponderNext(beginGenerateDetailedMap, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + h.beginGenerateDetailedMap.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginGenerateDetailedMap) { + h.beginGenerateDetailedMap.remove(req) + } + + return resp, nil +} + +func (h *HypervDependencyMapControllerServerTransport) dispatchBeginServerGroupMembers(req *http.Request) (*http.Response, error) { + if h.srv.BeginServerGroupMembers == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginServerGroupMembers not implemented")} + } + beginServerGroupMembers := h.beginServerGroupMembers.get(req) + if beginServerGroupMembers == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/hypervSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/serverGroupMembers` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.DependencyMapServiceMapextensionsServerGroupMembersRequest](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := h.srv.BeginServerGroupMembers(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginServerGroupMembers = &respr + h.beginServerGroupMembers.add(req, beginServerGroupMembers) + } + + resp, err := server.PollerResponderNext(beginServerGroupMembers, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + h.beginServerGroupMembers.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginServerGroupMembers) { + h.beginServerGroupMembers.remove(req) + } + + return resp, nil +} + +func (h *HypervDependencyMapControllerServerTransport) dispatchBeginUpdateDependencyMapStatus(req *http.Request) (*http.Response, error) { + if h.srv.BeginUpdateDependencyMapStatus == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdateDependencyMapStatus not implemented")} + } + beginUpdateDependencyMapStatus := h.beginUpdateDependencyMapStatus.get(req) + if beginUpdateDependencyMapStatus == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/hypervSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updateDependencyMapStatus` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.UpdateMachineDepMapStatus](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := h.srv.BeginUpdateDependencyMapStatus(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdateDependencyMapStatus = &respr + h.beginUpdateDependencyMapStatus.add(req, beginUpdateDependencyMapStatus) + } + + resp, err := server.PollerResponderNext(beginUpdateDependencyMapStatus, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + h.beginUpdateDependencyMapStatus.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdateDependencyMapStatus) { + h.beginUpdateDependencyMapStatus.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/hypervhostcontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/hypervhostcontroller_server.go new file mode 100644 index 000000000000..7fdc89e59bd8 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/hypervhostcontroller_server.go @@ -0,0 +1,284 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" +) + +// HypervHostControllerServer is a fake server for instances of the armmigrate.HypervHostControllerClient type. +type HypervHostControllerServer struct { + // BeginCreate is the fake for method HypervHostControllerClient.BeginCreate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreate func(ctx context.Context, resourceGroupName string, siteName string, hostName string, body armmigrate.HypervHost, options *armmigrate.HypervHostControllerClientBeginCreateOptions) (resp azfake.PollerResponder[armmigrate.HypervHostControllerClientCreateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method HypervHostControllerClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, siteName string, hostName string, options *armmigrate.HypervHostControllerClientBeginDeleteOptions) (resp azfake.PollerResponder[armmigrate.HypervHostControllerClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method HypervHostControllerClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, siteName string, hostName string, options *armmigrate.HypervHostControllerClientGetOptions) (resp azfake.Responder[armmigrate.HypervHostControllerClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByHypervSitePager is the fake for method HypervHostControllerClient.NewListByHypervSitePager + // HTTP status codes to indicate success: http.StatusOK + NewListByHypervSitePager func(resourceGroupName string, siteName string, options *armmigrate.HypervHostControllerClientListByHypervSiteOptions) (resp azfake.PagerResponder[armmigrate.HypervHostControllerClientListByHypervSiteResponse]) +} + +// NewHypervHostControllerServerTransport creates a new instance of HypervHostControllerServerTransport with the provided implementation. +// The returned HypervHostControllerServerTransport instance is connected to an instance of armmigrate.HypervHostControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewHypervHostControllerServerTransport(srv *HypervHostControllerServer) *HypervHostControllerServerTransport { + return &HypervHostControllerServerTransport{ + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[armmigrate.HypervHostControllerClientCreateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armmigrate.HypervHostControllerClientDeleteResponse]](), + newListByHypervSitePager: newTracker[azfake.PagerResponder[armmigrate.HypervHostControllerClientListByHypervSiteResponse]](), + } +} + +// HypervHostControllerServerTransport connects instances of armmigrate.HypervHostControllerClient to instances of HypervHostControllerServer. +// Don't use this type directly, use NewHypervHostControllerServerTransport instead. +type HypervHostControllerServerTransport struct { + srv *HypervHostControllerServer + beginCreate *tracker[azfake.PollerResponder[armmigrate.HypervHostControllerClientCreateResponse]] + beginDelete *tracker[azfake.PollerResponder[armmigrate.HypervHostControllerClientDeleteResponse]] + newListByHypervSitePager *tracker[azfake.PagerResponder[armmigrate.HypervHostControllerClientListByHypervSiteResponse]] +} + +// Do implements the policy.Transporter interface for HypervHostControllerServerTransport. +func (h *HypervHostControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "HypervHostControllerClient.BeginCreate": + resp, err = h.dispatchBeginCreate(req) + case "HypervHostControllerClient.BeginDelete": + resp, err = h.dispatchBeginDelete(req) + case "HypervHostControllerClient.Get": + resp, err = h.dispatchGet(req) + case "HypervHostControllerClient.NewListByHypervSitePager": + resp, err = h.dispatchNewListByHypervSitePager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (h *HypervHostControllerServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { + if h.srv.BeginCreate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} + } + beginCreate := h.beginCreate.get(req) + if beginCreate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/hypervSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/hosts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.HypervHost](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + hostNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("hostName")]) + if err != nil { + return nil, err + } + respr, errRespr := h.srv.BeginCreate(req.Context(), resourceGroupNameParam, siteNameParam, hostNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreate = &respr + h.beginCreate.add(req, beginCreate) + } + + resp, err := server.PollerResponderNext(beginCreate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + h.beginCreate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreate) { + h.beginCreate.remove(req) + } + + return resp, nil +} + +func (h *HypervHostControllerServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if h.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := h.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/hypervSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/hosts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + hostNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("hostName")]) + if err != nil { + return nil, err + } + respr, errRespr := h.srv.BeginDelete(req.Context(), resourceGroupNameParam, siteNameParam, hostNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + h.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + h.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + h.beginDelete.remove(req) + } + + return resp, nil +} + +func (h *HypervHostControllerServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if h.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/hypervSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/hosts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + hostNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("hostName")]) + if err != nil { + return nil, err + } + respr, errRespr := h.srv.Get(req.Context(), resourceGroupNameParam, siteNameParam, hostNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).HypervHost, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (h *HypervHostControllerServerTransport) dispatchNewListByHypervSitePager(req *http.Request) (*http.Response, error) { + if h.srv.NewListByHypervSitePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByHypervSitePager not implemented")} + } + newListByHypervSitePager := h.newListByHypervSitePager.get(req) + if newListByHypervSitePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/hypervSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/hosts` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + var options *armmigrate.HypervHostControllerClientListByHypervSiteOptions + if filterParam != nil { + options = &armmigrate.HypervHostControllerClientListByHypervSiteOptions{ + Filter: filterParam, + } + } + resp := h.srv.NewListByHypervSitePager(resourceGroupNameParam, siteNameParam, options) + newListByHypervSitePager = &resp + h.newListByHypervSitePager.add(req, newListByHypervSitePager) + server.PagerResponderInjectNextLinks(newListByHypervSitePager, req, func(page *armmigrate.HypervHostControllerClientListByHypervSiteResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByHypervSitePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + h.newListByHypervSitePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByHypervSitePager) { + h.newListByHypervSitePager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/hypervjobs_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/hypervjobs_server.go new file mode 100644 index 000000000000..420bc9de77c3 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/hypervjobs_server.go @@ -0,0 +1,156 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" +) + +// HypervJobsServer is a fake server for instances of the armmigrate.HypervJobsClient type. +type HypervJobsServer struct { + // Get is the fake for method HypervJobsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, siteName string, jobName string, options *armmigrate.HypervJobsClientGetOptions) (resp azfake.Responder[armmigrate.HypervJobsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByHypervSitePager is the fake for method HypervJobsClient.NewListByHypervSitePager + // HTTP status codes to indicate success: http.StatusOK + NewListByHypervSitePager func(resourceGroupName string, siteName string, options *armmigrate.HypervJobsClientListByHypervSiteOptions) (resp azfake.PagerResponder[armmigrate.HypervJobsClientListByHypervSiteResponse]) +} + +// NewHypervJobsServerTransport creates a new instance of HypervJobsServerTransport with the provided implementation. +// The returned HypervJobsServerTransport instance is connected to an instance of armmigrate.HypervJobsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewHypervJobsServerTransport(srv *HypervJobsServer) *HypervJobsServerTransport { + return &HypervJobsServerTransport{ + srv: srv, + newListByHypervSitePager: newTracker[azfake.PagerResponder[armmigrate.HypervJobsClientListByHypervSiteResponse]](), + } +} + +// HypervJobsServerTransport connects instances of armmigrate.HypervJobsClient to instances of HypervJobsServer. +// Don't use this type directly, use NewHypervJobsServerTransport instead. +type HypervJobsServerTransport struct { + srv *HypervJobsServer + newListByHypervSitePager *tracker[azfake.PagerResponder[armmigrate.HypervJobsClientListByHypervSiteResponse]] +} + +// Do implements the policy.Transporter interface for HypervJobsServerTransport. +func (h *HypervJobsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "HypervJobsClient.Get": + resp, err = h.dispatchGet(req) + case "HypervJobsClient.NewListByHypervSitePager": + resp, err = h.dispatchNewListByHypervSitePager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (h *HypervJobsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if h.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/hypervSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/jobs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + jobNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("jobName")]) + if err != nil { + return nil, err + } + respr, errRespr := h.srv.Get(req.Context(), resourceGroupNameParam, siteNameParam, jobNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).HypervJob, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (h *HypervJobsServerTransport) dispatchNewListByHypervSitePager(req *http.Request) (*http.Response, error) { + if h.srv.NewListByHypervSitePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByHypervSitePager not implemented")} + } + newListByHypervSitePager := h.newListByHypervSitePager.get(req) + if newListByHypervSitePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/hypervSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/jobs` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + resp := h.srv.NewListByHypervSitePager(resourceGroupNameParam, siteNameParam, nil) + newListByHypervSitePager = &resp + h.newListByHypervSitePager.add(req, newListByHypervSitePager) + server.PagerResponderInjectNextLinks(newListByHypervSitePager, req, func(page *armmigrate.HypervJobsClientListByHypervSiteResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByHypervSitePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + h.newListByHypervSitePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByHypervSitePager) { + h.newListByHypervSitePager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/hypervjobscontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/hypervjobscontroller_server.go new file mode 100644 index 000000000000..c6ad7b31b840 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/hypervjobscontroller_server.go @@ -0,0 +1,156 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" +) + +// HypervJobsControllerServer is a fake server for instances of the armmigrate.HypervJobsControllerClient type. +type HypervJobsControllerServer struct { + // Get is the fake for method HypervJobsControllerClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, siteName string, jobName string, options *armmigrate.HypervJobsControllerClientGetOptions) (resp azfake.Responder[armmigrate.HypervJobsControllerClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByVmwareSitePager is the fake for method HypervJobsControllerClient.NewListByVmwareSitePager + // HTTP status codes to indicate success: http.StatusOK + NewListByVmwareSitePager func(resourceGroupName string, siteName string, options *armmigrate.HypervJobsControllerClientListByVmwareSiteOptions) (resp azfake.PagerResponder[armmigrate.HypervJobsControllerClientListByVmwareSiteResponse]) +} + +// NewHypervJobsControllerServerTransport creates a new instance of HypervJobsControllerServerTransport with the provided implementation. +// The returned HypervJobsControllerServerTransport instance is connected to an instance of armmigrate.HypervJobsControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewHypervJobsControllerServerTransport(srv *HypervJobsControllerServer) *HypervJobsControllerServerTransport { + return &HypervJobsControllerServerTransport{ + srv: srv, + newListByVmwareSitePager: newTracker[azfake.PagerResponder[armmigrate.HypervJobsControllerClientListByVmwareSiteResponse]](), + } +} + +// HypervJobsControllerServerTransport connects instances of armmigrate.HypervJobsControllerClient to instances of HypervJobsControllerServer. +// Don't use this type directly, use NewHypervJobsControllerServerTransport instead. +type HypervJobsControllerServerTransport struct { + srv *HypervJobsControllerServer + newListByVmwareSitePager *tracker[azfake.PagerResponder[armmigrate.HypervJobsControllerClientListByVmwareSiteResponse]] +} + +// Do implements the policy.Transporter interface for HypervJobsControllerServerTransport. +func (h *HypervJobsControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "HypervJobsControllerClient.Get": + resp, err = h.dispatchGet(req) + case "HypervJobsControllerClient.NewListByVmwareSitePager": + resp, err = h.dispatchNewListByVmwareSitePager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (h *HypervJobsControllerServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if h.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/vmwareSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/jobs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + jobNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("jobName")]) + if err != nil { + return nil, err + } + respr, errRespr := h.srv.Get(req.Context(), resourceGroupNameParam, siteNameParam, jobNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).VmwareJob, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (h *HypervJobsControllerServerTransport) dispatchNewListByVmwareSitePager(req *http.Request) (*http.Response, error) { + if h.srv.NewListByVmwareSitePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByVmwareSitePager not implemented")} + } + newListByVmwareSitePager := h.newListByVmwareSitePager.get(req) + if newListByVmwareSitePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/vmwareSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/jobs` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + resp := h.srv.NewListByVmwareSitePager(resourceGroupNameParam, siteNameParam, nil) + newListByVmwareSitePager = &resp + h.newListByVmwareSitePager.add(req, newListByVmwareSitePager) + server.PagerResponderInjectNextLinks(newListByVmwareSitePager, req, func(page *armmigrate.HypervJobsControllerClientListByVmwareSiteResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByVmwareSitePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + h.newListByVmwareSitePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByVmwareSitePager) { + h.newListByVmwareSitePager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/hypervmachinescontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/hypervmachinescontroller_server.go new file mode 100644 index 000000000000..8e26dd010da4 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/hypervmachinescontroller_server.go @@ -0,0 +1,308 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// HypervMachinesControllerServer is a fake server for instances of the armmigrate.HypervMachinesControllerClient type. +type HypervMachinesControllerServer struct { + // Get is the fake for method HypervMachinesControllerClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, siteName string, machineName string, options *armmigrate.HypervMachinesControllerClientGetOptions) (resp azfake.Responder[armmigrate.HypervMachinesControllerClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByHypervSitePager is the fake for method HypervMachinesControllerClient.NewListByHypervSitePager + // HTTP status codes to indicate success: http.StatusOK + NewListByHypervSitePager func(resourceGroupName string, siteName string, options *armmigrate.HypervMachinesControllerClientListByHypervSiteOptions) (resp azfake.PagerResponder[armmigrate.HypervMachinesControllerClientListByHypervSiteResponse]) + + // Update is the fake for method HypervMachinesControllerClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, siteName string, machineName string, body armmigrate.HypervMachineUpdate, options *armmigrate.HypervMachinesControllerClientUpdateOptions) (resp azfake.Responder[armmigrate.HypervMachinesControllerClientUpdateResponse], errResp azfake.ErrorResponder) + + // BeginUpdateProperties is the fake for method HypervMachinesControllerClient.BeginUpdateProperties + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdateProperties func(ctx context.Context, resourceGroupName string, siteName string, metaData armmigrate.MachineMetadataCollection, options *armmigrate.HypervMachinesControllerClientBeginUpdatePropertiesOptions) (resp azfake.PollerResponder[armmigrate.HypervMachinesControllerClientUpdatePropertiesResponse], errResp azfake.ErrorResponder) +} + +// NewHypervMachinesControllerServerTransport creates a new instance of HypervMachinesControllerServerTransport with the provided implementation. +// The returned HypervMachinesControllerServerTransport instance is connected to an instance of armmigrate.HypervMachinesControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewHypervMachinesControllerServerTransport(srv *HypervMachinesControllerServer) *HypervMachinesControllerServerTransport { + return &HypervMachinesControllerServerTransport{ + srv: srv, + newListByHypervSitePager: newTracker[azfake.PagerResponder[armmigrate.HypervMachinesControllerClientListByHypervSiteResponse]](), + beginUpdateProperties: newTracker[azfake.PollerResponder[armmigrate.HypervMachinesControllerClientUpdatePropertiesResponse]](), + } +} + +// HypervMachinesControllerServerTransport connects instances of armmigrate.HypervMachinesControllerClient to instances of HypervMachinesControllerServer. +// Don't use this type directly, use NewHypervMachinesControllerServerTransport instead. +type HypervMachinesControllerServerTransport struct { + srv *HypervMachinesControllerServer + newListByHypervSitePager *tracker[azfake.PagerResponder[armmigrate.HypervMachinesControllerClientListByHypervSiteResponse]] + beginUpdateProperties *tracker[azfake.PollerResponder[armmigrate.HypervMachinesControllerClientUpdatePropertiesResponse]] +} + +// Do implements the policy.Transporter interface for HypervMachinesControllerServerTransport. +func (h *HypervMachinesControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "HypervMachinesControllerClient.Get": + resp, err = h.dispatchGet(req) + case "HypervMachinesControllerClient.NewListByHypervSitePager": + resp, err = h.dispatchNewListByHypervSitePager(req) + case "HypervMachinesControllerClient.Update": + resp, err = h.dispatchUpdate(req) + case "HypervMachinesControllerClient.BeginUpdateProperties": + resp, err = h.dispatchBeginUpdateProperties(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (h *HypervMachinesControllerServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if h.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/hypervSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/machines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + machineNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("machineName")]) + if err != nil { + return nil, err + } + respr, errRespr := h.srv.Get(req.Context(), resourceGroupNameParam, siteNameParam, machineNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).HypervMachine, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (h *HypervMachinesControllerServerTransport) dispatchNewListByHypervSitePager(req *http.Request) (*http.Response, error) { + if h.srv.NewListByHypervSitePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByHypervSitePager not implemented")} + } + newListByHypervSitePager := h.newListByHypervSitePager.get(req) + if newListByHypervSitePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/hypervSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/machines` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + continuationTokenUnescaped, err := url.QueryUnescape(qp.Get("continuationToken")) + if err != nil { + return nil, err + } + continuationTokenParam := getOptional(continuationTokenUnescaped) + totalRecordCountUnescaped, err := url.QueryUnescape(qp.Get("totalRecordCount")) + if err != nil { + return nil, err + } + totalRecordCountParam, err := parseOptional(totalRecordCountUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + var options *armmigrate.HypervMachinesControllerClientListByHypervSiteOptions + if filterParam != nil || topParam != nil || continuationTokenParam != nil || totalRecordCountParam != nil { + options = &armmigrate.HypervMachinesControllerClientListByHypervSiteOptions{ + Filter: filterParam, + Top: topParam, + ContinuationToken: continuationTokenParam, + TotalRecordCount: totalRecordCountParam, + } + } + resp := h.srv.NewListByHypervSitePager(resourceGroupNameParam, siteNameParam, options) + newListByHypervSitePager = &resp + h.newListByHypervSitePager.add(req, newListByHypervSitePager) + server.PagerResponderInjectNextLinks(newListByHypervSitePager, req, func(page *armmigrate.HypervMachinesControllerClientListByHypervSiteResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByHypervSitePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + h.newListByHypervSitePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByHypervSitePager) { + h.newListByHypervSitePager.remove(req) + } + return resp, nil +} + +func (h *HypervMachinesControllerServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if h.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/hypervSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/machines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.HypervMachineUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + machineNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("machineName")]) + if err != nil { + return nil, err + } + respr, errRespr := h.srv.Update(req.Context(), resourceGroupNameParam, siteNameParam, machineNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).HypervMachine, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (h *HypervMachinesControllerServerTransport) dispatchBeginUpdateProperties(req *http.Request) (*http.Response, error) { + if h.srv.BeginUpdateProperties == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdateProperties not implemented")} + } + beginUpdateProperties := h.beginUpdateProperties.get(req) + if beginUpdateProperties == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/hypervSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updateProperties` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.MachineMetadataCollection](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := h.srv.BeginUpdateProperties(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdateProperties = &respr + h.beginUpdateProperties.add(req, beginUpdateProperties) + } + + resp, err := server.PollerResponderNext(beginUpdateProperties, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + h.beginUpdateProperties.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdateProperties) { + h.beginUpdateProperties.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/hypervoperationsstatuscontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/hypervoperationsstatuscontroller_server.go new file mode 100644 index 000000000000..209ceb7dbf9d --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/hypervoperationsstatuscontroller_server.go @@ -0,0 +1,104 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" +) + +// HypervOperationsStatusControllerServer is a fake server for instances of the armmigrate.HypervOperationsStatusControllerClient type. +type HypervOperationsStatusControllerServer struct { + // GetHypervOperationsStatus is the fake for method HypervOperationsStatusControllerClient.GetHypervOperationsStatus + // HTTP status codes to indicate success: http.StatusOK + GetHypervOperationsStatus func(ctx context.Context, resourceGroupName string, siteName string, operationStatusName string, options *armmigrate.HypervOperationsStatusControllerClientGetHypervOperationsStatusOptions) (resp azfake.Responder[armmigrate.HypervOperationsStatusControllerClientGetHypervOperationsStatusResponse], errResp azfake.ErrorResponder) +} + +// NewHypervOperationsStatusControllerServerTransport creates a new instance of HypervOperationsStatusControllerServerTransport with the provided implementation. +// The returned HypervOperationsStatusControllerServerTransport instance is connected to an instance of armmigrate.HypervOperationsStatusControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewHypervOperationsStatusControllerServerTransport(srv *HypervOperationsStatusControllerServer) *HypervOperationsStatusControllerServerTransport { + return &HypervOperationsStatusControllerServerTransport{srv: srv} +} + +// HypervOperationsStatusControllerServerTransport connects instances of armmigrate.HypervOperationsStatusControllerClient to instances of HypervOperationsStatusControllerServer. +// Don't use this type directly, use NewHypervOperationsStatusControllerServerTransport instead. +type HypervOperationsStatusControllerServerTransport struct { + srv *HypervOperationsStatusControllerServer +} + +// Do implements the policy.Transporter interface for HypervOperationsStatusControllerServerTransport. +func (h *HypervOperationsStatusControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "HypervOperationsStatusControllerClient.GetHypervOperationsStatus": + resp, err = h.dispatchGetHypervOperationsStatus(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (h *HypervOperationsStatusControllerServerTransport) dispatchGetHypervOperationsStatus(req *http.Request) (*http.Response, error) { + if h.srv.GetHypervOperationsStatus == nil { + return nil, &nonRetriableError{errors.New("fake for method GetHypervOperationsStatus not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/hypervSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operationsStatus/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + operationStatusNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationStatusName")]) + if err != nil { + return nil, err + } + respr, errRespr := h.srv.GetHypervOperationsStatus(req.Context(), resourceGroupNameParam, siteNameParam, operationStatusNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationStatus, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/hypervrunasaccountscontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/hypervrunasaccountscontroller_server.go new file mode 100644 index 000000000000..19b7521584f4 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/hypervrunasaccountscontroller_server.go @@ -0,0 +1,156 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" +) + +// HypervRunAsAccountsControllerServer is a fake server for instances of the armmigrate.HypervRunAsAccountsControllerClient type. +type HypervRunAsAccountsControllerServer struct { + // Get is the fake for method HypervRunAsAccountsControllerClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, siteName string, accountName string, options *armmigrate.HypervRunAsAccountsControllerClientGetOptions) (resp azfake.Responder[armmigrate.HypervRunAsAccountsControllerClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByHypervSitePager is the fake for method HypervRunAsAccountsControllerClient.NewListByHypervSitePager + // HTTP status codes to indicate success: http.StatusOK + NewListByHypervSitePager func(resourceGroupName string, siteName string, options *armmigrate.HypervRunAsAccountsControllerClientListByHypervSiteOptions) (resp azfake.PagerResponder[armmigrate.HypervRunAsAccountsControllerClientListByHypervSiteResponse]) +} + +// NewHypervRunAsAccountsControllerServerTransport creates a new instance of HypervRunAsAccountsControllerServerTransport with the provided implementation. +// The returned HypervRunAsAccountsControllerServerTransport instance is connected to an instance of armmigrate.HypervRunAsAccountsControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewHypervRunAsAccountsControllerServerTransport(srv *HypervRunAsAccountsControllerServer) *HypervRunAsAccountsControllerServerTransport { + return &HypervRunAsAccountsControllerServerTransport{ + srv: srv, + newListByHypervSitePager: newTracker[azfake.PagerResponder[armmigrate.HypervRunAsAccountsControllerClientListByHypervSiteResponse]](), + } +} + +// HypervRunAsAccountsControllerServerTransport connects instances of armmigrate.HypervRunAsAccountsControllerClient to instances of HypervRunAsAccountsControllerServer. +// Don't use this type directly, use NewHypervRunAsAccountsControllerServerTransport instead. +type HypervRunAsAccountsControllerServerTransport struct { + srv *HypervRunAsAccountsControllerServer + newListByHypervSitePager *tracker[azfake.PagerResponder[armmigrate.HypervRunAsAccountsControllerClientListByHypervSiteResponse]] +} + +// Do implements the policy.Transporter interface for HypervRunAsAccountsControllerServerTransport. +func (h *HypervRunAsAccountsControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "HypervRunAsAccountsControllerClient.Get": + resp, err = h.dispatchGet(req) + case "HypervRunAsAccountsControllerClient.NewListByHypervSitePager": + resp, err = h.dispatchNewListByHypervSitePager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (h *HypervRunAsAccountsControllerServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if h.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/hypervSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/runAsAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + respr, errRespr := h.srv.Get(req.Context(), resourceGroupNameParam, siteNameParam, accountNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).HypervRunAsAccountResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (h *HypervRunAsAccountsControllerServerTransport) dispatchNewListByHypervSitePager(req *http.Request) (*http.Response, error) { + if h.srv.NewListByHypervSitePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByHypervSitePager not implemented")} + } + newListByHypervSitePager := h.newListByHypervSitePager.get(req) + if newListByHypervSitePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/hypervSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/runAsAccounts` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + resp := h.srv.NewListByHypervSitePager(resourceGroupNameParam, siteNameParam, nil) + newListByHypervSitePager = &resp + h.newListByHypervSitePager.add(req, newListByHypervSitePager) + server.PagerResponderInjectNextLinks(newListByHypervSitePager, req, func(page *armmigrate.HypervRunAsAccountsControllerClientListByHypervSiteResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByHypervSitePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + h.newListByHypervSitePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByHypervSitePager) { + h.newListByHypervSitePager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/hypervsites_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/hypervsites_server.go new file mode 100644 index 000000000000..3e494d54e526 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/hypervsites_server.go @@ -0,0 +1,149 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" +) + +// HypervSitesServer is a fake server for instances of the armmigrate.HypervSitesClient type. +type HypervSitesServer struct { + // NewListByResourceGroupPager is the fake for method HypervSitesClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armmigrate.HypervSitesClientListByResourceGroupOptions) (resp azfake.PagerResponder[armmigrate.HypervSitesClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method HypervSitesClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armmigrate.HypervSitesClientListBySubscriptionOptions) (resp azfake.PagerResponder[armmigrate.HypervSitesClientListBySubscriptionResponse]) +} + +// NewHypervSitesServerTransport creates a new instance of HypervSitesServerTransport with the provided implementation. +// The returned HypervSitesServerTransport instance is connected to an instance of armmigrate.HypervSitesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewHypervSitesServerTransport(srv *HypervSitesServer) *HypervSitesServerTransport { + return &HypervSitesServerTransport{ + srv: srv, + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armmigrate.HypervSitesClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armmigrate.HypervSitesClientListBySubscriptionResponse]](), + } +} + +// HypervSitesServerTransport connects instances of armmigrate.HypervSitesClient to instances of HypervSitesServer. +// Don't use this type directly, use NewHypervSitesServerTransport instead. +type HypervSitesServerTransport struct { + srv *HypervSitesServer + newListByResourceGroupPager *tracker[azfake.PagerResponder[armmigrate.HypervSitesClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armmigrate.HypervSitesClientListBySubscriptionResponse]] +} + +// Do implements the policy.Transporter interface for HypervSitesServerTransport. +func (h *HypervSitesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "HypervSitesClient.NewListByResourceGroupPager": + resp, err = h.dispatchNewListByResourceGroupPager(req) + case "HypervSitesClient.NewListBySubscriptionPager": + resp, err = h.dispatchNewListBySubscriptionPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (h *HypervSitesServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if h.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := h.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/hypervSites` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resp := h.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + h.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armmigrate.HypervSitesClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + h.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + h.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (h *HypervSitesServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if h.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := h.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/hypervSites` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resp := h.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + h.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armmigrate.HypervSitesClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + h.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + h.newListBySubscriptionPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/hypervsitescontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/hypervsitescontroller_server.go new file mode 100644 index 000000000000..31ab6b58f43b --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/hypervsitescontroller_server.go @@ -0,0 +1,507 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// HypervSitesControllerServer is a fake server for instances of the armmigrate.HypervSitesControllerClient type. +type HypervSitesControllerServer struct { + // ComputeErrorSummary is the fake for method HypervSitesControllerClient.ComputeErrorSummary + // HTTP status codes to indicate success: http.StatusOK + ComputeErrorSummary func(ctx context.Context, resourceGroupName string, siteName string, body any, options *armmigrate.HypervSitesControllerClientComputeErrorSummaryOptions) (resp azfake.Responder[armmigrate.HypervSitesControllerClientComputeErrorSummaryResponse], errResp azfake.ErrorResponder) + + // Computeusage is the fake for method HypervSitesControllerClient.Computeusage + // HTTP status codes to indicate success: http.StatusOK + Computeusage func(ctx context.Context, resourceGroupName string, siteName string, body any, options *armmigrate.HypervSitesControllerClientComputeusageOptions) (resp azfake.Responder[armmigrate.HypervSitesControllerClientComputeusageResponse], errResp azfake.ErrorResponder) + + // Create is the fake for method HypervSitesControllerClient.Create + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + Create func(ctx context.Context, resourceGroupName string, siteName string, body armmigrate.HypervSite, options *armmigrate.HypervSitesControllerClientCreateOptions) (resp azfake.Responder[armmigrate.HypervSitesControllerClientCreateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method HypervSitesControllerClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, siteName string, options *armmigrate.HypervSitesControllerClientDeleteOptions) (resp azfake.Responder[armmigrate.HypervSitesControllerClientDeleteResponse], errResp azfake.ErrorResponder) + + // BeginExportApplications is the fake for method HypervSitesControllerClient.BeginExportApplications + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginExportApplications func(ctx context.Context, resourceGroupName string, siteName string, body any, options *armmigrate.HypervSitesControllerClientBeginExportApplicationsOptions) (resp azfake.PollerResponder[armmigrate.HypervSitesControllerClientExportApplicationsResponse], errResp azfake.ErrorResponder) + + // BeginExportMachineErrors is the fake for method HypervSitesControllerClient.BeginExportMachineErrors + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginExportMachineErrors func(ctx context.Context, resourceGroupName string, siteName string, body armmigrate.ExportMachineErrorsRequest, options *armmigrate.HypervSitesControllerClientBeginExportMachineErrorsOptions) (resp azfake.PollerResponder[armmigrate.HypervSitesControllerClientExportMachineErrorsResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method HypervSitesControllerClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, siteName string, options *armmigrate.HypervSitesControllerClientGetOptions) (resp azfake.Responder[armmigrate.HypervSitesControllerClientGetResponse], errResp azfake.ErrorResponder) + + // ListHealthSummary is the fake for method HypervSitesControllerClient.ListHealthSummary + // HTTP status codes to indicate success: http.StatusOK + ListHealthSummary func(ctx context.Context, resourceGroupName string, siteName string, options *armmigrate.HypervSitesControllerClientListHealthSummaryOptions) (resp azfake.Responder[armmigrate.HypervSitesControllerClientListHealthSummaryResponse], errResp azfake.ErrorResponder) + + // Summary is the fake for method HypervSitesControllerClient.Summary + // HTTP status codes to indicate success: http.StatusOK + Summary func(ctx context.Context, resourceGroupName string, siteName string, options *armmigrate.HypervSitesControllerClientSummaryOptions) (resp azfake.Responder[armmigrate.HypervSitesControllerClientSummaryResponse], errResp azfake.ErrorResponder) + + // Update is the fake for method HypervSitesControllerClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, siteName string, body armmigrate.HypervSiteUpdate, options *armmigrate.HypervSitesControllerClientUpdateOptions) (resp azfake.Responder[armmigrate.HypervSitesControllerClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewHypervSitesControllerServerTransport creates a new instance of HypervSitesControllerServerTransport with the provided implementation. +// The returned HypervSitesControllerServerTransport instance is connected to an instance of armmigrate.HypervSitesControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewHypervSitesControllerServerTransport(srv *HypervSitesControllerServer) *HypervSitesControllerServerTransport { + return &HypervSitesControllerServerTransport{ + srv: srv, + beginExportApplications: newTracker[azfake.PollerResponder[armmigrate.HypervSitesControllerClientExportApplicationsResponse]](), + beginExportMachineErrors: newTracker[azfake.PollerResponder[armmigrate.HypervSitesControllerClientExportMachineErrorsResponse]](), + } +} + +// HypervSitesControllerServerTransport connects instances of armmigrate.HypervSitesControllerClient to instances of HypervSitesControllerServer. +// Don't use this type directly, use NewHypervSitesControllerServerTransport instead. +type HypervSitesControllerServerTransport struct { + srv *HypervSitesControllerServer + beginExportApplications *tracker[azfake.PollerResponder[armmigrate.HypervSitesControllerClientExportApplicationsResponse]] + beginExportMachineErrors *tracker[azfake.PollerResponder[armmigrate.HypervSitesControllerClientExportMachineErrorsResponse]] +} + +// Do implements the policy.Transporter interface for HypervSitesControllerServerTransport. +func (h *HypervSitesControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "HypervSitesControllerClient.ComputeErrorSummary": + resp, err = h.dispatchComputeErrorSummary(req) + case "HypervSitesControllerClient.Computeusage": + resp, err = h.dispatchComputeusage(req) + case "HypervSitesControllerClient.Create": + resp, err = h.dispatchCreate(req) + case "HypervSitesControllerClient.Delete": + resp, err = h.dispatchDelete(req) + case "HypervSitesControllerClient.BeginExportApplications": + resp, err = h.dispatchBeginExportApplications(req) + case "HypervSitesControllerClient.BeginExportMachineErrors": + resp, err = h.dispatchBeginExportMachineErrors(req) + case "HypervSitesControllerClient.Get": + resp, err = h.dispatchGet(req) + case "HypervSitesControllerClient.ListHealthSummary": + resp, err = h.dispatchListHealthSummary(req) + case "HypervSitesControllerClient.Summary": + resp, err = h.dispatchSummary(req) + case "HypervSitesControllerClient.Update": + resp, err = h.dispatchUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (h *HypervSitesControllerServerTransport) dispatchComputeErrorSummary(req *http.Request) (*http.Response, error) { + if h.srv.ComputeErrorSummary == nil { + return nil, &nonRetriableError{errors.New("fake for method ComputeErrorSummary not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/hypervSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/computeErrorSummary` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[any](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := h.srv.ComputeErrorSummary(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SiteErrorSummary, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (h *HypervSitesControllerServerTransport) dispatchComputeusage(req *http.Request) (*http.Response, error) { + if h.srv.Computeusage == nil { + return nil, &nonRetriableError{errors.New("fake for method Computeusage not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/hypervSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/computeusage` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[any](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := h.srv.Computeusage(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).HypervSiteUsage, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (h *HypervSitesControllerServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { + if h.srv.Create == nil { + return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/hypervSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.HypervSite](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := h.srv.Create(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).HypervSite, req) + if err != nil { + return nil, err + } + if val := server.GetResponse(respr).RetryAfter; val != nil { + resp.Header.Set("Retry-After", strconv.FormatInt(int64(*val), 10)) + } + return resp, nil +} + +func (h *HypervSitesControllerServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if h.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/hypervSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := h.srv.Delete(req.Context(), resourceGroupNameParam, siteNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (h *HypervSitesControllerServerTransport) dispatchBeginExportApplications(req *http.Request) (*http.Response, error) { + if h.srv.BeginExportApplications == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginExportApplications not implemented")} + } + beginExportApplications := h.beginExportApplications.get(req) + if beginExportApplications == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/hypervSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/exportApplications` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[any](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := h.srv.BeginExportApplications(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginExportApplications = &respr + h.beginExportApplications.add(req, beginExportApplications) + } + + resp, err := server.PollerResponderNext(beginExportApplications, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + h.beginExportApplications.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginExportApplications) { + h.beginExportApplications.remove(req) + } + + return resp, nil +} + +func (h *HypervSitesControllerServerTransport) dispatchBeginExportMachineErrors(req *http.Request) (*http.Response, error) { + if h.srv.BeginExportMachineErrors == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginExportMachineErrors not implemented")} + } + beginExportMachineErrors := h.beginExportMachineErrors.get(req) + if beginExportMachineErrors == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/hypervSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/exportMachineErrors` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.ExportMachineErrorsRequest](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := h.srv.BeginExportMachineErrors(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginExportMachineErrors = &respr + h.beginExportMachineErrors.add(req, beginExportMachineErrors) + } + + resp, err := server.PollerResponderNext(beginExportMachineErrors, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + h.beginExportMachineErrors.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginExportMachineErrors) { + h.beginExportMachineErrors.remove(req) + } + + return resp, nil +} + +func (h *HypervSitesControllerServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if h.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/hypervSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := h.srv.Get(req.Context(), resourceGroupNameParam, siteNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).HypervSite, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (h *HypervSitesControllerServerTransport) dispatchListHealthSummary(req *http.Request) (*http.Response, error) { + if h.srv.ListHealthSummary == nil { + return nil, &nonRetriableError{errors.New("fake for method ListHealthSummary not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/hypervSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listHealthSummary` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := h.srv.ListHealthSummary(req.Context(), resourceGroupNameParam, siteNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SiteHealthSummaryCollection, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (h *HypervSitesControllerServerTransport) dispatchSummary(req *http.Request) (*http.Response, error) { + if h.srv.Summary == nil { + return nil, &nonRetriableError{errors.New("fake for method Summary not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/hypervSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/summary` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := h.srv.Summary(req.Context(), resourceGroupNameParam, siteNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).HypervSiteUsage, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (h *HypervSitesControllerServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if h.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/hypervSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.HypervSiteUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := h.srv.Update(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).HypervSite, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/hypervsoftwareinventoriescontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/hypervsoftwareinventoriescontroller_server.go new file mode 100644 index 000000000000..75415c40d24f --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/hypervsoftwareinventoriescontroller_server.go @@ -0,0 +1,170 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" +) + +// HypervSoftwareInventoriesControllerServer is a fake server for instances of the armmigrate.HypervSoftwareInventoriesControllerClient type. +type HypervSoftwareInventoriesControllerServer struct { + // GetMachineSoftwareInventory is the fake for method HypervSoftwareInventoriesControllerClient.GetMachineSoftwareInventory + // HTTP status codes to indicate success: http.StatusOK + GetMachineSoftwareInventory func(ctx context.Context, resourceGroupName string, siteName string, machineName string, defaultParam armmigrate.Default, options *armmigrate.HypervSoftwareInventoriesControllerClientGetMachineSoftwareInventoryOptions) (resp azfake.Responder[armmigrate.HypervSoftwareInventoriesControllerClientGetMachineSoftwareInventoryResponse], errResp azfake.ErrorResponder) + + // NewListByHypervMachinePager is the fake for method HypervSoftwareInventoriesControllerClient.NewListByHypervMachinePager + // HTTP status codes to indicate success: http.StatusOK + NewListByHypervMachinePager func(resourceGroupName string, siteName string, machineName string, options *armmigrate.HypervSoftwareInventoriesControllerClientListByHypervMachineOptions) (resp azfake.PagerResponder[armmigrate.HypervSoftwareInventoriesControllerClientListByHypervMachineResponse]) +} + +// NewHypervSoftwareInventoriesControllerServerTransport creates a new instance of HypervSoftwareInventoriesControllerServerTransport with the provided implementation. +// The returned HypervSoftwareInventoriesControllerServerTransport instance is connected to an instance of armmigrate.HypervSoftwareInventoriesControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewHypervSoftwareInventoriesControllerServerTransport(srv *HypervSoftwareInventoriesControllerServer) *HypervSoftwareInventoriesControllerServerTransport { + return &HypervSoftwareInventoriesControllerServerTransport{ + srv: srv, + newListByHypervMachinePager: newTracker[azfake.PagerResponder[armmigrate.HypervSoftwareInventoriesControllerClientListByHypervMachineResponse]](), + } +} + +// HypervSoftwareInventoriesControllerServerTransport connects instances of armmigrate.HypervSoftwareInventoriesControllerClient to instances of HypervSoftwareInventoriesControllerServer. +// Don't use this type directly, use NewHypervSoftwareInventoriesControllerServerTransport instead. +type HypervSoftwareInventoriesControllerServerTransport struct { + srv *HypervSoftwareInventoriesControllerServer + newListByHypervMachinePager *tracker[azfake.PagerResponder[armmigrate.HypervSoftwareInventoriesControllerClientListByHypervMachineResponse]] +} + +// Do implements the policy.Transporter interface for HypervSoftwareInventoriesControllerServerTransport. +func (h *HypervSoftwareInventoriesControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "HypervSoftwareInventoriesControllerClient.GetMachineSoftwareInventory": + resp, err = h.dispatchGetMachineSoftwareInventory(req) + case "HypervSoftwareInventoriesControllerClient.NewListByHypervMachinePager": + resp, err = h.dispatchNewListByHypervMachinePager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (h *HypervSoftwareInventoriesControllerServerTransport) dispatchGetMachineSoftwareInventory(req *http.Request) (*http.Response, error) { + if h.srv.GetMachineSoftwareInventory == nil { + return nil, &nonRetriableError{errors.New("fake for method GetMachineSoftwareInventory not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/hypervSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/machines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/softwareInventories/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + machineNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("machineName")]) + if err != nil { + return nil, err + } + defaultParamParam, err := parseWithCast(matches[regex.SubexpIndex("default")], func(v string) (armmigrate.Default, error) { + p, unescapeErr := url.PathUnescape(v) + if unescapeErr != nil { + return "", unescapeErr + } + return armmigrate.Default(p), nil + }) + if err != nil { + return nil, err + } + respr, errRespr := h.srv.GetMachineSoftwareInventory(req.Context(), resourceGroupNameParam, siteNameParam, machineNameParam, defaultParamParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).HypervVMSoftwareInventory, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (h *HypervSoftwareInventoriesControllerServerTransport) dispatchNewListByHypervMachinePager(req *http.Request) (*http.Response, error) { + if h.srv.NewListByHypervMachinePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByHypervMachinePager not implemented")} + } + newListByHypervMachinePager := h.newListByHypervMachinePager.get(req) + if newListByHypervMachinePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/hypervSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/machines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/softwareinventories` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + machineNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("machineName")]) + if err != nil { + return nil, err + } + resp := h.srv.NewListByHypervMachinePager(resourceGroupNameParam, siteNameParam, machineNameParam, nil) + newListByHypervMachinePager = &resp + h.newListByHypervMachinePager.add(req, newListByHypervMachinePager) + server.PagerResponderInjectNextLinks(newListByHypervMachinePager, req, func(page *armmigrate.HypervSoftwareInventoriesControllerClientListByHypervMachineResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByHypervMachinePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + h.newListByHypervMachinePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByHypervMachinePager) { + h.newListByHypervMachinePager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/iiswebapplicationscontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/iiswebapplicationscontroller_server.go new file mode 100644 index 000000000000..62c778790674 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/iiswebapplicationscontroller_server.go @@ -0,0 +1,255 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// IisWebApplicationsControllerServer is a fake server for instances of the armmigrate.IisWebApplicationsControllerClient type. +type IisWebApplicationsControllerServer struct { + // Get is the fake for method IisWebApplicationsControllerClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, webApplicationName string, options *armmigrate.IisWebApplicationsControllerClientGetOptions) (resp azfake.Responder[armmigrate.IisWebApplicationsControllerClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByWebAppSitePager is the fake for method IisWebApplicationsControllerClient.NewListByWebAppSitePager + // HTTP status codes to indicate success: http.StatusOK + NewListByWebAppSitePager func(resourceGroupName string, siteName string, webAppSiteName string, options *armmigrate.IisWebApplicationsControllerClientListByWebAppSiteOptions) (resp azfake.PagerResponder[armmigrate.IisWebApplicationsControllerClientListByWebAppSiteResponse]) + + // Update is the fake for method IisWebApplicationsControllerClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, webApplicationName string, body armmigrate.IisWebApplicationsUpdate, options *armmigrate.IisWebApplicationsControllerClientUpdateOptions) (resp azfake.Responder[armmigrate.IisWebApplicationsControllerClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewIisWebApplicationsControllerServerTransport creates a new instance of IisWebApplicationsControllerServerTransport with the provided implementation. +// The returned IisWebApplicationsControllerServerTransport instance is connected to an instance of armmigrate.IisWebApplicationsControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewIisWebApplicationsControllerServerTransport(srv *IisWebApplicationsControllerServer) *IisWebApplicationsControllerServerTransport { + return &IisWebApplicationsControllerServerTransport{ + srv: srv, + newListByWebAppSitePager: newTracker[azfake.PagerResponder[armmigrate.IisWebApplicationsControllerClientListByWebAppSiteResponse]](), + } +} + +// IisWebApplicationsControllerServerTransport connects instances of armmigrate.IisWebApplicationsControllerClient to instances of IisWebApplicationsControllerServer. +// Don't use this type directly, use NewIisWebApplicationsControllerServerTransport instead. +type IisWebApplicationsControllerServerTransport struct { + srv *IisWebApplicationsControllerServer + newListByWebAppSitePager *tracker[azfake.PagerResponder[armmigrate.IisWebApplicationsControllerClientListByWebAppSiteResponse]] +} + +// Do implements the policy.Transporter interface for IisWebApplicationsControllerServerTransport. +func (i *IisWebApplicationsControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "IisWebApplicationsControllerClient.Get": + resp, err = i.dispatchGet(req) + case "IisWebApplicationsControllerClient.NewListByWebAppSitePager": + resp, err = i.dispatchNewListByWebAppSitePager(req) + case "IisWebApplicationsControllerClient.Update": + resp, err = i.dispatchUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (i *IisWebApplicationsControllerServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if i.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/webAppSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/iisWebApplications/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + webAppSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("webAppSiteName")]) + if err != nil { + return nil, err + } + webApplicationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("webApplicationName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.Get(req.Context(), resourceGroupNameParam, siteNameParam, webAppSiteNameParam, webApplicationNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).IisWebApplications, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (i *IisWebApplicationsControllerServerTransport) dispatchNewListByWebAppSitePager(req *http.Request) (*http.Response, error) { + if i.srv.NewListByWebAppSitePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByWebAppSitePager not implemented")} + } + newListByWebAppSitePager := i.newListByWebAppSitePager.get(req) + if newListByWebAppSitePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/webAppSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/iisWebApplications` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("top")) + if err != nil { + return nil, err + } + topParam := getOptional(topUnescaped) + continuationTokenUnescaped, err := url.QueryUnescape(qp.Get("continuationToken")) + if err != nil { + return nil, err + } + continuationTokenParam := getOptional(continuationTokenUnescaped) + totalRecordCountUnescaped, err := url.QueryUnescape(qp.Get("totalRecordCount")) + if err != nil { + return nil, err + } + totalRecordCountParam, err := parseOptional(totalRecordCountUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + webAppSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("webAppSiteName")]) + if err != nil { + return nil, err + } + var options *armmigrate.IisWebApplicationsControllerClientListByWebAppSiteOptions + if filterParam != nil || topParam != nil || continuationTokenParam != nil || totalRecordCountParam != nil { + options = &armmigrate.IisWebApplicationsControllerClientListByWebAppSiteOptions{ + Filter: filterParam, + Top: topParam, + ContinuationToken: continuationTokenParam, + TotalRecordCount: totalRecordCountParam, + } + } + resp := i.srv.NewListByWebAppSitePager(resourceGroupNameParam, siteNameParam, webAppSiteNameParam, options) + newListByWebAppSitePager = &resp + i.newListByWebAppSitePager.add(req, newListByWebAppSitePager) + server.PagerResponderInjectNextLinks(newListByWebAppSitePager, req, func(page *armmigrate.IisWebApplicationsControllerClientListByWebAppSiteResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByWebAppSitePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + i.newListByWebAppSitePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByWebAppSitePager) { + i.newListByWebAppSitePager.remove(req) + } + return resp, nil +} + +func (i *IisWebApplicationsControllerServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if i.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/webAppSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/iisWebApplications/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.IisWebApplicationsUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + webAppSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("webAppSiteName")]) + if err != nil { + return nil, err + } + webApplicationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("webApplicationName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.Update(req.Context(), resourceGroupNameParam, siteNameParam, webAppSiteNameParam, webApplicationNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).IisWebApplications, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/iiswebserverscontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/iiswebserverscontroller_server.go new file mode 100644 index 000000000000..3a84597762a3 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/iiswebserverscontroller_server.go @@ -0,0 +1,204 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// IisWebServersControllerServer is a fake server for instances of the armmigrate.IisWebServersControllerClient type. +type IisWebServersControllerServer struct { + // Get is the fake for method IisWebServersControllerClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, webServerName string, options *armmigrate.IisWebServersControllerClientGetOptions) (resp azfake.Responder[armmigrate.IisWebServersControllerClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByWebAppSitePager is the fake for method IisWebServersControllerClient.NewListByWebAppSitePager + // HTTP status codes to indicate success: http.StatusOK + NewListByWebAppSitePager func(resourceGroupName string, siteName string, webAppSiteName string, options *armmigrate.IisWebServersControllerClientListByWebAppSiteOptions) (resp azfake.PagerResponder[armmigrate.IisWebServersControllerClientListByWebAppSiteResponse]) +} + +// NewIisWebServersControllerServerTransport creates a new instance of IisWebServersControllerServerTransport with the provided implementation. +// The returned IisWebServersControllerServerTransport instance is connected to an instance of armmigrate.IisWebServersControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewIisWebServersControllerServerTransport(srv *IisWebServersControllerServer) *IisWebServersControllerServerTransport { + return &IisWebServersControllerServerTransport{ + srv: srv, + newListByWebAppSitePager: newTracker[azfake.PagerResponder[armmigrate.IisWebServersControllerClientListByWebAppSiteResponse]](), + } +} + +// IisWebServersControllerServerTransport connects instances of armmigrate.IisWebServersControllerClient to instances of IisWebServersControllerServer. +// Don't use this type directly, use NewIisWebServersControllerServerTransport instead. +type IisWebServersControllerServerTransport struct { + srv *IisWebServersControllerServer + newListByWebAppSitePager *tracker[azfake.PagerResponder[armmigrate.IisWebServersControllerClientListByWebAppSiteResponse]] +} + +// Do implements the policy.Transporter interface for IisWebServersControllerServerTransport. +func (i *IisWebServersControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "IisWebServersControllerClient.Get": + resp, err = i.dispatchGet(req) + case "IisWebServersControllerClient.NewListByWebAppSitePager": + resp, err = i.dispatchNewListByWebAppSitePager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (i *IisWebServersControllerServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if i.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/webAppSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/iisWebServers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + webAppSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("webAppSiteName")]) + if err != nil { + return nil, err + } + webServerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("webServerName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.Get(req.Context(), resourceGroupNameParam, siteNameParam, webAppSiteNameParam, webServerNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).IisWebServers, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (i *IisWebServersControllerServerTransport) dispatchNewListByWebAppSitePager(req *http.Request) (*http.Response, error) { + if i.srv.NewListByWebAppSitePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByWebAppSitePager not implemented")} + } + newListByWebAppSitePager := i.newListByWebAppSitePager.get(req) + if newListByWebAppSitePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/webAppSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/iisWebServers` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("top")) + if err != nil { + return nil, err + } + topParam := getOptional(topUnescaped) + continuationTokenUnescaped, err := url.QueryUnescape(qp.Get("continuationToken")) + if err != nil { + return nil, err + } + continuationTokenParam := getOptional(continuationTokenUnescaped) + totalRecordCountUnescaped, err := url.QueryUnescape(qp.Get("totalRecordCount")) + if err != nil { + return nil, err + } + totalRecordCountParam, err := parseOptional(totalRecordCountUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + webAppSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("webAppSiteName")]) + if err != nil { + return nil, err + } + var options *armmigrate.IisWebServersControllerClientListByWebAppSiteOptions + if filterParam != nil || topParam != nil || continuationTokenParam != nil || totalRecordCountParam != nil { + options = &armmigrate.IisWebServersControllerClientListByWebAppSiteOptions{ + Filter: filterParam, + Top: topParam, + ContinuationToken: continuationTokenParam, + TotalRecordCount: totalRecordCountParam, + } + } + resp := i.srv.NewListByWebAppSitePager(resourceGroupNameParam, siteNameParam, webAppSiteNameParam, options) + newListByWebAppSitePager = &resp + i.newListByWebAppSitePager.add(req, newListByWebAppSitePager) + server.PagerResponderInjectNextLinks(newListByWebAppSitePager, req, func(page *armmigrate.IisWebServersControllerClientListByWebAppSiteResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByWebAppSitePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + i.newListByWebAppSitePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByWebAppSitePager) { + i.newListByWebAppSitePager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/importcollectors_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/importcollectors_server.go deleted file mode 100644 index 836bfd4b48bb..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/fake/importcollectors_server.go +++ /dev/null @@ -1,258 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" - "net/http" - "net/url" - "reflect" - "regexp" -) - -// ImportCollectorsServer is a fake server for instances of the armmigrate.ImportCollectorsClient type. -type ImportCollectorsServer struct { - // Create is the fake for method ImportCollectorsClient.Create - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - Create func(ctx context.Context, resourceGroupName string, projectName string, importCollectorName string, options *armmigrate.ImportCollectorsClientCreateOptions) (resp azfake.Responder[armmigrate.ImportCollectorsClientCreateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method ImportCollectorsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, projectName string, importCollectorName string, options *armmigrate.ImportCollectorsClientDeleteOptions) (resp azfake.Responder[armmigrate.ImportCollectorsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method ImportCollectorsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, projectName string, importCollectorName string, options *armmigrate.ImportCollectorsClientGetOptions) (resp azfake.Responder[armmigrate.ImportCollectorsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByProjectPager is the fake for method ImportCollectorsClient.NewListByProjectPager - // HTTP status codes to indicate success: http.StatusOK - NewListByProjectPager func(resourceGroupName string, projectName string, options *armmigrate.ImportCollectorsClientListByProjectOptions) (resp azfake.PagerResponder[armmigrate.ImportCollectorsClientListByProjectResponse]) -} - -// NewImportCollectorsServerTransport creates a new instance of ImportCollectorsServerTransport with the provided implementation. -// The returned ImportCollectorsServerTransport instance is connected to an instance of armmigrate.ImportCollectorsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewImportCollectorsServerTransport(srv *ImportCollectorsServer) *ImportCollectorsServerTransport { - return &ImportCollectorsServerTransport{ - srv: srv, - newListByProjectPager: newTracker[azfake.PagerResponder[armmigrate.ImportCollectorsClientListByProjectResponse]](), - } -} - -// ImportCollectorsServerTransport connects instances of armmigrate.ImportCollectorsClient to instances of ImportCollectorsServer. -// Don't use this type directly, use NewImportCollectorsServerTransport instead. -type ImportCollectorsServerTransport struct { - srv *ImportCollectorsServer - newListByProjectPager *tracker[azfake.PagerResponder[armmigrate.ImportCollectorsClientListByProjectResponse]] -} - -// Do implements the policy.Transporter interface for ImportCollectorsServerTransport. -func (i *ImportCollectorsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "ImportCollectorsClient.Create": - resp, err = i.dispatchCreate(req) - case "ImportCollectorsClient.Delete": - resp, err = i.dispatchDelete(req) - case "ImportCollectorsClient.Get": - resp, err = i.dispatchGet(req) - case "ImportCollectorsClient.NewListByProjectPager": - resp, err = i.dispatchNewListByProjectPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (i *ImportCollectorsServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { - if i.srv.Create == nil { - return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/importcollectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmigrate.ImportCollector](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - importCollectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("importCollectorName")]) - if err != nil { - return nil, err - } - var options *armmigrate.ImportCollectorsClientCreateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armmigrate.ImportCollectorsClientCreateOptions{ - CollectorBody: &body, - } - } - respr, errRespr := i.srv.Create(req.Context(), resourceGroupNameParam, projectNameParam, importCollectorNameParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ImportCollector, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (i *ImportCollectorsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if i.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/importcollectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - importCollectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("importCollectorName")]) - if err != nil { - return nil, err - } - respr, errRespr := i.srv.Delete(req.Context(), resourceGroupNameParam, projectNameParam, importCollectorNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (i *ImportCollectorsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if i.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/importcollectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - importCollectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("importCollectorName")]) - if err != nil { - return nil, err - } - respr, errRespr := i.srv.Get(req.Context(), resourceGroupNameParam, projectNameParam, importCollectorNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ImportCollector, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (i *ImportCollectorsServerTransport) dispatchNewListByProjectPager(req *http.Request) (*http.Response, error) { - if i.srv.NewListByProjectPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByProjectPager not implemented")} - } - newListByProjectPager := i.newListByProjectPager.get(req) - if newListByProjectPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/importcollectors` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - resp := i.srv.NewListByProjectPager(resourceGroupNameParam, projectNameParam, nil) - newListByProjectPager = &resp - i.newListByProjectPager.add(req, newListByProjectPager) - } - resp, err := server.PagerResponderNext(newListByProjectPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - i.newListByProjectPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByProjectPager) { - i.newListByProjectPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/importjobscontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/importjobscontroller_server.go new file mode 100644 index 000000000000..a1f4f720dfd7 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/importjobscontroller_server.go @@ -0,0 +1,432 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" +) + +// ImportJobsControllerServer is a fake server for instances of the armmigrate.ImportJobsControllerClient type. +type ImportJobsControllerServer struct { + // Get is the fake for method ImportJobsControllerClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, siteName string, jobName string, options *armmigrate.ImportJobsControllerClientGetOptions) (resp azfake.Responder[armmigrate.ImportJobsControllerClientGetResponse], errResp azfake.ErrorResponder) + + // GetDeletejob is the fake for method ImportJobsControllerClient.GetDeletejob + // HTTP status codes to indicate success: http.StatusOK + GetDeletejob func(ctx context.Context, resourceGroupName string, siteName string, jobName string, options *armmigrate.ImportJobsControllerClientGetDeletejobOptions) (resp azfake.Responder[armmigrate.ImportJobsControllerClientGetDeletejobResponse], errResp azfake.ErrorResponder) + + // GetExportjob is the fake for method ImportJobsControllerClient.GetExportjob + // HTTP status codes to indicate success: http.StatusOK + GetExportjob func(ctx context.Context, resourceGroupName string, siteName string, jobName string, options *armmigrate.ImportJobsControllerClientGetExportjobOptions) (resp azfake.Responder[armmigrate.ImportJobsControllerClientGetExportjobResponse], errResp azfake.ErrorResponder) + + // GetImportjob is the fake for method ImportJobsControllerClient.GetImportjob + // HTTP status codes to indicate success: http.StatusOK + GetImportjob func(ctx context.Context, resourceGroupName string, siteName string, jobName string, options *armmigrate.ImportJobsControllerClientGetImportjobOptions) (resp azfake.Responder[armmigrate.ImportJobsControllerClientGetImportjobResponse], errResp azfake.ErrorResponder) + + // NewListByImportSitePager is the fake for method ImportJobsControllerClient.NewListByImportSitePager + // HTTP status codes to indicate success: http.StatusOK + NewListByImportSitePager func(resourceGroupName string, siteName string, options *armmigrate.ImportJobsControllerClientListByImportSiteOptions) (resp azfake.PagerResponder[armmigrate.ImportJobsControllerClientListByImportSiteResponse]) + + // NewListDeletejobsPager is the fake for method ImportJobsControllerClient.NewListDeletejobsPager + // HTTP status codes to indicate success: http.StatusOK + NewListDeletejobsPager func(resourceGroupName string, siteName string, options *armmigrate.ImportJobsControllerClientListDeletejobsOptions) (resp azfake.PagerResponder[armmigrate.ImportJobsControllerClientListDeletejobsResponse]) + + // NewListExportjobsPager is the fake for method ImportJobsControllerClient.NewListExportjobsPager + // HTTP status codes to indicate success: http.StatusOK + NewListExportjobsPager func(resourceGroupName string, siteName string, options *armmigrate.ImportJobsControllerClientListExportjobsOptions) (resp azfake.PagerResponder[armmigrate.ImportJobsControllerClientListExportjobsResponse]) + + // NewListImportjobsPager is the fake for method ImportJobsControllerClient.NewListImportjobsPager + // HTTP status codes to indicate success: http.StatusOK + NewListImportjobsPager func(resourceGroupName string, siteName string, options *armmigrate.ImportJobsControllerClientListImportjobsOptions) (resp azfake.PagerResponder[armmigrate.ImportJobsControllerClientListImportjobsResponse]) +} + +// NewImportJobsControllerServerTransport creates a new instance of ImportJobsControllerServerTransport with the provided implementation. +// The returned ImportJobsControllerServerTransport instance is connected to an instance of armmigrate.ImportJobsControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewImportJobsControllerServerTransport(srv *ImportJobsControllerServer) *ImportJobsControllerServerTransport { + return &ImportJobsControllerServerTransport{ + srv: srv, + newListByImportSitePager: newTracker[azfake.PagerResponder[armmigrate.ImportJobsControllerClientListByImportSiteResponse]](), + newListDeletejobsPager: newTracker[azfake.PagerResponder[armmigrate.ImportJobsControllerClientListDeletejobsResponse]](), + newListExportjobsPager: newTracker[azfake.PagerResponder[armmigrate.ImportJobsControllerClientListExportjobsResponse]](), + newListImportjobsPager: newTracker[azfake.PagerResponder[armmigrate.ImportJobsControllerClientListImportjobsResponse]](), + } +} + +// ImportJobsControllerServerTransport connects instances of armmigrate.ImportJobsControllerClient to instances of ImportJobsControllerServer. +// Don't use this type directly, use NewImportJobsControllerServerTransport instead. +type ImportJobsControllerServerTransport struct { + srv *ImportJobsControllerServer + newListByImportSitePager *tracker[azfake.PagerResponder[armmigrate.ImportJobsControllerClientListByImportSiteResponse]] + newListDeletejobsPager *tracker[azfake.PagerResponder[armmigrate.ImportJobsControllerClientListDeletejobsResponse]] + newListExportjobsPager *tracker[azfake.PagerResponder[armmigrate.ImportJobsControllerClientListExportjobsResponse]] + newListImportjobsPager *tracker[azfake.PagerResponder[armmigrate.ImportJobsControllerClientListImportjobsResponse]] +} + +// Do implements the policy.Transporter interface for ImportJobsControllerServerTransport. +func (i *ImportJobsControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ImportJobsControllerClient.Get": + resp, err = i.dispatchGet(req) + case "ImportJobsControllerClient.GetDeletejob": + resp, err = i.dispatchGetDeletejob(req) + case "ImportJobsControllerClient.GetExportjob": + resp, err = i.dispatchGetExportjob(req) + case "ImportJobsControllerClient.GetImportjob": + resp, err = i.dispatchGetImportjob(req) + case "ImportJobsControllerClient.NewListByImportSitePager": + resp, err = i.dispatchNewListByImportSitePager(req) + case "ImportJobsControllerClient.NewListDeletejobsPager": + resp, err = i.dispatchNewListDeletejobsPager(req) + case "ImportJobsControllerClient.NewListExportjobsPager": + resp, err = i.dispatchNewListExportjobsPager(req) + case "ImportJobsControllerClient.NewListImportjobsPager": + resp, err = i.dispatchNewListImportjobsPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (i *ImportJobsControllerServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if i.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/importSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/jobs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + jobNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("jobName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.Get(req.Context(), resourceGroupNameParam, siteNameParam, jobNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ImportJob, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (i *ImportJobsControllerServerTransport) dispatchGetDeletejob(req *http.Request) (*http.Response, error) { + if i.srv.GetDeletejob == nil { + return nil, &nonRetriableError{errors.New("fake for method GetDeletejob not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/importSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/deleteJobs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + jobNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("jobName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.GetDeletejob(req.Context(), resourceGroupNameParam, siteNameParam, jobNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DeleteImportMachinesJob, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (i *ImportJobsControllerServerTransport) dispatchGetExportjob(req *http.Request) (*http.Response, error) { + if i.srv.GetExportjob == nil { + return nil, &nonRetriableError{errors.New("fake for method GetExportjob not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/importSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/exportJobs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + jobNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("jobName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.GetExportjob(req.Context(), resourceGroupNameParam, siteNameParam, jobNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ExportImportedMachinesJob, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (i *ImportJobsControllerServerTransport) dispatchGetImportjob(req *http.Request) (*http.Response, error) { + if i.srv.GetImportjob == nil { + return nil, &nonRetriableError{errors.New("fake for method GetImportjob not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/importSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/importJobs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + jobNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("jobName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.GetImportjob(req.Context(), resourceGroupNameParam, siteNameParam, jobNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ImportMachinesJob, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (i *ImportJobsControllerServerTransport) dispatchNewListByImportSitePager(req *http.Request) (*http.Response, error) { + if i.srv.NewListByImportSitePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByImportSitePager not implemented")} + } + newListByImportSitePager := i.newListByImportSitePager.get(req) + if newListByImportSitePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/importSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/jobs` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + resp := i.srv.NewListByImportSitePager(resourceGroupNameParam, siteNameParam, nil) + newListByImportSitePager = &resp + i.newListByImportSitePager.add(req, newListByImportSitePager) + server.PagerResponderInjectNextLinks(newListByImportSitePager, req, func(page *armmigrate.ImportJobsControllerClientListByImportSiteResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByImportSitePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + i.newListByImportSitePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByImportSitePager) { + i.newListByImportSitePager.remove(req) + } + return resp, nil +} + +func (i *ImportJobsControllerServerTransport) dispatchNewListDeletejobsPager(req *http.Request) (*http.Response, error) { + if i.srv.NewListDeletejobsPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListDeletejobsPager not implemented")} + } + newListDeletejobsPager := i.newListDeletejobsPager.get(req) + if newListDeletejobsPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/importSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/deleteJobs` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + resp := i.srv.NewListDeletejobsPager(resourceGroupNameParam, siteNameParam, nil) + newListDeletejobsPager = &resp + i.newListDeletejobsPager.add(req, newListDeletejobsPager) + server.PagerResponderInjectNextLinks(newListDeletejobsPager, req, func(page *armmigrate.ImportJobsControllerClientListDeletejobsResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListDeletejobsPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + i.newListDeletejobsPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListDeletejobsPager) { + i.newListDeletejobsPager.remove(req) + } + return resp, nil +} + +func (i *ImportJobsControllerServerTransport) dispatchNewListExportjobsPager(req *http.Request) (*http.Response, error) { + if i.srv.NewListExportjobsPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListExportjobsPager not implemented")} + } + newListExportjobsPager := i.newListExportjobsPager.get(req) + if newListExportjobsPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/importSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/exportJobs` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + resp := i.srv.NewListExportjobsPager(resourceGroupNameParam, siteNameParam, nil) + newListExportjobsPager = &resp + i.newListExportjobsPager.add(req, newListExportjobsPager) + server.PagerResponderInjectNextLinks(newListExportjobsPager, req, func(page *armmigrate.ImportJobsControllerClientListExportjobsResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListExportjobsPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + i.newListExportjobsPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListExportjobsPager) { + i.newListExportjobsPager.remove(req) + } + return resp, nil +} + +func (i *ImportJobsControllerServerTransport) dispatchNewListImportjobsPager(req *http.Request) (*http.Response, error) { + if i.srv.NewListImportjobsPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListImportjobsPager not implemented")} + } + newListImportjobsPager := i.newListImportjobsPager.get(req) + if newListImportjobsPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/importSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/importJobs` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + resp := i.srv.NewListImportjobsPager(resourceGroupNameParam, siteNameParam, nil) + newListImportjobsPager = &resp + i.newListImportjobsPager.add(req, newListImportjobsPager) + server.PagerResponderInjectNextLinks(newListImportjobsPager, req, func(page *armmigrate.ImportJobsControllerClientListImportjobsResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListImportjobsPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + i.newListImportjobsPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListImportjobsPager) { + i.newListImportjobsPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/importmachinescontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/importmachinescontroller_server.go new file mode 100644 index 000000000000..36cd4889b512 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/importmachinescontroller_server.go @@ -0,0 +1,239 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// ImportMachinesControllerServer is a fake server for instances of the armmigrate.ImportMachinesControllerClient type. +type ImportMachinesControllerServer struct { + // Delete is the fake for method ImportMachinesControllerClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, siteName string, machineName string, options *armmigrate.ImportMachinesControllerClientDeleteOptions) (resp azfake.Responder[armmigrate.ImportMachinesControllerClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ImportMachinesControllerClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, siteName string, machineName string, options *armmigrate.ImportMachinesControllerClientGetOptions) (resp azfake.Responder[armmigrate.ImportMachinesControllerClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByImportSitePager is the fake for method ImportMachinesControllerClient.NewListByImportSitePager + // HTTP status codes to indicate success: http.StatusOK + NewListByImportSitePager func(resourceGroupName string, siteName string, options *armmigrate.ImportMachinesControllerClientListByImportSiteOptions) (resp azfake.PagerResponder[armmigrate.ImportMachinesControllerClientListByImportSiteResponse]) +} + +// NewImportMachinesControllerServerTransport creates a new instance of ImportMachinesControllerServerTransport with the provided implementation. +// The returned ImportMachinesControllerServerTransport instance is connected to an instance of armmigrate.ImportMachinesControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewImportMachinesControllerServerTransport(srv *ImportMachinesControllerServer) *ImportMachinesControllerServerTransport { + return &ImportMachinesControllerServerTransport{ + srv: srv, + newListByImportSitePager: newTracker[azfake.PagerResponder[armmigrate.ImportMachinesControllerClientListByImportSiteResponse]](), + } +} + +// ImportMachinesControllerServerTransport connects instances of armmigrate.ImportMachinesControllerClient to instances of ImportMachinesControllerServer. +// Don't use this type directly, use NewImportMachinesControllerServerTransport instead. +type ImportMachinesControllerServerTransport struct { + srv *ImportMachinesControllerServer + newListByImportSitePager *tracker[azfake.PagerResponder[armmigrate.ImportMachinesControllerClientListByImportSiteResponse]] +} + +// Do implements the policy.Transporter interface for ImportMachinesControllerServerTransport. +func (i *ImportMachinesControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ImportMachinesControllerClient.Delete": + resp, err = i.dispatchDelete(req) + case "ImportMachinesControllerClient.Get": + resp, err = i.dispatchGet(req) + case "ImportMachinesControllerClient.NewListByImportSitePager": + resp, err = i.dispatchNewListByImportSitePager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (i *ImportMachinesControllerServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if i.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/importSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/machines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + machineNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("machineName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.Delete(req.Context(), resourceGroupNameParam, siteNameParam, machineNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (i *ImportMachinesControllerServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if i.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/importSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/machines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + machineNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("machineName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.Get(req.Context(), resourceGroupNameParam, siteNameParam, machineNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ImportMachine, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (i *ImportMachinesControllerServerTransport) dispatchNewListByImportSitePager(req *http.Request) (*http.Response, error) { + if i.srv.NewListByImportSitePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByImportSitePager not implemented")} + } + newListByImportSitePager := i.newListByImportSitePager.get(req) + if newListByImportSitePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/importSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/machines` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("top")) + if err != nil { + return nil, err + } + topParam := getOptional(topUnescaped) + continuationTokenUnescaped, err := url.QueryUnescape(qp.Get("continuationToken")) + if err != nil { + return nil, err + } + continuationTokenParam := getOptional(continuationTokenUnescaped) + totalRecordCountUnescaped, err := url.QueryUnescape(qp.Get("totalRecordCount")) + if err != nil { + return nil, err + } + totalRecordCountParam, err := parseOptional(totalRecordCountUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + var options *armmigrate.ImportMachinesControllerClientListByImportSiteOptions + if filterParam != nil || topParam != nil || continuationTokenParam != nil || totalRecordCountParam != nil { + options = &armmigrate.ImportMachinesControllerClientListByImportSiteOptions{ + Filter: filterParam, + Top: topParam, + ContinuationToken: continuationTokenParam, + TotalRecordCount: totalRecordCountParam, + } + } + resp := i.srv.NewListByImportSitePager(resourceGroupNameParam, siteNameParam, options) + newListByImportSitePager = &resp + i.newListByImportSitePager.add(req, newListByImportSitePager) + server.PagerResponderInjectNextLinks(newListByImportSitePager, req, func(page *armmigrate.ImportMachinesControllerClientListByImportSiteResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByImportSitePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + i.newListByImportSitePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByImportSitePager) { + i.newListByImportSitePager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/importsitescontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/importsitescontroller_server.go new file mode 100644 index 000000000000..e8d4640d5ba1 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/importsitescontroller_server.go @@ -0,0 +1,447 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// ImportSitesControllerServer is a fake server for instances of the armmigrate.ImportSitesControllerClient type. +type ImportSitesControllerServer struct { + // Create is the fake for method ImportSitesControllerClient.Create + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + Create func(ctx context.Context, resourceGroupName string, siteName string, body armmigrate.ImportSite, options *armmigrate.ImportSitesControllerClientCreateOptions) (resp azfake.Responder[armmigrate.ImportSitesControllerClientCreateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method ImportSitesControllerClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, siteName string, options *armmigrate.ImportSitesControllerClientDeleteOptions) (resp azfake.Responder[armmigrate.ImportSitesControllerClientDeleteResponse], errResp azfake.ErrorResponder) + + // DeleteImportedMachines is the fake for method ImportSitesControllerClient.DeleteImportedMachines + // HTTP status codes to indicate success: http.StatusOK + DeleteImportedMachines func(ctx context.Context, resourceGroupName string, siteName string, body any, options *armmigrate.ImportSitesControllerClientDeleteImportedMachinesOptions) (resp azfake.Responder[armmigrate.ImportSitesControllerClientDeleteImportedMachinesResponse], errResp azfake.ErrorResponder) + + // ExportURI is the fake for method ImportSitesControllerClient.ExportURI + // HTTP status codes to indicate success: http.StatusOK + ExportURI func(ctx context.Context, resourceGroupName string, siteName string, body armmigrate.SasURIResponse, options *armmigrate.ImportSitesControllerClientExportURIOptions) (resp azfake.Responder[armmigrate.ImportSitesControllerClientExportURIResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ImportSitesControllerClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, siteName string, options *armmigrate.ImportSitesControllerClientGetOptions) (resp azfake.Responder[armmigrate.ImportSitesControllerClientGetResponse], errResp azfake.ErrorResponder) + + // ImportURI is the fake for method ImportSitesControllerClient.ImportURI + // HTTP status codes to indicate success: http.StatusOK + ImportURI func(ctx context.Context, resourceGroupName string, siteName string, body armmigrate.SasURIResponse, options *armmigrate.ImportSitesControllerClientImportURIOptions) (resp azfake.Responder[armmigrate.ImportSitesControllerClientImportURIResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method ImportSitesControllerClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armmigrate.ImportSitesControllerClientListByResourceGroupOptions) (resp azfake.PagerResponder[armmigrate.ImportSitesControllerClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method ImportSitesControllerClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armmigrate.ImportSitesControllerClientListBySubscriptionOptions) (resp azfake.PagerResponder[armmigrate.ImportSitesControllerClientListBySubscriptionResponse]) + + // Update is the fake for method ImportSitesControllerClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, siteName string, body armmigrate.ImportSiteUpdate, options *armmigrate.ImportSitesControllerClientUpdateOptions) (resp azfake.Responder[armmigrate.ImportSitesControllerClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewImportSitesControllerServerTransport creates a new instance of ImportSitesControllerServerTransport with the provided implementation. +// The returned ImportSitesControllerServerTransport instance is connected to an instance of armmigrate.ImportSitesControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewImportSitesControllerServerTransport(srv *ImportSitesControllerServer) *ImportSitesControllerServerTransport { + return &ImportSitesControllerServerTransport{ + srv: srv, + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armmigrate.ImportSitesControllerClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armmigrate.ImportSitesControllerClientListBySubscriptionResponse]](), + } +} + +// ImportSitesControllerServerTransport connects instances of armmigrate.ImportSitesControllerClient to instances of ImportSitesControllerServer. +// Don't use this type directly, use NewImportSitesControllerServerTransport instead. +type ImportSitesControllerServerTransport struct { + srv *ImportSitesControllerServer + newListByResourceGroupPager *tracker[azfake.PagerResponder[armmigrate.ImportSitesControllerClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armmigrate.ImportSitesControllerClientListBySubscriptionResponse]] +} + +// Do implements the policy.Transporter interface for ImportSitesControllerServerTransport. +func (i *ImportSitesControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ImportSitesControllerClient.Create": + resp, err = i.dispatchCreate(req) + case "ImportSitesControllerClient.Delete": + resp, err = i.dispatchDelete(req) + case "ImportSitesControllerClient.DeleteImportedMachines": + resp, err = i.dispatchDeleteImportedMachines(req) + case "ImportSitesControllerClient.ExportURI": + resp, err = i.dispatchExportURI(req) + case "ImportSitesControllerClient.Get": + resp, err = i.dispatchGet(req) + case "ImportSitesControllerClient.ImportURI": + resp, err = i.dispatchImportURI(req) + case "ImportSitesControllerClient.NewListByResourceGroupPager": + resp, err = i.dispatchNewListByResourceGroupPager(req) + case "ImportSitesControllerClient.NewListBySubscriptionPager": + resp, err = i.dispatchNewListBySubscriptionPager(req) + case "ImportSitesControllerClient.Update": + resp, err = i.dispatchUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (i *ImportSitesControllerServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { + if i.srv.Create == nil { + return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/importSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.ImportSite](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.Create(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ImportSite, req) + if err != nil { + return nil, err + } + if val := server.GetResponse(respr).RetryAfter; val != nil { + resp.Header.Set("Retry-After", strconv.FormatInt(int64(*val), 10)) + } + return resp, nil +} + +func (i *ImportSitesControllerServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if i.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/importSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.Delete(req.Context(), resourceGroupNameParam, siteNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (i *ImportSitesControllerServerTransport) dispatchDeleteImportedMachines(req *http.Request) (*http.Response, error) { + if i.srv.DeleteImportedMachines == nil { + return nil, &nonRetriableError{errors.New("fake for method DeleteImportedMachines not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/importSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/deleteImportedMachines` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[any](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.DeleteImportedMachines(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SasURIResponse, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (i *ImportSitesControllerServerTransport) dispatchExportURI(req *http.Request) (*http.Response, error) { + if i.srv.ExportURI == nil { + return nil, &nonRetriableError{errors.New("fake for method ExportURI not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/importSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/exportUri` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.SasURIResponse](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.ExportURI(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SasURIResponse, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (i *ImportSitesControllerServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if i.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/importSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.Get(req.Context(), resourceGroupNameParam, siteNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ImportSite, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (i *ImportSitesControllerServerTransport) dispatchImportURI(req *http.Request) (*http.Response, error) { + if i.srv.ImportURI == nil { + return nil, &nonRetriableError{errors.New("fake for method ImportURI not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/importSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/importUri` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.SasURIResponse](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.ImportURI(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SasURIResponse, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (i *ImportSitesControllerServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if i.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := i.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/importSites` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resp := i.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + i.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armmigrate.ImportSitesControllerClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + i.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + i.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (i *ImportSitesControllerServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if i.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := i.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/importSites` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resp := i.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + i.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armmigrate.ImportSitesControllerClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + i.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + i.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (i *ImportSitesControllerServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if i.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/importSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.ImportSiteUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.Update(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ImportSite, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/internal.go b/sdk/resourcemanager/migrate/armmigrate/fake/internal.go index 5f75802a569e..72f540f217a1 100644 --- a/sdk/resourcemanager/migrate/armmigrate/fake/internal.go +++ b/sdk/resourcemanager/migrate/armmigrate/fake/internal.go @@ -11,6 +11,7 @@ package fake import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "net/http" + "reflect" "sync" ) @@ -31,6 +32,32 @@ func contains[T comparable](s []T, v T) bool { return false } +func getOptional[T any](v T) *T { + if reflect.ValueOf(v).IsZero() { + return nil + } + return &v +} + +func parseOptional[T any](v string, parse func(v string) (T, error)) (*T, error) { + if v == "" { + return nil, nil + } + t, err := parse(v) + if err != nil { + return nil, err + } + return &t, err +} + +func parseWithCast[T any](v string, parse func(v string) (T, error)) (T, error) { + t, err := parse(v) + if err != nil { + return *new(T), err + } + return t, err +} + func newTracker[T any]() *tracker[T] { return &tracker[T]{ items: map[string]*T{}, diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/machines_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/machines_server.go deleted file mode 100644 index 6beefa2d10a2..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/fake/machines_server.go +++ /dev/null @@ -1,159 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" - "net/http" - "net/url" - "regexp" -) - -// MachinesServer is a fake server for instances of the armmigrate.MachinesClient type. -type MachinesServer struct { - // Get is the fake for method MachinesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, projectName string, machineName string, options *armmigrate.MachinesClientGetOptions) (resp azfake.Responder[armmigrate.MachinesClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByProjectPager is the fake for method MachinesClient.NewListByProjectPager - // HTTP status codes to indicate success: http.StatusOK - NewListByProjectPager func(resourceGroupName string, projectName string, options *armmigrate.MachinesClientListByProjectOptions) (resp azfake.PagerResponder[armmigrate.MachinesClientListByProjectResponse]) -} - -// NewMachinesServerTransport creates a new instance of MachinesServerTransport with the provided implementation. -// The returned MachinesServerTransport instance is connected to an instance of armmigrate.MachinesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewMachinesServerTransport(srv *MachinesServer) *MachinesServerTransport { - return &MachinesServerTransport{ - srv: srv, - newListByProjectPager: newTracker[azfake.PagerResponder[armmigrate.MachinesClientListByProjectResponse]](), - } -} - -// MachinesServerTransport connects instances of armmigrate.MachinesClient to instances of MachinesServer. -// Don't use this type directly, use NewMachinesServerTransport instead. -type MachinesServerTransport struct { - srv *MachinesServer - newListByProjectPager *tracker[azfake.PagerResponder[armmigrate.MachinesClientListByProjectResponse]] -} - -// Do implements the policy.Transporter interface for MachinesServerTransport. -func (m *MachinesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "MachinesClient.Get": - resp, err = m.dispatchGet(req) - case "MachinesClient.NewListByProjectPager": - resp, err = m.dispatchNewListByProjectPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (m *MachinesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if m.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/machines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - machineNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("machineName")]) - if err != nil { - return nil, err - } - respr, errRespr := m.srv.Get(req.Context(), resourceGroupNameParam, projectNameParam, machineNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Machine, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (m *MachinesServerTransport) dispatchNewListByProjectPager(req *http.Request) (*http.Response, error) { - if m.srv.NewListByProjectPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByProjectPager not implemented")} - } - newListByProjectPager := m.newListByProjectPager.get(req) - if newListByProjectPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/machines` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - resp := m.srv.NewListByProjectPager(resourceGroupNameParam, projectNameParam, nil) - newListByProjectPager = &resp - m.newListByProjectPager.add(req, newListByProjectPager) - server.PagerResponderInjectNextLinks(newListByProjectPager, req, func(page *armmigrate.MachinesClientListByProjectResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListByProjectPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - m.newListByProjectPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByProjectPager) { - m.newListByProjectPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/machinescontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/machinescontroller_server.go new file mode 100644 index 000000000000..7ba683ab8ebd --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/machinescontroller_server.go @@ -0,0 +1,364 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// MachinesControllerServer is a fake server for instances of the armmigrate.MachinesControllerClient type. +type MachinesControllerServer struct { + // Get is the fake for method MachinesControllerClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, siteName string, machineName string, options *armmigrate.MachinesControllerClientGetOptions) (resp azfake.Responder[armmigrate.MachinesControllerClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByVmwareSitePager is the fake for method MachinesControllerClient.NewListByVmwareSitePager + // HTTP status codes to indicate success: http.StatusOK + NewListByVmwareSitePager func(resourceGroupName string, siteName string, options *armmigrate.MachinesControllerClientListByVmwareSiteOptions) (resp azfake.PagerResponder[armmigrate.MachinesControllerClientListByVmwareSiteResponse]) + + // BeginStart is the fake for method MachinesControllerClient.BeginStart + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginStart func(ctx context.Context, resourceGroupName string, siteName string, machineName string, options *armmigrate.MachinesControllerClientBeginStartOptions) (resp azfake.PollerResponder[armmigrate.MachinesControllerClientStartResponse], errResp azfake.ErrorResponder) + + // BeginStop is the fake for method MachinesControllerClient.BeginStop + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginStop func(ctx context.Context, resourceGroupName string, siteName string, machineName string, options *armmigrate.MachinesControllerClientBeginStopOptions) (resp azfake.PollerResponder[armmigrate.MachinesControllerClientStopResponse], errResp azfake.ErrorResponder) + + // Update is the fake for method MachinesControllerClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, siteName string, machineName string, body armmigrate.MachineResourceUpdate, options *armmigrate.MachinesControllerClientUpdateOptions) (resp azfake.Responder[armmigrate.MachinesControllerClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewMachinesControllerServerTransport creates a new instance of MachinesControllerServerTransport with the provided implementation. +// The returned MachinesControllerServerTransport instance is connected to an instance of armmigrate.MachinesControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewMachinesControllerServerTransport(srv *MachinesControllerServer) *MachinesControllerServerTransport { + return &MachinesControllerServerTransport{ + srv: srv, + newListByVmwareSitePager: newTracker[azfake.PagerResponder[armmigrate.MachinesControllerClientListByVmwareSiteResponse]](), + beginStart: newTracker[azfake.PollerResponder[armmigrate.MachinesControllerClientStartResponse]](), + beginStop: newTracker[azfake.PollerResponder[armmigrate.MachinesControllerClientStopResponse]](), + } +} + +// MachinesControllerServerTransport connects instances of armmigrate.MachinesControllerClient to instances of MachinesControllerServer. +// Don't use this type directly, use NewMachinesControllerServerTransport instead. +type MachinesControllerServerTransport struct { + srv *MachinesControllerServer + newListByVmwareSitePager *tracker[azfake.PagerResponder[armmigrate.MachinesControllerClientListByVmwareSiteResponse]] + beginStart *tracker[azfake.PollerResponder[armmigrate.MachinesControllerClientStartResponse]] + beginStop *tracker[azfake.PollerResponder[armmigrate.MachinesControllerClientStopResponse]] +} + +// Do implements the policy.Transporter interface for MachinesControllerServerTransport. +func (m *MachinesControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "MachinesControllerClient.Get": + resp, err = m.dispatchGet(req) + case "MachinesControllerClient.NewListByVmwareSitePager": + resp, err = m.dispatchNewListByVmwareSitePager(req) + case "MachinesControllerClient.BeginStart": + resp, err = m.dispatchBeginStart(req) + case "MachinesControllerClient.BeginStop": + resp, err = m.dispatchBeginStop(req) + case "MachinesControllerClient.Update": + resp, err = m.dispatchUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (m *MachinesControllerServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if m.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/vmwareSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/machines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + machineNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("machineName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.Get(req.Context(), resourceGroupNameParam, siteNameParam, machineNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).MachineResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (m *MachinesControllerServerTransport) dispatchNewListByVmwareSitePager(req *http.Request) (*http.Response, error) { + if m.srv.NewListByVmwareSitePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByVmwareSitePager not implemented")} + } + newListByVmwareSitePager := m.newListByVmwareSitePager.get(req) + if newListByVmwareSitePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/vmwareSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/machines` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + continuationTokenUnescaped, err := url.QueryUnescape(qp.Get("continuationToken")) + if err != nil { + return nil, err + } + continuationTokenParam := getOptional(continuationTokenUnescaped) + totalRecordCountUnescaped, err := url.QueryUnescape(qp.Get("totalRecordCount")) + if err != nil { + return nil, err + } + totalRecordCountParam, err := parseOptional(totalRecordCountUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + var options *armmigrate.MachinesControllerClientListByVmwareSiteOptions + if filterParam != nil || topParam != nil || continuationTokenParam != nil || totalRecordCountParam != nil { + options = &armmigrate.MachinesControllerClientListByVmwareSiteOptions{ + Filter: filterParam, + Top: topParam, + ContinuationToken: continuationTokenParam, + TotalRecordCount: totalRecordCountParam, + } + } + resp := m.srv.NewListByVmwareSitePager(resourceGroupNameParam, siteNameParam, options) + newListByVmwareSitePager = &resp + m.newListByVmwareSitePager.add(req, newListByVmwareSitePager) + server.PagerResponderInjectNextLinks(newListByVmwareSitePager, req, func(page *armmigrate.MachinesControllerClientListByVmwareSiteResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByVmwareSitePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + m.newListByVmwareSitePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByVmwareSitePager) { + m.newListByVmwareSitePager.remove(req) + } + return resp, nil +} + +func (m *MachinesControllerServerTransport) dispatchBeginStart(req *http.Request) (*http.Response, error) { + if m.srv.BeginStart == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginStart not implemented")} + } + beginStart := m.beginStart.get(req) + if beginStart == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/vmwareSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/machines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/start` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + machineNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("machineName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.BeginStart(req.Context(), resourceGroupNameParam, siteNameParam, machineNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginStart = &respr + m.beginStart.add(req, beginStart) + } + + resp, err := server.PollerResponderNext(beginStart, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + m.beginStart.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginStart) { + m.beginStart.remove(req) + } + + return resp, nil +} + +func (m *MachinesControllerServerTransport) dispatchBeginStop(req *http.Request) (*http.Response, error) { + if m.srv.BeginStop == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginStop not implemented")} + } + beginStop := m.beginStop.get(req) + if beginStop == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/vmwareSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/machines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/stop` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + machineNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("machineName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.BeginStop(req.Context(), resourceGroupNameParam, siteNameParam, machineNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginStop = &respr + m.beginStop.add(req, beginStop) + } + + resp, err := server.PollerResponderNext(beginStop, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + m.beginStop.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginStop) { + m.beginStop.remove(req) + } + + return resp, nil +} + +func (m *MachinesControllerServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if m.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/vmwareSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/machines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.MachineResourceUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + machineNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("machineName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.Update(req.Context(), resourceGroupNameParam, siteNameParam, machineNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).MachineResource, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/mastersitescontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/mastersitescontroller_server.go new file mode 100644 index 000000000000..51204470ca16 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/mastersitescontroller_server.go @@ -0,0 +1,383 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" +) + +// MasterSitesControllerServer is a fake server for instances of the armmigrate.MasterSitesControllerClient type. +type MasterSitesControllerServer struct { + // BeginCreate is the fake for method MasterSitesControllerClient.BeginCreate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreate func(ctx context.Context, resourceGroupName string, siteName string, body armmigrate.MasterSite, options *armmigrate.MasterSitesControllerClientBeginCreateOptions) (resp azfake.PollerResponder[armmigrate.MasterSitesControllerClientCreateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method MasterSitesControllerClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, siteName string, options *armmigrate.MasterSitesControllerClientDeleteOptions) (resp azfake.Responder[armmigrate.MasterSitesControllerClientDeleteResponse], errResp azfake.ErrorResponder) + + // ErrorSummary is the fake for method MasterSitesControllerClient.ErrorSummary + // HTTP status codes to indicate success: http.StatusOK + ErrorSummary func(ctx context.Context, resourceGroupName string, siteName string, body armmigrate.ErrorSummaryRequest, options *armmigrate.MasterSitesControllerClientErrorSummaryOptions) (resp azfake.Responder[armmigrate.MasterSitesControllerClientErrorSummaryResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method MasterSitesControllerClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, siteName string, options *armmigrate.MasterSitesControllerClientGetOptions) (resp azfake.Responder[armmigrate.MasterSitesControllerClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method MasterSitesControllerClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armmigrate.MasterSitesControllerClientListByResourceGroupOptions) (resp azfake.PagerResponder[armmigrate.MasterSitesControllerClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method MasterSitesControllerClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armmigrate.MasterSitesControllerClientListBySubscriptionOptions) (resp azfake.PagerResponder[armmigrate.MasterSitesControllerClientListBySubscriptionResponse]) + + // BeginUpdate is the fake for method MasterSitesControllerClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, siteName string, properties armmigrate.MasterSiteUpdate, options *armmigrate.MasterSitesControllerClientBeginUpdateOptions) (resp azfake.PollerResponder[armmigrate.MasterSitesControllerClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewMasterSitesControllerServerTransport creates a new instance of MasterSitesControllerServerTransport with the provided implementation. +// The returned MasterSitesControllerServerTransport instance is connected to an instance of armmigrate.MasterSitesControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewMasterSitesControllerServerTransport(srv *MasterSitesControllerServer) *MasterSitesControllerServerTransport { + return &MasterSitesControllerServerTransport{ + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[armmigrate.MasterSitesControllerClientCreateResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armmigrate.MasterSitesControllerClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armmigrate.MasterSitesControllerClientListBySubscriptionResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armmigrate.MasterSitesControllerClientUpdateResponse]](), + } +} + +// MasterSitesControllerServerTransport connects instances of armmigrate.MasterSitesControllerClient to instances of MasterSitesControllerServer. +// Don't use this type directly, use NewMasterSitesControllerServerTransport instead. +type MasterSitesControllerServerTransport struct { + srv *MasterSitesControllerServer + beginCreate *tracker[azfake.PollerResponder[armmigrate.MasterSitesControllerClientCreateResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armmigrate.MasterSitesControllerClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armmigrate.MasterSitesControllerClientListBySubscriptionResponse]] + beginUpdate *tracker[azfake.PollerResponder[armmigrate.MasterSitesControllerClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for MasterSitesControllerServerTransport. +func (m *MasterSitesControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "MasterSitesControllerClient.BeginCreate": + resp, err = m.dispatchBeginCreate(req) + case "MasterSitesControllerClient.Delete": + resp, err = m.dispatchDelete(req) + case "MasterSitesControllerClient.ErrorSummary": + resp, err = m.dispatchErrorSummary(req) + case "MasterSitesControllerClient.Get": + resp, err = m.dispatchGet(req) + case "MasterSitesControllerClient.NewListByResourceGroupPager": + resp, err = m.dispatchNewListByResourceGroupPager(req) + case "MasterSitesControllerClient.NewListBySubscriptionPager": + resp, err = m.dispatchNewListBySubscriptionPager(req) + case "MasterSitesControllerClient.BeginUpdate": + resp, err = m.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (m *MasterSitesControllerServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { + if m.srv.BeginCreate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} + } + beginCreate := m.beginCreate.get(req) + if beginCreate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.MasterSite](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.BeginCreate(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreate = &respr + m.beginCreate.add(req, beginCreate) + } + + resp, err := server.PollerResponderNext(beginCreate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + m.beginCreate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreate) { + m.beginCreate.remove(req) + } + + return resp, nil +} + +func (m *MasterSitesControllerServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if m.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.Delete(req.Context(), resourceGroupNameParam, siteNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (m *MasterSitesControllerServerTransport) dispatchErrorSummary(req *http.Request) (*http.Response, error) { + if m.srv.ErrorSummary == nil { + return nil, &nonRetriableError{errors.New("fake for method ErrorSummary not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/errorSummary` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.ErrorSummaryRequest](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.ErrorSummary(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SiteErrorSummary, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (m *MasterSitesControllerServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if m.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.Get(req.Context(), resourceGroupNameParam, siteNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).MasterSite, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (m *MasterSitesControllerServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if m.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := m.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resp := m.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + m.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armmigrate.MasterSitesControllerClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + m.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + m.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (m *MasterSitesControllerServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if m.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := m.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resp := m.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + m.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armmigrate.MasterSitesControllerClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + m.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + m.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (m *MasterSitesControllerServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if m.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := m.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.MasterSiteUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.BeginUpdate(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + m.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + m.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + m.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/mastersitesoperationsstatuscontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/mastersitesoperationsstatuscontroller_server.go new file mode 100644 index 000000000000..a7bacabfeded --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/mastersitesoperationsstatuscontroller_server.go @@ -0,0 +1,104 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" +) + +// MasterSitesOperationsStatusControllerServer is a fake server for instances of the armmigrate.MasterSitesOperationsStatusControllerClient type. +type MasterSitesOperationsStatusControllerServer struct { + // GetVmwareOperationStatus is the fake for method MasterSitesOperationsStatusControllerClient.GetVmwareOperationStatus + // HTTP status codes to indicate success: http.StatusOK + GetVmwareOperationStatus func(ctx context.Context, resourceGroupName string, siteName string, operationStatusName string, options *armmigrate.MasterSitesOperationsStatusControllerClientGetVmwareOperationStatusOptions) (resp azfake.Responder[armmigrate.MasterSitesOperationsStatusControllerClientGetVmwareOperationStatusResponse], errResp azfake.ErrorResponder) +} + +// NewMasterSitesOperationsStatusControllerServerTransport creates a new instance of MasterSitesOperationsStatusControllerServerTransport with the provided implementation. +// The returned MasterSitesOperationsStatusControllerServerTransport instance is connected to an instance of armmigrate.MasterSitesOperationsStatusControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewMasterSitesOperationsStatusControllerServerTransport(srv *MasterSitesOperationsStatusControllerServer) *MasterSitesOperationsStatusControllerServerTransport { + return &MasterSitesOperationsStatusControllerServerTransport{srv: srv} +} + +// MasterSitesOperationsStatusControllerServerTransport connects instances of armmigrate.MasterSitesOperationsStatusControllerClient to instances of MasterSitesOperationsStatusControllerServer. +// Don't use this type directly, use NewMasterSitesOperationsStatusControllerServerTransport instead. +type MasterSitesOperationsStatusControllerServerTransport struct { + srv *MasterSitesOperationsStatusControllerServer +} + +// Do implements the policy.Transporter interface for MasterSitesOperationsStatusControllerServerTransport. +func (m *MasterSitesOperationsStatusControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "MasterSitesOperationsStatusControllerClient.GetVmwareOperationStatus": + resp, err = m.dispatchGetVmwareOperationStatus(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (m *MasterSitesOperationsStatusControllerServerTransport) dispatchGetVmwareOperationStatus(req *http.Request) (*http.Response, error) { + if m.srv.GetVmwareOperationStatus == nil { + return nil, &nonRetriableError{errors.New("fake for method GetVmwareOperationStatus not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operationsStatus/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + operationStatusNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationStatusName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.GetVmwareOperationStatus(req.Context(), resourceGroupNameParam, siteNameParam, operationStatusNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationStatus, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/operations_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/operations_server.go index 58fb7b499c74..368e9db621c8 100644 --- a/sdk/resourcemanager/migrate/armmigrate/fake/operations_server.go +++ b/sdk/resourcemanager/migrate/armmigrate/fake/operations_server.go @@ -14,7 +14,8 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" "net/http" ) @@ -76,6 +77,9 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht resp := o.srv.NewListPager(nil) newListPager = &resp o.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armmigrate.OperationsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) } resp, err := server.PagerResponderNext(newListPager, req) if err != nil { diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/privateendpointconnection_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/privateendpointconnection_server.go deleted file mode 100644 index b760b5f351ba..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/fake/privateendpointconnection_server.go +++ /dev/null @@ -1,252 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" - "net/http" - "net/url" - "reflect" - "regexp" -) - -// PrivateEndpointConnectionServer is a fake server for instances of the armmigrate.PrivateEndpointConnectionClient type. -type PrivateEndpointConnectionServer struct { - // Delete is the fake for method PrivateEndpointConnectionClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, projectName string, privateEndpointConnectionName string, options *armmigrate.PrivateEndpointConnectionClientDeleteOptions) (resp azfake.Responder[armmigrate.PrivateEndpointConnectionClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method PrivateEndpointConnectionClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, projectName string, privateEndpointConnectionName string, options *armmigrate.PrivateEndpointConnectionClientGetOptions) (resp azfake.Responder[armmigrate.PrivateEndpointConnectionClientGetResponse], errResp azfake.ErrorResponder) - - // ListByProject is the fake for method PrivateEndpointConnectionClient.ListByProject - // HTTP status codes to indicate success: http.StatusOK - ListByProject func(ctx context.Context, resourceGroupName string, projectName string, options *armmigrate.PrivateEndpointConnectionClientListByProjectOptions) (resp azfake.Responder[armmigrate.PrivateEndpointConnectionClientListByProjectResponse], errResp azfake.ErrorResponder) - - // Update is the fake for method PrivateEndpointConnectionClient.Update - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - Update func(ctx context.Context, resourceGroupName string, projectName string, privateEndpointConnectionName string, options *armmigrate.PrivateEndpointConnectionClientUpdateOptions) (resp azfake.Responder[armmigrate.PrivateEndpointConnectionClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewPrivateEndpointConnectionServerTransport creates a new instance of PrivateEndpointConnectionServerTransport with the provided implementation. -// The returned PrivateEndpointConnectionServerTransport instance is connected to an instance of armmigrate.PrivateEndpointConnectionClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewPrivateEndpointConnectionServerTransport(srv *PrivateEndpointConnectionServer) *PrivateEndpointConnectionServerTransport { - return &PrivateEndpointConnectionServerTransport{srv: srv} -} - -// PrivateEndpointConnectionServerTransport connects instances of armmigrate.PrivateEndpointConnectionClient to instances of PrivateEndpointConnectionServer. -// Don't use this type directly, use NewPrivateEndpointConnectionServerTransport instead. -type PrivateEndpointConnectionServerTransport struct { - srv *PrivateEndpointConnectionServer -} - -// Do implements the policy.Transporter interface for PrivateEndpointConnectionServerTransport. -func (p *PrivateEndpointConnectionServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "PrivateEndpointConnectionClient.Delete": - resp, err = p.dispatchDelete(req) - case "PrivateEndpointConnectionClient.Get": - resp, err = p.dispatchGet(req) - case "PrivateEndpointConnectionClient.ListByProject": - resp, err = p.dispatchListByProject(req) - case "PrivateEndpointConnectionClient.Update": - resp, err = p.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *PrivateEndpointConnectionServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if p.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentprojects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Delete(req.Context(), resourceGroupNameParam, projectNameParam, privateEndpointConnectionNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (p *PrivateEndpointConnectionServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if p.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentprojects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, projectNameParam, privateEndpointConnectionNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateEndpointConnection, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (p *PrivateEndpointConnectionServerTransport) dispatchListByProject(req *http.Request) (*http.Response, error) { - if p.srv.ListByProject == nil { - return nil, &nonRetriableError{errors.New("fake for method ListByProject not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentprojects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.ListByProject(req.Context(), resourceGroupNameParam, projectNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateEndpointConnectionCollection, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (p *PrivateEndpointConnectionServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { - if p.srv.Update == nil { - return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentprojects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmigrate.PrivateEndpointConnection](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) - if err != nil { - return nil, err - } - var options *armmigrate.PrivateEndpointConnectionClientUpdateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armmigrate.PrivateEndpointConnectionClientUpdateOptions{ - PrivateEndpointConnectionBody: &body, - } - } - respr, errRespr := p.srv.Update(req.Context(), resourceGroupNameParam, projectNameParam, privateEndpointConnectionNameParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusAccepted}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateEndpointConnection, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/privateendpointconnectioncontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/privateendpointconnectioncontroller_server.go new file mode 100644 index 000000000000..c7855a1465b2 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/privateendpointconnectioncontroller_server.go @@ -0,0 +1,250 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// PrivateEndpointConnectionControllerServer is a fake server for instances of the armmigrate.PrivateEndpointConnectionControllerClient type. +type PrivateEndpointConnectionControllerServer struct { + // Create is the fake for method PrivateEndpointConnectionControllerClient.Create + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + Create func(ctx context.Context, resourceGroupName string, siteName string, peConnectionName string, body armmigrate.PrivateEndpointConnection, options *armmigrate.PrivateEndpointConnectionControllerClientCreateOptions) (resp azfake.Responder[armmigrate.PrivateEndpointConnectionControllerClientCreateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method PrivateEndpointConnectionControllerClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, siteName string, peConnectionName string, options *armmigrate.PrivateEndpointConnectionControllerClientDeleteOptions) (resp azfake.Responder[armmigrate.PrivateEndpointConnectionControllerClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method PrivateEndpointConnectionControllerClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, siteName string, peConnectionName string, options *armmigrate.PrivateEndpointConnectionControllerClientGetOptions) (resp azfake.Responder[armmigrate.PrivateEndpointConnectionControllerClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByMasterSitePager is the fake for method PrivateEndpointConnectionControllerClient.NewListByMasterSitePager + // HTTP status codes to indicate success: http.StatusOK + NewListByMasterSitePager func(resourceGroupName string, siteName string, options *armmigrate.PrivateEndpointConnectionControllerClientListByMasterSiteOptions) (resp azfake.PagerResponder[armmigrate.PrivateEndpointConnectionControllerClientListByMasterSiteResponse]) +} + +// NewPrivateEndpointConnectionControllerServerTransport creates a new instance of PrivateEndpointConnectionControllerServerTransport with the provided implementation. +// The returned PrivateEndpointConnectionControllerServerTransport instance is connected to an instance of armmigrate.PrivateEndpointConnectionControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewPrivateEndpointConnectionControllerServerTransport(srv *PrivateEndpointConnectionControllerServer) *PrivateEndpointConnectionControllerServerTransport { + return &PrivateEndpointConnectionControllerServerTransport{ + srv: srv, + newListByMasterSitePager: newTracker[azfake.PagerResponder[armmigrate.PrivateEndpointConnectionControllerClientListByMasterSiteResponse]](), + } +} + +// PrivateEndpointConnectionControllerServerTransport connects instances of armmigrate.PrivateEndpointConnectionControllerClient to instances of PrivateEndpointConnectionControllerServer. +// Don't use this type directly, use NewPrivateEndpointConnectionControllerServerTransport instead. +type PrivateEndpointConnectionControllerServerTransport struct { + srv *PrivateEndpointConnectionControllerServer + newListByMasterSitePager *tracker[azfake.PagerResponder[armmigrate.PrivateEndpointConnectionControllerClientListByMasterSiteResponse]] +} + +// Do implements the policy.Transporter interface for PrivateEndpointConnectionControllerServerTransport. +func (p *PrivateEndpointConnectionControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "PrivateEndpointConnectionControllerClient.Create": + resp, err = p.dispatchCreate(req) + case "PrivateEndpointConnectionControllerClient.Delete": + resp, err = p.dispatchDelete(req) + case "PrivateEndpointConnectionControllerClient.Get": + resp, err = p.dispatchGet(req) + case "PrivateEndpointConnectionControllerClient.NewListByMasterSitePager": + resp, err = p.dispatchNewListByMasterSitePager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (p *PrivateEndpointConnectionControllerServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { + if p.srv.Create == nil { + return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.PrivateEndpointConnection](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + peConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("peConnectionName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Create(req.Context(), resourceGroupNameParam, siteNameParam, peConnectionNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateEndpointConnection, req) + if err != nil { + return nil, err + } + if val := server.GetResponse(respr).RetryAfter; val != nil { + resp.Header.Set("Retry-After", strconv.FormatInt(int64(*val), 10)) + } + return resp, nil +} + +func (p *PrivateEndpointConnectionControllerServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if p.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + peConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("peConnectionName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Delete(req.Context(), resourceGroupNameParam, siteNameParam, peConnectionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PrivateEndpointConnectionControllerServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if p.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + peConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("peConnectionName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, siteNameParam, peConnectionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateEndpointConnection, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PrivateEndpointConnectionControllerServerTransport) dispatchNewListByMasterSitePager(req *http.Request) (*http.Response, error) { + if p.srv.NewListByMasterSitePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByMasterSitePager not implemented")} + } + newListByMasterSitePager := p.newListByMasterSitePager.get(req) + if newListByMasterSitePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + resp := p.srv.NewListByMasterSitePager(resourceGroupNameParam, siteNameParam, nil) + newListByMasterSitePager = &resp + p.newListByMasterSitePager.add(req, newListByMasterSitePager) + server.PagerResponderInjectNextLinks(newListByMasterSitePager, req, func(page *armmigrate.PrivateEndpointConnectionControllerClientListByMasterSiteResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByMasterSitePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListByMasterSitePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByMasterSitePager) { + p.newListByMasterSitePager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/privatelinkresource_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/privatelinkresource_server.go deleted file mode 100644 index f3ea06be5bcf..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/fake/privatelinkresource_server.go +++ /dev/null @@ -1,149 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" - "net/http" - "net/url" - "regexp" -) - -// PrivateLinkResourceServer is a fake server for instances of the armmigrate.PrivateLinkResourceClient type. -type PrivateLinkResourceServer struct { - // Get is the fake for method PrivateLinkResourceClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, projectName string, privateLinkResourceName string, options *armmigrate.PrivateLinkResourceClientGetOptions) (resp azfake.Responder[armmigrate.PrivateLinkResourceClientGetResponse], errResp azfake.ErrorResponder) - - // ListByProject is the fake for method PrivateLinkResourceClient.ListByProject - // HTTP status codes to indicate success: http.StatusOK - ListByProject func(ctx context.Context, resourceGroupName string, projectName string, options *armmigrate.PrivateLinkResourceClientListByProjectOptions) (resp azfake.Responder[armmigrate.PrivateLinkResourceClientListByProjectResponse], errResp azfake.ErrorResponder) -} - -// NewPrivateLinkResourceServerTransport creates a new instance of PrivateLinkResourceServerTransport with the provided implementation. -// The returned PrivateLinkResourceServerTransport instance is connected to an instance of armmigrate.PrivateLinkResourceClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewPrivateLinkResourceServerTransport(srv *PrivateLinkResourceServer) *PrivateLinkResourceServerTransport { - return &PrivateLinkResourceServerTransport{srv: srv} -} - -// PrivateLinkResourceServerTransport connects instances of armmigrate.PrivateLinkResourceClient to instances of PrivateLinkResourceServer. -// Don't use this type directly, use NewPrivateLinkResourceServerTransport instead. -type PrivateLinkResourceServerTransport struct { - srv *PrivateLinkResourceServer -} - -// Do implements the policy.Transporter interface for PrivateLinkResourceServerTransport. -func (p *PrivateLinkResourceServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "PrivateLinkResourceClient.Get": - resp, err = p.dispatchGet(req) - case "PrivateLinkResourceClient.ListByProject": - resp, err = p.dispatchListByProject(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *PrivateLinkResourceServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if p.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentprojects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateLinkResources/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - privateLinkResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateLinkResourceName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, projectNameParam, privateLinkResourceNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateLinkResource, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (p *PrivateLinkResourceServerTransport) dispatchListByProject(req *http.Request) (*http.Response, error) { - if p.srv.ListByProject == nil { - return nil, &nonRetriableError{errors.New("fake for method ListByProject not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentprojects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateLinkResources` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.ListByProject(req.Context(), resourceGroupNameParam, projectNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateLinkResourceCollection, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/privatelinkresourcescontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/privatelinkresourcescontroller_server.go new file mode 100644 index 000000000000..517e61eee670 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/privatelinkresourcescontroller_server.go @@ -0,0 +1,156 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" +) + +// PrivateLinkResourcesControllerServer is a fake server for instances of the armmigrate.PrivateLinkResourcesControllerClient type. +type PrivateLinkResourcesControllerServer struct { + // Get is the fake for method PrivateLinkResourcesControllerClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, siteName string, privateLinkResourceName string, options *armmigrate.PrivateLinkResourcesControllerClientGetOptions) (resp azfake.Responder[armmigrate.PrivateLinkResourcesControllerClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByMasterSitePager is the fake for method PrivateLinkResourcesControllerClient.NewListByMasterSitePager + // HTTP status codes to indicate success: http.StatusOK + NewListByMasterSitePager func(resourceGroupName string, siteName string, options *armmigrate.PrivateLinkResourcesControllerClientListByMasterSiteOptions) (resp azfake.PagerResponder[armmigrate.PrivateLinkResourcesControllerClientListByMasterSiteResponse]) +} + +// NewPrivateLinkResourcesControllerServerTransport creates a new instance of PrivateLinkResourcesControllerServerTransport with the provided implementation. +// The returned PrivateLinkResourcesControllerServerTransport instance is connected to an instance of armmigrate.PrivateLinkResourcesControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewPrivateLinkResourcesControllerServerTransport(srv *PrivateLinkResourcesControllerServer) *PrivateLinkResourcesControllerServerTransport { + return &PrivateLinkResourcesControllerServerTransport{ + srv: srv, + newListByMasterSitePager: newTracker[azfake.PagerResponder[armmigrate.PrivateLinkResourcesControllerClientListByMasterSiteResponse]](), + } +} + +// PrivateLinkResourcesControllerServerTransport connects instances of armmigrate.PrivateLinkResourcesControllerClient to instances of PrivateLinkResourcesControllerServer. +// Don't use this type directly, use NewPrivateLinkResourcesControllerServerTransport instead. +type PrivateLinkResourcesControllerServerTransport struct { + srv *PrivateLinkResourcesControllerServer + newListByMasterSitePager *tracker[azfake.PagerResponder[armmigrate.PrivateLinkResourcesControllerClientListByMasterSiteResponse]] +} + +// Do implements the policy.Transporter interface for PrivateLinkResourcesControllerServerTransport. +func (p *PrivateLinkResourcesControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "PrivateLinkResourcesControllerClient.Get": + resp, err = p.dispatchGet(req) + case "PrivateLinkResourcesControllerClient.NewListByMasterSitePager": + resp, err = p.dispatchNewListByMasterSitePager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (p *PrivateLinkResourcesControllerServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if p.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateLinkResources/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + privateLinkResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateLinkResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, siteNameParam, privateLinkResourceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateLinkResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PrivateLinkResourcesControllerServerTransport) dispatchNewListByMasterSitePager(req *http.Request) (*http.Response, error) { + if p.srv.NewListByMasterSitePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByMasterSitePager not implemented")} + } + newListByMasterSitePager := p.newListByMasterSitePager.get(req) + if newListByMasterSitePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateLinkResources` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + resp := p.srv.NewListByMasterSitePager(resourceGroupNameParam, siteNameParam, nil) + newListByMasterSitePager = &resp + p.newListByMasterSitePager.add(req, newListByMasterSitePager) + server.PagerResponderInjectNextLinks(newListByMasterSitePager, req, func(page *armmigrate.PrivateLinkResourcesControllerClientListByMasterSiteResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByMasterSitePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListByMasterSitePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByMasterSitePager) { + p.newListByMasterSitePager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/projects_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/projects_server.go deleted file mode 100644 index 08f175924815..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/fake/projects_server.go +++ /dev/null @@ -1,431 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" - "net/http" - "net/url" - "reflect" - "regexp" -) - -// ProjectsServer is a fake server for instances of the armmigrate.ProjectsClient type. -type ProjectsServer struct { - // AssessmentOptions is the fake for method ProjectsClient.AssessmentOptions - // HTTP status codes to indicate success: http.StatusOK - AssessmentOptions func(ctx context.Context, resourceGroupName string, projectName string, assessmentOptionsName string, options *armmigrate.ProjectsClientAssessmentOptionsOptions) (resp azfake.Responder[armmigrate.ProjectsClientAssessmentOptionsResponse], errResp azfake.ErrorResponder) - - // NewAssessmentOptionsListPager is the fake for method ProjectsClient.NewAssessmentOptionsListPager - // HTTP status codes to indicate success: http.StatusOK - NewAssessmentOptionsListPager func(resourceGroupName string, projectName string, options *armmigrate.ProjectsClientAssessmentOptionsListOptions) (resp azfake.PagerResponder[armmigrate.ProjectsClientAssessmentOptionsListResponse]) - - // Create is the fake for method ProjectsClient.Create - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - Create func(ctx context.Context, resourceGroupName string, projectName string, options *armmigrate.ProjectsClientCreateOptions) (resp azfake.Responder[armmigrate.ProjectsClientCreateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method ProjectsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, projectName string, options *armmigrate.ProjectsClientDeleteOptions) (resp azfake.Responder[armmigrate.ProjectsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method ProjectsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, projectName string, options *armmigrate.ProjectsClientGetOptions) (resp azfake.Responder[armmigrate.ProjectsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method ProjectsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, options *armmigrate.ProjectsClientListOptions) (resp azfake.PagerResponder[armmigrate.ProjectsClientListResponse]) - - // NewListBySubscriptionPager is the fake for method ProjectsClient.NewListBySubscriptionPager - // HTTP status codes to indicate success: http.StatusOK - NewListBySubscriptionPager func(options *armmigrate.ProjectsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armmigrate.ProjectsClientListBySubscriptionResponse]) - - // Update is the fake for method ProjectsClient.Update - // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, resourceGroupName string, projectName string, options *armmigrate.ProjectsClientUpdateOptions) (resp azfake.Responder[armmigrate.ProjectsClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewProjectsServerTransport creates a new instance of ProjectsServerTransport with the provided implementation. -// The returned ProjectsServerTransport instance is connected to an instance of armmigrate.ProjectsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewProjectsServerTransport(srv *ProjectsServer) *ProjectsServerTransport { - return &ProjectsServerTransport{ - srv: srv, - newAssessmentOptionsListPager: newTracker[azfake.PagerResponder[armmigrate.ProjectsClientAssessmentOptionsListResponse]](), - newListPager: newTracker[azfake.PagerResponder[armmigrate.ProjectsClientListResponse]](), - newListBySubscriptionPager: newTracker[azfake.PagerResponder[armmigrate.ProjectsClientListBySubscriptionResponse]](), - } -} - -// ProjectsServerTransport connects instances of armmigrate.ProjectsClient to instances of ProjectsServer. -// Don't use this type directly, use NewProjectsServerTransport instead. -type ProjectsServerTransport struct { - srv *ProjectsServer - newAssessmentOptionsListPager *tracker[azfake.PagerResponder[armmigrate.ProjectsClientAssessmentOptionsListResponse]] - newListPager *tracker[azfake.PagerResponder[armmigrate.ProjectsClientListResponse]] - newListBySubscriptionPager *tracker[azfake.PagerResponder[armmigrate.ProjectsClientListBySubscriptionResponse]] -} - -// Do implements the policy.Transporter interface for ProjectsServerTransport. -func (p *ProjectsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "ProjectsClient.AssessmentOptions": - resp, err = p.dispatchAssessmentOptions(req) - case "ProjectsClient.NewAssessmentOptionsListPager": - resp, err = p.dispatchNewAssessmentOptionsListPager(req) - case "ProjectsClient.Create": - resp, err = p.dispatchCreate(req) - case "ProjectsClient.Delete": - resp, err = p.dispatchDelete(req) - case "ProjectsClient.Get": - resp, err = p.dispatchGet(req) - case "ProjectsClient.NewListPager": - resp, err = p.dispatchNewListPager(req) - case "ProjectsClient.NewListBySubscriptionPager": - resp, err = p.dispatchNewListBySubscriptionPager(req) - case "ProjectsClient.Update": - resp, err = p.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *ProjectsServerTransport) dispatchAssessmentOptions(req *http.Request) (*http.Response, error) { - if p.srv.AssessmentOptions == nil { - return nil, &nonRetriableError{errors.New("fake for method AssessmentOptions not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/assessmentOptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - assessmentOptionsNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("assessmentOptionsName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.AssessmentOptions(req.Context(), resourceGroupNameParam, projectNameParam, assessmentOptionsNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AssessmentOptions, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (p *ProjectsServerTransport) dispatchNewAssessmentOptionsListPager(req *http.Request) (*http.Response, error) { - if p.srv.NewAssessmentOptionsListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewAssessmentOptionsListPager not implemented")} - } - newAssessmentOptionsListPager := p.newAssessmentOptionsListPager.get(req) - if newAssessmentOptionsListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/assessmentOptions` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - resp := p.srv.NewAssessmentOptionsListPager(resourceGroupNameParam, projectNameParam, nil) - newAssessmentOptionsListPager = &resp - p.newAssessmentOptionsListPager.add(req, newAssessmentOptionsListPager) - } - resp, err := server.PagerResponderNext(newAssessmentOptionsListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - p.newAssessmentOptionsListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newAssessmentOptionsListPager) { - p.newAssessmentOptionsListPager.remove(req) - } - return resp, nil -} - -func (p *ProjectsServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { - if p.srv.Create == nil { - return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmigrate.Project](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - var options *armmigrate.ProjectsClientCreateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armmigrate.ProjectsClientCreateOptions{ - Project: &body, - } - } - respr, errRespr := p.srv.Create(req.Context(), resourceGroupNameParam, projectNameParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Project, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (p *ProjectsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if p.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Delete(req.Context(), resourceGroupNameParam, projectNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (p *ProjectsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if p.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, projectNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Project, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (p *ProjectsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if p.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := p.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - resp := p.srv.NewListPager(resourceGroupNameParam, nil) - newListPager = &resp - p.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armmigrate.ProjectsClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - p.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - p.newListPager.remove(req) - } - return resp, nil -} - -func (p *ProjectsServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { - if p.srv.NewListBySubscriptionPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} - } - newListBySubscriptionPager := p.newListBySubscriptionPager.get(req) - if newListBySubscriptionPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resp := p.srv.NewListBySubscriptionPager(nil) - newListBySubscriptionPager = &resp - p.newListBySubscriptionPager.add(req, newListBySubscriptionPager) - server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armmigrate.ProjectsClientListBySubscriptionResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - p.newListBySubscriptionPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListBySubscriptionPager) { - p.newListBySubscriptionPager.remove(req) - } - return resp, nil -} - -func (p *ProjectsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { - if p.srv.Update == nil { - return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmigrate.Project](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - var options *armmigrate.ProjectsClientUpdateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armmigrate.ProjectsClientUpdateOptions{ - Project: &body, - } - } - respr, errRespr := p.srv.Update(req.Context(), resourceGroupNameParam, projectNameParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Project, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/runasaccountscontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/runasaccountscontroller_server.go new file mode 100644 index 000000000000..68761555ba06 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/runasaccountscontroller_server.go @@ -0,0 +1,156 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" +) + +// RunAsAccountsControllerServer is a fake server for instances of the armmigrate.RunAsAccountsControllerClient type. +type RunAsAccountsControllerServer struct { + // Get is the fake for method RunAsAccountsControllerClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, siteName string, accountName string, options *armmigrate.RunAsAccountsControllerClientGetOptions) (resp azfake.Responder[armmigrate.RunAsAccountsControllerClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByVmwareSitePager is the fake for method RunAsAccountsControllerClient.NewListByVmwareSitePager + // HTTP status codes to indicate success: http.StatusOK + NewListByVmwareSitePager func(resourceGroupName string, siteName string, options *armmigrate.RunAsAccountsControllerClientListByVmwareSiteOptions) (resp azfake.PagerResponder[armmigrate.RunAsAccountsControllerClientListByVmwareSiteResponse]) +} + +// NewRunAsAccountsControllerServerTransport creates a new instance of RunAsAccountsControllerServerTransport with the provided implementation. +// The returned RunAsAccountsControllerServerTransport instance is connected to an instance of armmigrate.RunAsAccountsControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewRunAsAccountsControllerServerTransport(srv *RunAsAccountsControllerServer) *RunAsAccountsControllerServerTransport { + return &RunAsAccountsControllerServerTransport{ + srv: srv, + newListByVmwareSitePager: newTracker[azfake.PagerResponder[armmigrate.RunAsAccountsControllerClientListByVmwareSiteResponse]](), + } +} + +// RunAsAccountsControllerServerTransport connects instances of armmigrate.RunAsAccountsControllerClient to instances of RunAsAccountsControllerServer. +// Don't use this type directly, use NewRunAsAccountsControllerServerTransport instead. +type RunAsAccountsControllerServerTransport struct { + srv *RunAsAccountsControllerServer + newListByVmwareSitePager *tracker[azfake.PagerResponder[armmigrate.RunAsAccountsControllerClientListByVmwareSiteResponse]] +} + +// Do implements the policy.Transporter interface for RunAsAccountsControllerServerTransport. +func (r *RunAsAccountsControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "RunAsAccountsControllerClient.Get": + resp, err = r.dispatchGet(req) + case "RunAsAccountsControllerClient.NewListByVmwareSitePager": + resp, err = r.dispatchNewListByVmwareSitePager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (r *RunAsAccountsControllerServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if r.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/vmwareSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/runAsAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.Get(req.Context(), resourceGroupNameParam, siteNameParam, accountNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).VmwareRunAsAccountResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (r *RunAsAccountsControllerServerTransport) dispatchNewListByVmwareSitePager(req *http.Request) (*http.Response, error) { + if r.srv.NewListByVmwareSitePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByVmwareSitePager not implemented")} + } + newListByVmwareSitePager := r.newListByVmwareSitePager.get(req) + if newListByVmwareSitePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/vmwareSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/runAsAccounts` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + resp := r.srv.NewListByVmwareSitePager(resourceGroupNameParam, siteNameParam, nil) + newListByVmwareSitePager = &resp + r.newListByVmwareSitePager.add(req, newListByVmwareSitePager) + server.PagerResponderInjectNextLinks(newListByVmwareSitePager, req, func(page *armmigrate.RunAsAccountsControllerClientListByVmwareSiteResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByVmwareSitePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + r.newListByVmwareSitePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByVmwareSitePager) { + r.newListByVmwareSitePager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/server_factory.go b/sdk/resourcemanager/migrate/armmigrate/fake/server_factory.go index 905e4613e293..16a2c443a11c 100644 --- a/sdk/resourcemanager/migrate/armmigrate/fake/server_factory.go +++ b/sdk/resourcemanager/migrate/armmigrate/fake/server_factory.go @@ -19,18 +19,60 @@ import ( // ServerFactory is a fake server for instances of the armmigrate.ClientFactory type. type ServerFactory struct { - AssessedMachinesServer AssessedMachinesServer - AssessmentsServer AssessmentsServer - GroupsServer GroupsServer - HyperVCollectorsServer HyperVCollectorsServer - ImportCollectorsServer ImportCollectorsServer - MachinesServer MachinesServer - OperationsServer OperationsServer - PrivateEndpointConnectionServer PrivateEndpointConnectionServer - PrivateLinkResourceServer PrivateLinkResourceServer - ProjectsServer ProjectsServer - ServerCollectorsServer ServerCollectorsServer - VMwareCollectorsServer VMwareCollectorsServer + DependencyMapControllerServer DependencyMapControllerServer + HypervClusterControllerServer HypervClusterControllerServer + HypervDependencyMapControllerServer HypervDependencyMapControllerServer + HypervHostControllerServer HypervHostControllerServer + HypervJobsServer HypervJobsServer + HypervJobsControllerServer HypervJobsControllerServer + HypervMachinesControllerServer HypervMachinesControllerServer + HypervOperationsStatusControllerServer HypervOperationsStatusControllerServer + HypervRunAsAccountsControllerServer HypervRunAsAccountsControllerServer + HypervSitesServer HypervSitesServer + HypervSitesControllerServer HypervSitesControllerServer + HypervSoftwareInventoriesControllerServer HypervSoftwareInventoriesControllerServer + IisWebApplicationsControllerServer IisWebApplicationsControllerServer + IisWebServersControllerServer IisWebServersControllerServer + ImportJobsControllerServer ImportJobsControllerServer + ImportMachinesControllerServer ImportMachinesControllerServer + ImportSitesControllerServer ImportSitesControllerServer + MachinesControllerServer MachinesControllerServer + MasterSitesControllerServer MasterSitesControllerServer + MasterSitesOperationsStatusControllerServer MasterSitesOperationsStatusControllerServer + OperationsServer OperationsServer + PrivateEndpointConnectionControllerServer PrivateEndpointConnectionControllerServer + PrivateLinkResourcesControllerServer PrivateLinkResourcesControllerServer + RunAsAccountsControllerServer RunAsAccountsControllerServer + SQLAvailabilityGroupsControllerServer SQLAvailabilityGroupsControllerServer + SQLDatabasesControllerServer SQLDatabasesControllerServer + SQLDiscoverySiteDataSourceControllerServer SQLDiscoverySiteDataSourceControllerServer + SQLJobsControllerServer SQLJobsControllerServer + SQLOperationsStatusControllerServer SQLOperationsStatusControllerServer + SQLRunAsAccountsControllerServer SQLRunAsAccountsControllerServer + SQLServersControllerServer SQLServersControllerServer + SQLSitesControllerServer SQLSitesControllerServer + ServerDependencyMapControllerServer ServerDependencyMapControllerServer + ServerJobsControllerServer ServerJobsControllerServer + ServerOperationsStatusControllerServer ServerOperationsStatusControllerServer + ServerRunAsAccountsControllerServer ServerRunAsAccountsControllerServer + ServerSitesControllerServer ServerSitesControllerServer + ServerSoftwareInventoriesControllerServer ServerSoftwareInventoriesControllerServer + ServersControllerServer ServersControllerServer + SitesControllerServer SitesControllerServer + TomcatWebApplicationsControllerServer TomcatWebApplicationsControllerServer + TomcatWebServersControllerServer TomcatWebServersControllerServer + VcenterControllerServer VcenterControllerServer + VmwareHostControllerServer VmwareHostControllerServer + VmwareOperationsStatusServer VmwareOperationsStatusServer + VmwarePropertiesControllerServer VmwarePropertiesControllerServer + VmwareSoftwareInventoriesControllerServer VmwareSoftwareInventoriesControllerServer + WebAppDiscoverySiteDataSourcesControllerServer WebAppDiscoverySiteDataSourcesControllerServer + WebAppExtendedMachinesControllerServer WebAppExtendedMachinesControllerServer + WebAppPropertiesControllerServer WebAppPropertiesControllerServer + WebAppRunAsAccountsControllerServer WebAppRunAsAccountsControllerServer + WebAppSitesControllerServer WebAppSitesControllerServer + WebApplicationsControllerServer WebApplicationsControllerServer + WebServersControllerServer WebServersControllerServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. @@ -45,20 +87,62 @@ func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { // ServerFactoryTransport connects instances of armmigrate.ClientFactory to instances of ServerFactory. // Don't use this type directly, use NewServerFactoryTransport instead. type ServerFactoryTransport struct { - srv *ServerFactory - trMu sync.Mutex - trAssessedMachinesServer *AssessedMachinesServerTransport - trAssessmentsServer *AssessmentsServerTransport - trGroupsServer *GroupsServerTransport - trHyperVCollectorsServer *HyperVCollectorsServerTransport - trImportCollectorsServer *ImportCollectorsServerTransport - trMachinesServer *MachinesServerTransport - trOperationsServer *OperationsServerTransport - trPrivateEndpointConnectionServer *PrivateEndpointConnectionServerTransport - trPrivateLinkResourceServer *PrivateLinkResourceServerTransport - trProjectsServer *ProjectsServerTransport - trServerCollectorsServer *ServerCollectorsServerTransport - trVMwareCollectorsServer *VMwareCollectorsServerTransport + srv *ServerFactory + trMu sync.Mutex + trDependencyMapControllerServer *DependencyMapControllerServerTransport + trHypervClusterControllerServer *HypervClusterControllerServerTransport + trHypervDependencyMapControllerServer *HypervDependencyMapControllerServerTransport + trHypervHostControllerServer *HypervHostControllerServerTransport + trHypervJobsServer *HypervJobsServerTransport + trHypervJobsControllerServer *HypervJobsControllerServerTransport + trHypervMachinesControllerServer *HypervMachinesControllerServerTransport + trHypervOperationsStatusControllerServer *HypervOperationsStatusControllerServerTransport + trHypervRunAsAccountsControllerServer *HypervRunAsAccountsControllerServerTransport + trHypervSitesServer *HypervSitesServerTransport + trHypervSitesControllerServer *HypervSitesControllerServerTransport + trHypervSoftwareInventoriesControllerServer *HypervSoftwareInventoriesControllerServerTransport + trIisWebApplicationsControllerServer *IisWebApplicationsControllerServerTransport + trIisWebServersControllerServer *IisWebServersControllerServerTransport + trImportJobsControllerServer *ImportJobsControllerServerTransport + trImportMachinesControllerServer *ImportMachinesControllerServerTransport + trImportSitesControllerServer *ImportSitesControllerServerTransport + trMachinesControllerServer *MachinesControllerServerTransport + trMasterSitesControllerServer *MasterSitesControllerServerTransport + trMasterSitesOperationsStatusControllerServer *MasterSitesOperationsStatusControllerServerTransport + trOperationsServer *OperationsServerTransport + trPrivateEndpointConnectionControllerServer *PrivateEndpointConnectionControllerServerTransport + trPrivateLinkResourcesControllerServer *PrivateLinkResourcesControllerServerTransport + trRunAsAccountsControllerServer *RunAsAccountsControllerServerTransport + trSQLAvailabilityGroupsControllerServer *SQLAvailabilityGroupsControllerServerTransport + trSQLDatabasesControllerServer *SQLDatabasesControllerServerTransport + trSQLDiscoverySiteDataSourceControllerServer *SQLDiscoverySiteDataSourceControllerServerTransport + trSQLJobsControllerServer *SQLJobsControllerServerTransport + trSQLOperationsStatusControllerServer *SQLOperationsStatusControllerServerTransport + trSQLRunAsAccountsControllerServer *SQLRunAsAccountsControllerServerTransport + trSQLServersControllerServer *SQLServersControllerServerTransport + trSQLSitesControllerServer *SQLSitesControllerServerTransport + trServerDependencyMapControllerServer *ServerDependencyMapControllerServerTransport + trServerJobsControllerServer *ServerJobsControllerServerTransport + trServerOperationsStatusControllerServer *ServerOperationsStatusControllerServerTransport + trServerRunAsAccountsControllerServer *ServerRunAsAccountsControllerServerTransport + trServerSitesControllerServer *ServerSitesControllerServerTransport + trServerSoftwareInventoriesControllerServer *ServerSoftwareInventoriesControllerServerTransport + trServersControllerServer *ServersControllerServerTransport + trSitesControllerServer *SitesControllerServerTransport + trTomcatWebApplicationsControllerServer *TomcatWebApplicationsControllerServerTransport + trTomcatWebServersControllerServer *TomcatWebServersControllerServerTransport + trVcenterControllerServer *VcenterControllerServerTransport + trVmwareHostControllerServer *VmwareHostControllerServerTransport + trVmwareOperationsStatusServer *VmwareOperationsStatusServerTransport + trVmwarePropertiesControllerServer *VmwarePropertiesControllerServerTransport + trVmwareSoftwareInventoriesControllerServer *VmwareSoftwareInventoriesControllerServerTransport + trWebAppDiscoverySiteDataSourcesControllerServer *WebAppDiscoverySiteDataSourcesControllerServerTransport + trWebAppExtendedMachinesControllerServer *WebAppExtendedMachinesControllerServerTransport + trWebAppPropertiesControllerServer *WebAppPropertiesControllerServerTransport + trWebAppRunAsAccountsControllerServer *WebAppRunAsAccountsControllerServerTransport + trWebAppSitesControllerServer *WebAppSitesControllerServerTransport + trWebApplicationsControllerServer *WebApplicationsControllerServerTransport + trWebServersControllerServer *WebServersControllerServerTransport } // Do implements the policy.Transporter interface for ServerFactoryTransport. @@ -74,56 +158,270 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { var err error switch client { - case "AssessedMachinesClient": - initServer(s, &s.trAssessedMachinesServer, func() *AssessedMachinesServerTransport { - return NewAssessedMachinesServerTransport(&s.srv.AssessedMachinesServer) - }) - resp, err = s.trAssessedMachinesServer.Do(req) - case "AssessmentsClient": - initServer(s, &s.trAssessmentsServer, func() *AssessmentsServerTransport { return NewAssessmentsServerTransport(&s.srv.AssessmentsServer) }) - resp, err = s.trAssessmentsServer.Do(req) - case "GroupsClient": - initServer(s, &s.trGroupsServer, func() *GroupsServerTransport { return NewGroupsServerTransport(&s.srv.GroupsServer) }) - resp, err = s.trGroupsServer.Do(req) - case "HyperVCollectorsClient": - initServer(s, &s.trHyperVCollectorsServer, func() *HyperVCollectorsServerTransport { - return NewHyperVCollectorsServerTransport(&s.srv.HyperVCollectorsServer) - }) - resp, err = s.trHyperVCollectorsServer.Do(req) - case "ImportCollectorsClient": - initServer(s, &s.trImportCollectorsServer, func() *ImportCollectorsServerTransport { - return NewImportCollectorsServerTransport(&s.srv.ImportCollectorsServer) - }) - resp, err = s.trImportCollectorsServer.Do(req) - case "MachinesClient": - initServer(s, &s.trMachinesServer, func() *MachinesServerTransport { return NewMachinesServerTransport(&s.srv.MachinesServer) }) - resp, err = s.trMachinesServer.Do(req) + case "DependencyMapControllerClient": + initServer(s, &s.trDependencyMapControllerServer, func() *DependencyMapControllerServerTransport { + return NewDependencyMapControllerServerTransport(&s.srv.DependencyMapControllerServer) + }) + resp, err = s.trDependencyMapControllerServer.Do(req) + case "HypervClusterControllerClient": + initServer(s, &s.trHypervClusterControllerServer, func() *HypervClusterControllerServerTransport { + return NewHypervClusterControllerServerTransport(&s.srv.HypervClusterControllerServer) + }) + resp, err = s.trHypervClusterControllerServer.Do(req) + case "HypervDependencyMapControllerClient": + initServer(s, &s.trHypervDependencyMapControllerServer, func() *HypervDependencyMapControllerServerTransport { + return NewHypervDependencyMapControllerServerTransport(&s.srv.HypervDependencyMapControllerServer) + }) + resp, err = s.trHypervDependencyMapControllerServer.Do(req) + case "HypervHostControllerClient": + initServer(s, &s.trHypervHostControllerServer, func() *HypervHostControllerServerTransport { + return NewHypervHostControllerServerTransport(&s.srv.HypervHostControllerServer) + }) + resp, err = s.trHypervHostControllerServer.Do(req) + case "HypervJobsClient": + initServer(s, &s.trHypervJobsServer, func() *HypervJobsServerTransport { return NewHypervJobsServerTransport(&s.srv.HypervJobsServer) }) + resp, err = s.trHypervJobsServer.Do(req) + case "HypervJobsControllerClient": + initServer(s, &s.trHypervJobsControllerServer, func() *HypervJobsControllerServerTransport { + return NewHypervJobsControllerServerTransport(&s.srv.HypervJobsControllerServer) + }) + resp, err = s.trHypervJobsControllerServer.Do(req) + case "HypervMachinesControllerClient": + initServer(s, &s.trHypervMachinesControllerServer, func() *HypervMachinesControllerServerTransport { + return NewHypervMachinesControllerServerTransport(&s.srv.HypervMachinesControllerServer) + }) + resp, err = s.trHypervMachinesControllerServer.Do(req) + case "HypervOperationsStatusControllerClient": + initServer(s, &s.trHypervOperationsStatusControllerServer, func() *HypervOperationsStatusControllerServerTransport { + return NewHypervOperationsStatusControllerServerTransport(&s.srv.HypervOperationsStatusControllerServer) + }) + resp, err = s.trHypervOperationsStatusControllerServer.Do(req) + case "HypervRunAsAccountsControllerClient": + initServer(s, &s.trHypervRunAsAccountsControllerServer, func() *HypervRunAsAccountsControllerServerTransport { + return NewHypervRunAsAccountsControllerServerTransport(&s.srv.HypervRunAsAccountsControllerServer) + }) + resp, err = s.trHypervRunAsAccountsControllerServer.Do(req) + case "HypervSitesClient": + initServer(s, &s.trHypervSitesServer, func() *HypervSitesServerTransport { return NewHypervSitesServerTransport(&s.srv.HypervSitesServer) }) + resp, err = s.trHypervSitesServer.Do(req) + case "HypervSitesControllerClient": + initServer(s, &s.trHypervSitesControllerServer, func() *HypervSitesControllerServerTransport { + return NewHypervSitesControllerServerTransport(&s.srv.HypervSitesControllerServer) + }) + resp, err = s.trHypervSitesControllerServer.Do(req) + case "HypervSoftwareInventoriesControllerClient": + initServer(s, &s.trHypervSoftwareInventoriesControllerServer, func() *HypervSoftwareInventoriesControllerServerTransport { + return NewHypervSoftwareInventoriesControllerServerTransport(&s.srv.HypervSoftwareInventoriesControllerServer) + }) + resp, err = s.trHypervSoftwareInventoriesControllerServer.Do(req) + case "IisWebApplicationsControllerClient": + initServer(s, &s.trIisWebApplicationsControllerServer, func() *IisWebApplicationsControllerServerTransport { + return NewIisWebApplicationsControllerServerTransport(&s.srv.IisWebApplicationsControllerServer) + }) + resp, err = s.trIisWebApplicationsControllerServer.Do(req) + case "IisWebServersControllerClient": + initServer(s, &s.trIisWebServersControllerServer, func() *IisWebServersControllerServerTransport { + return NewIisWebServersControllerServerTransport(&s.srv.IisWebServersControllerServer) + }) + resp, err = s.trIisWebServersControllerServer.Do(req) + case "ImportJobsControllerClient": + initServer(s, &s.trImportJobsControllerServer, func() *ImportJobsControllerServerTransport { + return NewImportJobsControllerServerTransport(&s.srv.ImportJobsControllerServer) + }) + resp, err = s.trImportJobsControllerServer.Do(req) + case "ImportMachinesControllerClient": + initServer(s, &s.trImportMachinesControllerServer, func() *ImportMachinesControllerServerTransport { + return NewImportMachinesControllerServerTransport(&s.srv.ImportMachinesControllerServer) + }) + resp, err = s.trImportMachinesControllerServer.Do(req) + case "ImportSitesControllerClient": + initServer(s, &s.trImportSitesControllerServer, func() *ImportSitesControllerServerTransport { + return NewImportSitesControllerServerTransport(&s.srv.ImportSitesControllerServer) + }) + resp, err = s.trImportSitesControllerServer.Do(req) + case "MachinesControllerClient": + initServer(s, &s.trMachinesControllerServer, func() *MachinesControllerServerTransport { + return NewMachinesControllerServerTransport(&s.srv.MachinesControllerServer) + }) + resp, err = s.trMachinesControllerServer.Do(req) + case "MasterSitesControllerClient": + initServer(s, &s.trMasterSitesControllerServer, func() *MasterSitesControllerServerTransport { + return NewMasterSitesControllerServerTransport(&s.srv.MasterSitesControllerServer) + }) + resp, err = s.trMasterSitesControllerServer.Do(req) + case "MasterSitesOperationsStatusControllerClient": + initServer(s, &s.trMasterSitesOperationsStatusControllerServer, func() *MasterSitesOperationsStatusControllerServerTransport { + return NewMasterSitesOperationsStatusControllerServerTransport(&s.srv.MasterSitesOperationsStatusControllerServer) + }) + resp, err = s.trMasterSitesOperationsStatusControllerServer.Do(req) case "OperationsClient": initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) resp, err = s.trOperationsServer.Do(req) - case "PrivateEndpointConnectionClient": - initServer(s, &s.trPrivateEndpointConnectionServer, func() *PrivateEndpointConnectionServerTransport { - return NewPrivateEndpointConnectionServerTransport(&s.srv.PrivateEndpointConnectionServer) - }) - resp, err = s.trPrivateEndpointConnectionServer.Do(req) - case "PrivateLinkResourceClient": - initServer(s, &s.trPrivateLinkResourceServer, func() *PrivateLinkResourceServerTransport { - return NewPrivateLinkResourceServerTransport(&s.srv.PrivateLinkResourceServer) - }) - resp, err = s.trPrivateLinkResourceServer.Do(req) - case "ProjectsClient": - initServer(s, &s.trProjectsServer, func() *ProjectsServerTransport { return NewProjectsServerTransport(&s.srv.ProjectsServer) }) - resp, err = s.trProjectsServer.Do(req) - case "ServerCollectorsClient": - initServer(s, &s.trServerCollectorsServer, func() *ServerCollectorsServerTransport { - return NewServerCollectorsServerTransport(&s.srv.ServerCollectorsServer) - }) - resp, err = s.trServerCollectorsServer.Do(req) - case "VMwareCollectorsClient": - initServer(s, &s.trVMwareCollectorsServer, func() *VMwareCollectorsServerTransport { - return NewVMwareCollectorsServerTransport(&s.srv.VMwareCollectorsServer) - }) - resp, err = s.trVMwareCollectorsServer.Do(req) + case "PrivateEndpointConnectionControllerClient": + initServer(s, &s.trPrivateEndpointConnectionControllerServer, func() *PrivateEndpointConnectionControllerServerTransport { + return NewPrivateEndpointConnectionControllerServerTransport(&s.srv.PrivateEndpointConnectionControllerServer) + }) + resp, err = s.trPrivateEndpointConnectionControllerServer.Do(req) + case "PrivateLinkResourcesControllerClient": + initServer(s, &s.trPrivateLinkResourcesControllerServer, func() *PrivateLinkResourcesControllerServerTransport { + return NewPrivateLinkResourcesControllerServerTransport(&s.srv.PrivateLinkResourcesControllerServer) + }) + resp, err = s.trPrivateLinkResourcesControllerServer.Do(req) + case "RunAsAccountsControllerClient": + initServer(s, &s.trRunAsAccountsControllerServer, func() *RunAsAccountsControllerServerTransport { + return NewRunAsAccountsControllerServerTransport(&s.srv.RunAsAccountsControllerServer) + }) + resp, err = s.trRunAsAccountsControllerServer.Do(req) + case "SQLAvailabilityGroupsControllerClient": + initServer(s, &s.trSQLAvailabilityGroupsControllerServer, func() *SQLAvailabilityGroupsControllerServerTransport { + return NewSQLAvailabilityGroupsControllerServerTransport(&s.srv.SQLAvailabilityGroupsControllerServer) + }) + resp, err = s.trSQLAvailabilityGroupsControllerServer.Do(req) + case "SQLDatabasesControllerClient": + initServer(s, &s.trSQLDatabasesControllerServer, func() *SQLDatabasesControllerServerTransport { + return NewSQLDatabasesControllerServerTransport(&s.srv.SQLDatabasesControllerServer) + }) + resp, err = s.trSQLDatabasesControllerServer.Do(req) + case "SQLDiscoverySiteDataSourceControllerClient": + initServer(s, &s.trSQLDiscoverySiteDataSourceControllerServer, func() *SQLDiscoverySiteDataSourceControllerServerTransport { + return NewSQLDiscoverySiteDataSourceControllerServerTransport(&s.srv.SQLDiscoverySiteDataSourceControllerServer) + }) + resp, err = s.trSQLDiscoverySiteDataSourceControllerServer.Do(req) + case "SQLJobsControllerClient": + initServer(s, &s.trSQLJobsControllerServer, func() *SQLJobsControllerServerTransport { + return NewSQLJobsControllerServerTransport(&s.srv.SQLJobsControllerServer) + }) + resp, err = s.trSQLJobsControllerServer.Do(req) + case "SQLOperationsStatusControllerClient": + initServer(s, &s.trSQLOperationsStatusControllerServer, func() *SQLOperationsStatusControllerServerTransport { + return NewSQLOperationsStatusControllerServerTransport(&s.srv.SQLOperationsStatusControllerServer) + }) + resp, err = s.trSQLOperationsStatusControllerServer.Do(req) + case "SQLRunAsAccountsControllerClient": + initServer(s, &s.trSQLRunAsAccountsControllerServer, func() *SQLRunAsAccountsControllerServerTransport { + return NewSQLRunAsAccountsControllerServerTransport(&s.srv.SQLRunAsAccountsControllerServer) + }) + resp, err = s.trSQLRunAsAccountsControllerServer.Do(req) + case "SQLServersControllerClient": + initServer(s, &s.trSQLServersControllerServer, func() *SQLServersControllerServerTransport { + return NewSQLServersControllerServerTransport(&s.srv.SQLServersControllerServer) + }) + resp, err = s.trSQLServersControllerServer.Do(req) + case "SQLSitesControllerClient": + initServer(s, &s.trSQLSitesControllerServer, func() *SQLSitesControllerServerTransport { + return NewSQLSitesControllerServerTransport(&s.srv.SQLSitesControllerServer) + }) + resp, err = s.trSQLSitesControllerServer.Do(req) + case "ServerDependencyMapControllerClient": + initServer(s, &s.trServerDependencyMapControllerServer, func() *ServerDependencyMapControllerServerTransport { + return NewServerDependencyMapControllerServerTransport(&s.srv.ServerDependencyMapControllerServer) + }) + resp, err = s.trServerDependencyMapControllerServer.Do(req) + case "ServerJobsControllerClient": + initServer(s, &s.trServerJobsControllerServer, func() *ServerJobsControllerServerTransport { + return NewServerJobsControllerServerTransport(&s.srv.ServerJobsControllerServer) + }) + resp, err = s.trServerJobsControllerServer.Do(req) + case "ServerOperationsStatusControllerClient": + initServer(s, &s.trServerOperationsStatusControllerServer, func() *ServerOperationsStatusControllerServerTransport { + return NewServerOperationsStatusControllerServerTransport(&s.srv.ServerOperationsStatusControllerServer) + }) + resp, err = s.trServerOperationsStatusControllerServer.Do(req) + case "ServerRunAsAccountsControllerClient": + initServer(s, &s.trServerRunAsAccountsControllerServer, func() *ServerRunAsAccountsControllerServerTransport { + return NewServerRunAsAccountsControllerServerTransport(&s.srv.ServerRunAsAccountsControllerServer) + }) + resp, err = s.trServerRunAsAccountsControllerServer.Do(req) + case "ServerSitesControllerClient": + initServer(s, &s.trServerSitesControllerServer, func() *ServerSitesControllerServerTransport { + return NewServerSitesControllerServerTransport(&s.srv.ServerSitesControllerServer) + }) + resp, err = s.trServerSitesControllerServer.Do(req) + case "ServerSoftwareInventoriesControllerClient": + initServer(s, &s.trServerSoftwareInventoriesControllerServer, func() *ServerSoftwareInventoriesControllerServerTransport { + return NewServerSoftwareInventoriesControllerServerTransport(&s.srv.ServerSoftwareInventoriesControllerServer) + }) + resp, err = s.trServerSoftwareInventoriesControllerServer.Do(req) + case "ServersControllerClient": + initServer(s, &s.trServersControllerServer, func() *ServersControllerServerTransport { + return NewServersControllerServerTransport(&s.srv.ServersControllerServer) + }) + resp, err = s.trServersControllerServer.Do(req) + case "SitesControllerClient": + initServer(s, &s.trSitesControllerServer, func() *SitesControllerServerTransport { + return NewSitesControllerServerTransport(&s.srv.SitesControllerServer) + }) + resp, err = s.trSitesControllerServer.Do(req) + case "TomcatWebApplicationsControllerClient": + initServer(s, &s.trTomcatWebApplicationsControllerServer, func() *TomcatWebApplicationsControllerServerTransport { + return NewTomcatWebApplicationsControllerServerTransport(&s.srv.TomcatWebApplicationsControllerServer) + }) + resp, err = s.trTomcatWebApplicationsControllerServer.Do(req) + case "TomcatWebServersControllerClient": + initServer(s, &s.trTomcatWebServersControllerServer, func() *TomcatWebServersControllerServerTransport { + return NewTomcatWebServersControllerServerTransport(&s.srv.TomcatWebServersControllerServer) + }) + resp, err = s.trTomcatWebServersControllerServer.Do(req) + case "VcenterControllerClient": + initServer(s, &s.trVcenterControllerServer, func() *VcenterControllerServerTransport { + return NewVcenterControllerServerTransport(&s.srv.VcenterControllerServer) + }) + resp, err = s.trVcenterControllerServer.Do(req) + case "VmwareHostControllerClient": + initServer(s, &s.trVmwareHostControllerServer, func() *VmwareHostControllerServerTransport { + return NewVmwareHostControllerServerTransport(&s.srv.VmwareHostControllerServer) + }) + resp, err = s.trVmwareHostControllerServer.Do(req) + case "VmwareOperationsStatusClient": + initServer(s, &s.trVmwareOperationsStatusServer, func() *VmwareOperationsStatusServerTransport { + return NewVmwareOperationsStatusServerTransport(&s.srv.VmwareOperationsStatusServer) + }) + resp, err = s.trVmwareOperationsStatusServer.Do(req) + case "VmwarePropertiesControllerClient": + initServer(s, &s.trVmwarePropertiesControllerServer, func() *VmwarePropertiesControllerServerTransport { + return NewVmwarePropertiesControllerServerTransport(&s.srv.VmwarePropertiesControllerServer) + }) + resp, err = s.trVmwarePropertiesControllerServer.Do(req) + case "VmwareSoftwareInventoriesControllerClient": + initServer(s, &s.trVmwareSoftwareInventoriesControllerServer, func() *VmwareSoftwareInventoriesControllerServerTransport { + return NewVmwareSoftwareInventoriesControllerServerTransport(&s.srv.VmwareSoftwareInventoriesControllerServer) + }) + resp, err = s.trVmwareSoftwareInventoriesControllerServer.Do(req) + case "WebAppDiscoverySiteDataSourcesControllerClient": + initServer(s, &s.trWebAppDiscoverySiteDataSourcesControllerServer, func() *WebAppDiscoverySiteDataSourcesControllerServerTransport { + return NewWebAppDiscoverySiteDataSourcesControllerServerTransport(&s.srv.WebAppDiscoverySiteDataSourcesControllerServer) + }) + resp, err = s.trWebAppDiscoverySiteDataSourcesControllerServer.Do(req) + case "WebAppExtendedMachinesControllerClient": + initServer(s, &s.trWebAppExtendedMachinesControllerServer, func() *WebAppExtendedMachinesControllerServerTransport { + return NewWebAppExtendedMachinesControllerServerTransport(&s.srv.WebAppExtendedMachinesControllerServer) + }) + resp, err = s.trWebAppExtendedMachinesControllerServer.Do(req) + case "WebAppPropertiesControllerClient": + initServer(s, &s.trWebAppPropertiesControllerServer, func() *WebAppPropertiesControllerServerTransport { + return NewWebAppPropertiesControllerServerTransport(&s.srv.WebAppPropertiesControllerServer) + }) + resp, err = s.trWebAppPropertiesControllerServer.Do(req) + case "WebAppRunAsAccountsControllerClient": + initServer(s, &s.trWebAppRunAsAccountsControllerServer, func() *WebAppRunAsAccountsControllerServerTransport { + return NewWebAppRunAsAccountsControllerServerTransport(&s.srv.WebAppRunAsAccountsControllerServer) + }) + resp, err = s.trWebAppRunAsAccountsControllerServer.Do(req) + case "WebAppSitesControllerClient": + initServer(s, &s.trWebAppSitesControllerServer, func() *WebAppSitesControllerServerTransport { + return NewWebAppSitesControllerServerTransport(&s.srv.WebAppSitesControllerServer) + }) + resp, err = s.trWebAppSitesControllerServer.Do(req) + case "WebApplicationsControllerClient": + initServer(s, &s.trWebApplicationsControllerServer, func() *WebApplicationsControllerServerTransport { + return NewWebApplicationsControllerServerTransport(&s.srv.WebApplicationsControllerServer) + }) + resp, err = s.trWebApplicationsControllerServer.Do(req) + case "WebServersControllerClient": + initServer(s, &s.trWebServersControllerServer, func() *WebServersControllerServerTransport { + return NewWebServersControllerServerTransport(&s.srv.WebServersControllerServer) + }) + resp, err = s.trWebServersControllerServer.Do(req) default: err = fmt.Errorf("unhandled client %s", client) } diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/servercollectors_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/servercollectors_server.go deleted file mode 100644 index 151979dcf612..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/fake/servercollectors_server.go +++ /dev/null @@ -1,258 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" - "net/http" - "net/url" - "reflect" - "regexp" -) - -// ServerCollectorsServer is a fake server for instances of the armmigrate.ServerCollectorsClient type. -type ServerCollectorsServer struct { - // Create is the fake for method ServerCollectorsClient.Create - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - Create func(ctx context.Context, resourceGroupName string, projectName string, serverCollectorName string, options *armmigrate.ServerCollectorsClientCreateOptions) (resp azfake.Responder[armmigrate.ServerCollectorsClientCreateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method ServerCollectorsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, projectName string, serverCollectorName string, options *armmigrate.ServerCollectorsClientDeleteOptions) (resp azfake.Responder[armmigrate.ServerCollectorsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method ServerCollectorsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, projectName string, serverCollectorName string, options *armmigrate.ServerCollectorsClientGetOptions) (resp azfake.Responder[armmigrate.ServerCollectorsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByProjectPager is the fake for method ServerCollectorsClient.NewListByProjectPager - // HTTP status codes to indicate success: http.StatusOK - NewListByProjectPager func(resourceGroupName string, projectName string, options *armmigrate.ServerCollectorsClientListByProjectOptions) (resp azfake.PagerResponder[armmigrate.ServerCollectorsClientListByProjectResponse]) -} - -// NewServerCollectorsServerTransport creates a new instance of ServerCollectorsServerTransport with the provided implementation. -// The returned ServerCollectorsServerTransport instance is connected to an instance of armmigrate.ServerCollectorsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewServerCollectorsServerTransport(srv *ServerCollectorsServer) *ServerCollectorsServerTransport { - return &ServerCollectorsServerTransport{ - srv: srv, - newListByProjectPager: newTracker[azfake.PagerResponder[armmigrate.ServerCollectorsClientListByProjectResponse]](), - } -} - -// ServerCollectorsServerTransport connects instances of armmigrate.ServerCollectorsClient to instances of ServerCollectorsServer. -// Don't use this type directly, use NewServerCollectorsServerTransport instead. -type ServerCollectorsServerTransport struct { - srv *ServerCollectorsServer - newListByProjectPager *tracker[azfake.PagerResponder[armmigrate.ServerCollectorsClientListByProjectResponse]] -} - -// Do implements the policy.Transporter interface for ServerCollectorsServerTransport. -func (s *ServerCollectorsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "ServerCollectorsClient.Create": - resp, err = s.dispatchCreate(req) - case "ServerCollectorsClient.Delete": - resp, err = s.dispatchDelete(req) - case "ServerCollectorsClient.Get": - resp, err = s.dispatchGet(req) - case "ServerCollectorsClient.NewListByProjectPager": - resp, err = s.dispatchNewListByProjectPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (s *ServerCollectorsServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { - if s.srv.Create == nil { - return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/servercollectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmigrate.ServerCollector](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - serverCollectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("serverCollectorName")]) - if err != nil { - return nil, err - } - var options *armmigrate.ServerCollectorsClientCreateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armmigrate.ServerCollectorsClientCreateOptions{ - CollectorBody: &body, - } - } - respr, errRespr := s.srv.Create(req.Context(), resourceGroupNameParam, projectNameParam, serverCollectorNameParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ServerCollector, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (s *ServerCollectorsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if s.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/servercollectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - serverCollectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("serverCollectorName")]) - if err != nil { - return nil, err - } - respr, errRespr := s.srv.Delete(req.Context(), resourceGroupNameParam, projectNameParam, serverCollectorNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (s *ServerCollectorsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if s.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/servercollectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - serverCollectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("serverCollectorName")]) - if err != nil { - return nil, err - } - respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, projectNameParam, serverCollectorNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ServerCollector, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (s *ServerCollectorsServerTransport) dispatchNewListByProjectPager(req *http.Request) (*http.Response, error) { - if s.srv.NewListByProjectPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByProjectPager not implemented")} - } - newListByProjectPager := s.newListByProjectPager.get(req) - if newListByProjectPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/servercollectors` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - resp := s.srv.NewListByProjectPager(resourceGroupNameParam, projectNameParam, nil) - newListByProjectPager = &resp - s.newListByProjectPager.add(req, newListByProjectPager) - } - resp, err := server.PagerResponderNext(newListByProjectPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - s.newListByProjectPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByProjectPager) { - s.newListByProjectPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/serverdependencymapcontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/serverdependencymapcontroller_server.go new file mode 100644 index 000000000000..e45221ba1575 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/serverdependencymapcontroller_server.go @@ -0,0 +1,343 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" +) + +// ServerDependencyMapControllerServer is a fake server for instances of the armmigrate.ServerDependencyMapControllerClient type. +type ServerDependencyMapControllerServer struct { + // BeginClientGroupMembers is the fake for method ServerDependencyMapControllerClient.BeginClientGroupMembers + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginClientGroupMembers func(ctx context.Context, resourceGroupName string, siteName string, mapRequest armmigrate.DependencyMapServiceMapextensionsClientGroupMembersRequest, options *armmigrate.ServerDependencyMapControllerClientBeginClientGroupMembersOptions) (resp azfake.PollerResponder[armmigrate.ServerDependencyMapControllerClientClientGroupMembersResponse], errResp azfake.ErrorResponder) + + // BeginExportDependencies is the fake for method ServerDependencyMapControllerClient.BeginExportDependencies + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginExportDependencies func(ctx context.Context, resourceGroupName string, siteName string, requestBody armmigrate.DependencyMapServiceMapextensionsExportDependenciesRequest, options *armmigrate.ServerDependencyMapControllerClientBeginExportDependenciesOptions) (resp azfake.PollerResponder[armmigrate.ServerDependencyMapControllerClientExportDependenciesResponse], errResp azfake.ErrorResponder) + + // BeginGenerateCoarseMap is the fake for method ServerDependencyMapControllerClient.BeginGenerateCoarseMap + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginGenerateCoarseMap func(ctx context.Context, resourceGroupName string, siteName string, mapRequest armmigrate.DependencyMapServiceMapextensionsScopeMapRequest, options *armmigrate.ServerDependencyMapControllerClientBeginGenerateCoarseMapOptions) (resp azfake.PollerResponder[armmigrate.ServerDependencyMapControllerClientGenerateCoarseMapResponse], errResp azfake.ErrorResponder) + + // BeginGenerateDetailedMap is the fake for method ServerDependencyMapControllerClient.BeginGenerateDetailedMap + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginGenerateDetailedMap func(ctx context.Context, resourceGroupName string, siteName string, mapRequest armmigrate.DependencyMapServiceMapextensionsSingleMachineDetailedMapRequest, options *armmigrate.ServerDependencyMapControllerClientBeginGenerateDetailedMapOptions) (resp azfake.PollerResponder[armmigrate.ServerDependencyMapControllerClientGenerateDetailedMapResponse], errResp azfake.ErrorResponder) + + // BeginServerGroupMembers is the fake for method ServerDependencyMapControllerClient.BeginServerGroupMembers + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginServerGroupMembers func(ctx context.Context, resourceGroupName string, siteName string, mapRequest armmigrate.DependencyMapServiceMapextensionsServerGroupMembersRequest, options *armmigrate.ServerDependencyMapControllerClientBeginServerGroupMembersOptions) (resp azfake.PollerResponder[armmigrate.ServerDependencyMapControllerClientServerGroupMembersResponse], errResp azfake.ErrorResponder) +} + +// NewServerDependencyMapControllerServerTransport creates a new instance of ServerDependencyMapControllerServerTransport with the provided implementation. +// The returned ServerDependencyMapControllerServerTransport instance is connected to an instance of armmigrate.ServerDependencyMapControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewServerDependencyMapControllerServerTransport(srv *ServerDependencyMapControllerServer) *ServerDependencyMapControllerServerTransport { + return &ServerDependencyMapControllerServerTransport{ + srv: srv, + beginClientGroupMembers: newTracker[azfake.PollerResponder[armmigrate.ServerDependencyMapControllerClientClientGroupMembersResponse]](), + beginExportDependencies: newTracker[azfake.PollerResponder[armmigrate.ServerDependencyMapControllerClientExportDependenciesResponse]](), + beginGenerateCoarseMap: newTracker[azfake.PollerResponder[armmigrate.ServerDependencyMapControllerClientGenerateCoarseMapResponse]](), + beginGenerateDetailedMap: newTracker[azfake.PollerResponder[armmigrate.ServerDependencyMapControllerClientGenerateDetailedMapResponse]](), + beginServerGroupMembers: newTracker[azfake.PollerResponder[armmigrate.ServerDependencyMapControllerClientServerGroupMembersResponse]](), + } +} + +// ServerDependencyMapControllerServerTransport connects instances of armmigrate.ServerDependencyMapControllerClient to instances of ServerDependencyMapControllerServer. +// Don't use this type directly, use NewServerDependencyMapControllerServerTransport instead. +type ServerDependencyMapControllerServerTransport struct { + srv *ServerDependencyMapControllerServer + beginClientGroupMembers *tracker[azfake.PollerResponder[armmigrate.ServerDependencyMapControllerClientClientGroupMembersResponse]] + beginExportDependencies *tracker[azfake.PollerResponder[armmigrate.ServerDependencyMapControllerClientExportDependenciesResponse]] + beginGenerateCoarseMap *tracker[azfake.PollerResponder[armmigrate.ServerDependencyMapControllerClientGenerateCoarseMapResponse]] + beginGenerateDetailedMap *tracker[azfake.PollerResponder[armmigrate.ServerDependencyMapControllerClientGenerateDetailedMapResponse]] + beginServerGroupMembers *tracker[azfake.PollerResponder[armmigrate.ServerDependencyMapControllerClientServerGroupMembersResponse]] +} + +// Do implements the policy.Transporter interface for ServerDependencyMapControllerServerTransport. +func (s *ServerDependencyMapControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ServerDependencyMapControllerClient.BeginClientGroupMembers": + resp, err = s.dispatchBeginClientGroupMembers(req) + case "ServerDependencyMapControllerClient.BeginExportDependencies": + resp, err = s.dispatchBeginExportDependencies(req) + case "ServerDependencyMapControllerClient.BeginGenerateCoarseMap": + resp, err = s.dispatchBeginGenerateCoarseMap(req) + case "ServerDependencyMapControllerClient.BeginGenerateDetailedMap": + resp, err = s.dispatchBeginGenerateDetailedMap(req) + case "ServerDependencyMapControllerClient.BeginServerGroupMembers": + resp, err = s.dispatchBeginServerGroupMembers(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *ServerDependencyMapControllerServerTransport) dispatchBeginClientGroupMembers(req *http.Request) (*http.Response, error) { + if s.srv.BeginClientGroupMembers == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginClientGroupMembers not implemented")} + } + beginClientGroupMembers := s.beginClientGroupMembers.get(req) + if beginClientGroupMembers == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/serverSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/clientGroupMembers` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.DependencyMapServiceMapextensionsClientGroupMembersRequest](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginClientGroupMembers(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginClientGroupMembers = &respr + s.beginClientGroupMembers.add(req, beginClientGroupMembers) + } + + resp, err := server.PollerResponderNext(beginClientGroupMembers, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + s.beginClientGroupMembers.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginClientGroupMembers) { + s.beginClientGroupMembers.remove(req) + } + + return resp, nil +} + +func (s *ServerDependencyMapControllerServerTransport) dispatchBeginExportDependencies(req *http.Request) (*http.Response, error) { + if s.srv.BeginExportDependencies == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginExportDependencies not implemented")} + } + beginExportDependencies := s.beginExportDependencies.get(req) + if beginExportDependencies == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/serverSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/exportDependencies` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.DependencyMapServiceMapextensionsExportDependenciesRequest](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginExportDependencies(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginExportDependencies = &respr + s.beginExportDependencies.add(req, beginExportDependencies) + } + + resp, err := server.PollerResponderNext(beginExportDependencies, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + s.beginExportDependencies.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginExportDependencies) { + s.beginExportDependencies.remove(req) + } + + return resp, nil +} + +func (s *ServerDependencyMapControllerServerTransport) dispatchBeginGenerateCoarseMap(req *http.Request) (*http.Response, error) { + if s.srv.BeginGenerateCoarseMap == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginGenerateCoarseMap not implemented")} + } + beginGenerateCoarseMap := s.beginGenerateCoarseMap.get(req) + if beginGenerateCoarseMap == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/serverSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/generateCoarseMap` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.DependencyMapServiceMapextensionsScopeMapRequest](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginGenerateCoarseMap(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginGenerateCoarseMap = &respr + s.beginGenerateCoarseMap.add(req, beginGenerateCoarseMap) + } + + resp, err := server.PollerResponderNext(beginGenerateCoarseMap, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + s.beginGenerateCoarseMap.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginGenerateCoarseMap) { + s.beginGenerateCoarseMap.remove(req) + } + + return resp, nil +} + +func (s *ServerDependencyMapControllerServerTransport) dispatchBeginGenerateDetailedMap(req *http.Request) (*http.Response, error) { + if s.srv.BeginGenerateDetailedMap == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginGenerateDetailedMap not implemented")} + } + beginGenerateDetailedMap := s.beginGenerateDetailedMap.get(req) + if beginGenerateDetailedMap == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/serverSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/generateDetailedMap` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.DependencyMapServiceMapextensionsSingleMachineDetailedMapRequest](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginGenerateDetailedMap(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginGenerateDetailedMap = &respr + s.beginGenerateDetailedMap.add(req, beginGenerateDetailedMap) + } + + resp, err := server.PollerResponderNext(beginGenerateDetailedMap, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + s.beginGenerateDetailedMap.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginGenerateDetailedMap) { + s.beginGenerateDetailedMap.remove(req) + } + + return resp, nil +} + +func (s *ServerDependencyMapControllerServerTransport) dispatchBeginServerGroupMembers(req *http.Request) (*http.Response, error) { + if s.srv.BeginServerGroupMembers == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginServerGroupMembers not implemented")} + } + beginServerGroupMembers := s.beginServerGroupMembers.get(req) + if beginServerGroupMembers == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/serverSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/serverGroupMembers` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.DependencyMapServiceMapextensionsServerGroupMembersRequest](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginServerGroupMembers(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginServerGroupMembers = &respr + s.beginServerGroupMembers.add(req, beginServerGroupMembers) + } + + resp, err := server.PollerResponderNext(beginServerGroupMembers, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + s.beginServerGroupMembers.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginServerGroupMembers) { + s.beginServerGroupMembers.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/serverjobscontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/serverjobscontroller_server.go new file mode 100644 index 000000000000..608df39b4f30 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/serverjobscontroller_server.go @@ -0,0 +1,156 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" +) + +// ServerJobsControllerServer is a fake server for instances of the armmigrate.ServerJobsControllerClient type. +type ServerJobsControllerServer struct { + // Get is the fake for method ServerJobsControllerClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, siteName string, jobName string, options *armmigrate.ServerJobsControllerClientGetOptions) (resp azfake.Responder[armmigrate.ServerJobsControllerClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByServerSiteResourcePager is the fake for method ServerJobsControllerClient.NewListByServerSiteResourcePager + // HTTP status codes to indicate success: http.StatusOK + NewListByServerSiteResourcePager func(resourceGroupName string, siteName string, options *armmigrate.ServerJobsControllerClientListByServerSiteResourceOptions) (resp azfake.PagerResponder[armmigrate.ServerJobsControllerClientListByServerSiteResourceResponse]) +} + +// NewServerJobsControllerServerTransport creates a new instance of ServerJobsControllerServerTransport with the provided implementation. +// The returned ServerJobsControllerServerTransport instance is connected to an instance of armmigrate.ServerJobsControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewServerJobsControllerServerTransport(srv *ServerJobsControllerServer) *ServerJobsControllerServerTransport { + return &ServerJobsControllerServerTransport{ + srv: srv, + newListByServerSiteResourcePager: newTracker[azfake.PagerResponder[armmigrate.ServerJobsControllerClientListByServerSiteResourceResponse]](), + } +} + +// ServerJobsControllerServerTransport connects instances of armmigrate.ServerJobsControllerClient to instances of ServerJobsControllerServer. +// Don't use this type directly, use NewServerJobsControllerServerTransport instead. +type ServerJobsControllerServerTransport struct { + srv *ServerJobsControllerServer + newListByServerSiteResourcePager *tracker[azfake.PagerResponder[armmigrate.ServerJobsControllerClientListByServerSiteResourceResponse]] +} + +// Do implements the policy.Transporter interface for ServerJobsControllerServerTransport. +func (s *ServerJobsControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ServerJobsControllerClient.Get": + resp, err = s.dispatchGet(req) + case "ServerJobsControllerClient.NewListByServerSiteResourcePager": + resp, err = s.dispatchNewListByServerSiteResourcePager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *ServerJobsControllerServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if s.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/serverSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/jobs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + jobNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("jobName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, siteNameParam, jobNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ServerJob, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *ServerJobsControllerServerTransport) dispatchNewListByServerSiteResourcePager(req *http.Request) (*http.Response, error) { + if s.srv.NewListByServerSiteResourcePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByServerSiteResourcePager not implemented")} + } + newListByServerSiteResourcePager := s.newListByServerSiteResourcePager.get(req) + if newListByServerSiteResourcePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/serverSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/jobs` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + resp := s.srv.NewListByServerSiteResourcePager(resourceGroupNameParam, siteNameParam, nil) + newListByServerSiteResourcePager = &resp + s.newListByServerSiteResourcePager.add(req, newListByServerSiteResourcePager) + server.PagerResponderInjectNextLinks(newListByServerSiteResourcePager, req, func(page *armmigrate.ServerJobsControllerClientListByServerSiteResourceResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByServerSiteResourcePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListByServerSiteResourcePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByServerSiteResourcePager) { + s.newListByServerSiteResourcePager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/serveroperationsstatuscontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/serveroperationsstatuscontroller_server.go new file mode 100644 index 000000000000..1991a6c98a82 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/serveroperationsstatuscontroller_server.go @@ -0,0 +1,104 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" +) + +// ServerOperationsStatusControllerServer is a fake server for instances of the armmigrate.ServerOperationsStatusControllerClient type. +type ServerOperationsStatusControllerServer struct { + // GetServerSiteOperationsStatus is the fake for method ServerOperationsStatusControllerClient.GetServerSiteOperationsStatus + // HTTP status codes to indicate success: http.StatusOK + GetServerSiteOperationsStatus func(ctx context.Context, resourceGroupName string, siteName string, operationStatusName string, options *armmigrate.ServerOperationsStatusControllerClientGetServerSiteOperationsStatusOptions) (resp azfake.Responder[armmigrate.ServerOperationsStatusControllerClientGetServerSiteOperationsStatusResponse], errResp azfake.ErrorResponder) +} + +// NewServerOperationsStatusControllerServerTransport creates a new instance of ServerOperationsStatusControllerServerTransport with the provided implementation. +// The returned ServerOperationsStatusControllerServerTransport instance is connected to an instance of armmigrate.ServerOperationsStatusControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewServerOperationsStatusControllerServerTransport(srv *ServerOperationsStatusControllerServer) *ServerOperationsStatusControllerServerTransport { + return &ServerOperationsStatusControllerServerTransport{srv: srv} +} + +// ServerOperationsStatusControllerServerTransport connects instances of armmigrate.ServerOperationsStatusControllerClient to instances of ServerOperationsStatusControllerServer. +// Don't use this type directly, use NewServerOperationsStatusControllerServerTransport instead. +type ServerOperationsStatusControllerServerTransport struct { + srv *ServerOperationsStatusControllerServer +} + +// Do implements the policy.Transporter interface for ServerOperationsStatusControllerServerTransport. +func (s *ServerOperationsStatusControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ServerOperationsStatusControllerClient.GetServerSiteOperationsStatus": + resp, err = s.dispatchGetServerSiteOperationsStatus(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *ServerOperationsStatusControllerServerTransport) dispatchGetServerSiteOperationsStatus(req *http.Request) (*http.Response, error) { + if s.srv.GetServerSiteOperationsStatus == nil { + return nil, &nonRetriableError{errors.New("fake for method GetServerSiteOperationsStatus not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/serverSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operationsStatus/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + operationStatusNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationStatusName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.GetServerSiteOperationsStatus(req.Context(), resourceGroupNameParam, siteNameParam, operationStatusNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationStatus, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/serverrunasaccountscontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/serverrunasaccountscontroller_server.go new file mode 100644 index 000000000000..7dceccaffc0a --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/serverrunasaccountscontroller_server.go @@ -0,0 +1,156 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" +) + +// ServerRunAsAccountsControllerServer is a fake server for instances of the armmigrate.ServerRunAsAccountsControllerClient type. +type ServerRunAsAccountsControllerServer struct { + // Get is the fake for method ServerRunAsAccountsControllerClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, siteName string, accountName string, options *armmigrate.ServerRunAsAccountsControllerClientGetOptions) (resp azfake.Responder[armmigrate.ServerRunAsAccountsControllerClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByServerSiteResourcePager is the fake for method ServerRunAsAccountsControllerClient.NewListByServerSiteResourcePager + // HTTP status codes to indicate success: http.StatusOK + NewListByServerSiteResourcePager func(resourceGroupName string, siteName string, options *armmigrate.ServerRunAsAccountsControllerClientListByServerSiteResourceOptions) (resp azfake.PagerResponder[armmigrate.ServerRunAsAccountsControllerClientListByServerSiteResourceResponse]) +} + +// NewServerRunAsAccountsControllerServerTransport creates a new instance of ServerRunAsAccountsControllerServerTransport with the provided implementation. +// The returned ServerRunAsAccountsControllerServerTransport instance is connected to an instance of armmigrate.ServerRunAsAccountsControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewServerRunAsAccountsControllerServerTransport(srv *ServerRunAsAccountsControllerServer) *ServerRunAsAccountsControllerServerTransport { + return &ServerRunAsAccountsControllerServerTransport{ + srv: srv, + newListByServerSiteResourcePager: newTracker[azfake.PagerResponder[armmigrate.ServerRunAsAccountsControllerClientListByServerSiteResourceResponse]](), + } +} + +// ServerRunAsAccountsControllerServerTransport connects instances of armmigrate.ServerRunAsAccountsControllerClient to instances of ServerRunAsAccountsControllerServer. +// Don't use this type directly, use NewServerRunAsAccountsControllerServerTransport instead. +type ServerRunAsAccountsControllerServerTransport struct { + srv *ServerRunAsAccountsControllerServer + newListByServerSiteResourcePager *tracker[azfake.PagerResponder[armmigrate.ServerRunAsAccountsControllerClientListByServerSiteResourceResponse]] +} + +// Do implements the policy.Transporter interface for ServerRunAsAccountsControllerServerTransport. +func (s *ServerRunAsAccountsControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ServerRunAsAccountsControllerClient.Get": + resp, err = s.dispatchGet(req) + case "ServerRunAsAccountsControllerClient.NewListByServerSiteResourcePager": + resp, err = s.dispatchNewListByServerSiteResourcePager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *ServerRunAsAccountsControllerServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if s.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/serverSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/runAsAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, siteNameParam, accountNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ServerRunAsAccount, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *ServerRunAsAccountsControllerServerTransport) dispatchNewListByServerSiteResourcePager(req *http.Request) (*http.Response, error) { + if s.srv.NewListByServerSiteResourcePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByServerSiteResourcePager not implemented")} + } + newListByServerSiteResourcePager := s.newListByServerSiteResourcePager.get(req) + if newListByServerSiteResourcePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/serverSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/runAsAccounts` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + resp := s.srv.NewListByServerSiteResourcePager(resourceGroupNameParam, siteNameParam, nil) + newListByServerSiteResourcePager = &resp + s.newListByServerSiteResourcePager.add(req, newListByServerSiteResourcePager) + server.PagerResponderInjectNextLinks(newListByServerSiteResourcePager, req, func(page *armmigrate.ServerRunAsAccountsControllerClientListByServerSiteResourceResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByServerSiteResourcePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListByServerSiteResourcePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByServerSiteResourcePager) { + s.newListByServerSiteResourcePager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/serverscontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/serverscontroller_server.go new file mode 100644 index 000000000000..5f09d8dca086 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/serverscontroller_server.go @@ -0,0 +1,286 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// ServersControllerServer is a fake server for instances of the armmigrate.ServersControllerClient type. +type ServersControllerServer struct { + // DeleteMachine is the fake for method ServersControllerClient.DeleteMachine + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + DeleteMachine func(ctx context.Context, resourceGroupName string, siteName string, machineName string, options *armmigrate.ServersControllerClientDeleteMachineOptions) (resp azfake.Responder[armmigrate.ServersControllerClientDeleteMachineResponse], errResp azfake.ErrorResponder) + + // GetMachine is the fake for method ServersControllerClient.GetMachine + // HTTP status codes to indicate success: http.StatusOK + GetMachine func(ctx context.Context, resourceGroupName string, siteName string, machineName string, options *armmigrate.ServersControllerClientGetMachineOptions) (resp azfake.Responder[armmigrate.ServersControllerClientGetMachineResponse], errResp azfake.ErrorResponder) + + // NewListByServerSiteResourcePager is the fake for method ServersControllerClient.NewListByServerSiteResourcePager + // HTTP status codes to indicate success: http.StatusOK + NewListByServerSiteResourcePager func(resourceGroupName string, siteName string, options *armmigrate.ServersControllerClientListByServerSiteResourceOptions) (resp azfake.PagerResponder[armmigrate.ServersControllerClientListByServerSiteResourceResponse]) + + // UpdateMachine is the fake for method ServersControllerClient.UpdateMachine + // HTTP status codes to indicate success: http.StatusOK + UpdateMachine func(ctx context.Context, resourceGroupName string, siteName string, machineName string, body armmigrate.ServerUpdate, options *armmigrate.ServersControllerClientUpdateMachineOptions) (resp azfake.Responder[armmigrate.ServersControllerClientUpdateMachineResponse], errResp azfake.ErrorResponder) +} + +// NewServersControllerServerTransport creates a new instance of ServersControllerServerTransport with the provided implementation. +// The returned ServersControllerServerTransport instance is connected to an instance of armmigrate.ServersControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewServersControllerServerTransport(srv *ServersControllerServer) *ServersControllerServerTransport { + return &ServersControllerServerTransport{ + srv: srv, + newListByServerSiteResourcePager: newTracker[azfake.PagerResponder[armmigrate.ServersControllerClientListByServerSiteResourceResponse]](), + } +} + +// ServersControllerServerTransport connects instances of armmigrate.ServersControllerClient to instances of ServersControllerServer. +// Don't use this type directly, use NewServersControllerServerTransport instead. +type ServersControllerServerTransport struct { + srv *ServersControllerServer + newListByServerSiteResourcePager *tracker[azfake.PagerResponder[armmigrate.ServersControllerClientListByServerSiteResourceResponse]] +} + +// Do implements the policy.Transporter interface for ServersControllerServerTransport. +func (s *ServersControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ServersControllerClient.DeleteMachine": + resp, err = s.dispatchDeleteMachine(req) + case "ServersControllerClient.GetMachine": + resp, err = s.dispatchGetMachine(req) + case "ServersControllerClient.NewListByServerSiteResourcePager": + resp, err = s.dispatchNewListByServerSiteResourcePager(req) + case "ServersControllerClient.UpdateMachine": + resp, err = s.dispatchUpdateMachine(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *ServersControllerServerTransport) dispatchDeleteMachine(req *http.Request) (*http.Response, error) { + if s.srv.DeleteMachine == nil { + return nil, &nonRetriableError{errors.New("fake for method DeleteMachine not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/serverSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/machines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + machineNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("machineName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.DeleteMachine(req.Context(), resourceGroupNameParam, siteNameParam, machineNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *ServersControllerServerTransport) dispatchGetMachine(req *http.Request) (*http.Response, error) { + if s.srv.GetMachine == nil { + return nil, &nonRetriableError{errors.New("fake for method GetMachine not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/serverSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/machines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + machineNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("machineName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.GetMachine(req.Context(), resourceGroupNameParam, siteNameParam, machineNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Server, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *ServersControllerServerTransport) dispatchNewListByServerSiteResourcePager(req *http.Request) (*http.Response, error) { + if s.srv.NewListByServerSiteResourcePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByServerSiteResourcePager not implemented")} + } + newListByServerSiteResourcePager := s.newListByServerSiteResourcePager.get(req) + if newListByServerSiteResourcePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/serverSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/machines` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("top")) + if err != nil { + return nil, err + } + topParam := getOptional(topUnescaped) + continuationTokenUnescaped, err := url.QueryUnescape(qp.Get("continuationToken")) + if err != nil { + return nil, err + } + continuationTokenParam := getOptional(continuationTokenUnescaped) + totalRecordCountUnescaped, err := url.QueryUnescape(qp.Get("totalRecordCount")) + if err != nil { + return nil, err + } + totalRecordCountParam, err := parseOptional(totalRecordCountUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + var options *armmigrate.ServersControllerClientListByServerSiteResourceOptions + if filterParam != nil || topParam != nil || continuationTokenParam != nil || totalRecordCountParam != nil { + options = &armmigrate.ServersControllerClientListByServerSiteResourceOptions{ + Filter: filterParam, + Top: topParam, + ContinuationToken: continuationTokenParam, + TotalRecordCount: totalRecordCountParam, + } + } + resp := s.srv.NewListByServerSiteResourcePager(resourceGroupNameParam, siteNameParam, options) + newListByServerSiteResourcePager = &resp + s.newListByServerSiteResourcePager.add(req, newListByServerSiteResourcePager) + server.PagerResponderInjectNextLinks(newListByServerSiteResourcePager, req, func(page *armmigrate.ServersControllerClientListByServerSiteResourceResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByServerSiteResourcePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListByServerSiteResourcePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByServerSiteResourcePager) { + s.newListByServerSiteResourcePager.remove(req) + } + return resp, nil +} + +func (s *ServersControllerServerTransport) dispatchUpdateMachine(req *http.Request) (*http.Response, error) { + if s.srv.UpdateMachine == nil { + return nil, &nonRetriableError{errors.New("fake for method UpdateMachine not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/serverSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/machines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.ServerUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + machineNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("machineName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.UpdateMachine(req.Context(), resourceGroupNameParam, siteNameParam, machineNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Server, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/serversitescontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/serversitescontroller_server.go new file mode 100644 index 000000000000..7957ad4a1620 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/serversitescontroller_server.go @@ -0,0 +1,767 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" +) + +// ServerSitesControllerServer is a fake server for instances of the armmigrate.ServerSitesControllerClient type. +type ServerSitesControllerServer struct { + // ComputeErrorSummary is the fake for method ServerSitesControllerClient.ComputeErrorSummary + // HTTP status codes to indicate success: http.StatusOK + ComputeErrorSummary func(ctx context.Context, resourceGroupName string, siteName string, body any, options *armmigrate.ServerSitesControllerClientComputeErrorSummaryOptions) (resp azfake.Responder[armmigrate.ServerSitesControllerClientComputeErrorSummaryResponse], errResp azfake.ErrorResponder) + + // Computeusage is the fake for method ServerSitesControllerClient.Computeusage + // HTTP status codes to indicate success: http.StatusOK + Computeusage func(ctx context.Context, resourceGroupName string, siteName string, body any, options *armmigrate.ServerSitesControllerClientComputeusageOptions) (resp azfake.Responder[armmigrate.ServerSitesControllerClientComputeusageResponse], errResp azfake.ErrorResponder) + + // BeginCreate is the fake for method ServerSitesControllerClient.BeginCreate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreate func(ctx context.Context, resourceGroupName string, siteName string, body armmigrate.ServerSiteResource, options *armmigrate.ServerSitesControllerClientBeginCreateOptions) (resp azfake.PollerResponder[armmigrate.ServerSitesControllerClientCreateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method ServerSitesControllerClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, siteName string, options *armmigrate.ServerSitesControllerClientDeleteOptions) (resp azfake.Responder[armmigrate.ServerSitesControllerClientDeleteResponse], errResp azfake.ErrorResponder) + + // BeginExportApplications is the fake for method ServerSitesControllerClient.BeginExportApplications + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginExportApplications func(ctx context.Context, resourceGroupName string, siteName string, body any, options *armmigrate.ServerSitesControllerClientBeginExportApplicationsOptions) (resp azfake.PollerResponder[armmigrate.ServerSitesControllerClientExportApplicationsResponse], errResp azfake.ErrorResponder) + + // BeginExportMachineErrors is the fake for method ServerSitesControllerClient.BeginExportMachineErrors + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginExportMachineErrors func(ctx context.Context, resourceGroupName string, siteName string, body armmigrate.ExportMachineErrorsRequest, options *armmigrate.ServerSitesControllerClientBeginExportMachineErrorsOptions) (resp azfake.PollerResponder[armmigrate.ServerSitesControllerClientExportMachineErrorsResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ServerSitesControllerClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, siteName string, options *armmigrate.ServerSitesControllerClientGetOptions) (resp azfake.Responder[armmigrate.ServerSitesControllerClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method ServerSitesControllerClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armmigrate.ServerSitesControllerClientListByResourceGroupOptions) (resp azfake.PagerResponder[armmigrate.ServerSitesControllerClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method ServerSitesControllerClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armmigrate.ServerSitesControllerClientListBySubscriptionOptions) (resp azfake.PagerResponder[armmigrate.ServerSitesControllerClientListBySubscriptionResponse]) + + // ListHealthSummary is the fake for method ServerSitesControllerClient.ListHealthSummary + // HTTP status codes to indicate success: http.StatusOK + ListHealthSummary func(ctx context.Context, resourceGroupName string, siteName string, options *armmigrate.ServerSitesControllerClientListHealthSummaryOptions) (resp azfake.Responder[armmigrate.ServerSitesControllerClientListHealthSummaryResponse], errResp azfake.ErrorResponder) + + // BeginRefreshSite is the fake for method ServerSitesControllerClient.BeginRefreshSite + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginRefreshSite func(ctx context.Context, resourceGroupName string, siteName string, options *armmigrate.ServerSitesControllerClientBeginRefreshSiteOptions) (resp azfake.PollerResponder[armmigrate.ServerSitesControllerClientRefreshSiteResponse], errResp azfake.ErrorResponder) + + // Summary is the fake for method ServerSitesControllerClient.Summary + // HTTP status codes to indicate success: http.StatusOK + Summary func(ctx context.Context, resourceGroupName string, siteName string, options *armmigrate.ServerSitesControllerClientSummaryOptions) (resp azfake.Responder[armmigrate.ServerSitesControllerClientSummaryResponse], errResp azfake.ErrorResponder) + + // Update is the fake for method ServerSitesControllerClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, siteName string, body armmigrate.ServerSiteResourceUpdate, options *armmigrate.ServerSitesControllerClientUpdateOptions) (resp azfake.Responder[armmigrate.ServerSitesControllerClientUpdateResponse], errResp azfake.ErrorResponder) + + // BeginUpdateDependencyMapStatus is the fake for method ServerSitesControllerClient.BeginUpdateDependencyMapStatus + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdateDependencyMapStatus func(ctx context.Context, resourceGroupName string, siteName string, mapRequest armmigrate.UpdateMachineDepMapStatus, options *armmigrate.ServerSitesControllerClientBeginUpdateDependencyMapStatusOptions) (resp azfake.PollerResponder[armmigrate.ServerSitesControllerClientUpdateDependencyMapStatusResponse], errResp azfake.ErrorResponder) + + // BeginUpdateProperties is the fake for method ServerSitesControllerClient.BeginUpdateProperties + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdateProperties func(ctx context.Context, resourceGroupName string, siteName string, metaData armmigrate.MachineMetadataCollection, options *armmigrate.ServerSitesControllerClientBeginUpdatePropertiesOptions) (resp azfake.PollerResponder[armmigrate.ServerSitesControllerClientUpdatePropertiesResponse], errResp azfake.ErrorResponder) +} + +// NewServerSitesControllerServerTransport creates a new instance of ServerSitesControllerServerTransport with the provided implementation. +// The returned ServerSitesControllerServerTransport instance is connected to an instance of armmigrate.ServerSitesControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewServerSitesControllerServerTransport(srv *ServerSitesControllerServer) *ServerSitesControllerServerTransport { + return &ServerSitesControllerServerTransport{ + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[armmigrate.ServerSitesControllerClientCreateResponse]](), + beginExportApplications: newTracker[azfake.PollerResponder[armmigrate.ServerSitesControllerClientExportApplicationsResponse]](), + beginExportMachineErrors: newTracker[azfake.PollerResponder[armmigrate.ServerSitesControllerClientExportMachineErrorsResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armmigrate.ServerSitesControllerClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armmigrate.ServerSitesControllerClientListBySubscriptionResponse]](), + beginRefreshSite: newTracker[azfake.PollerResponder[armmigrate.ServerSitesControllerClientRefreshSiteResponse]](), + beginUpdateDependencyMapStatus: newTracker[azfake.PollerResponder[armmigrate.ServerSitesControllerClientUpdateDependencyMapStatusResponse]](), + beginUpdateProperties: newTracker[azfake.PollerResponder[armmigrate.ServerSitesControllerClientUpdatePropertiesResponse]](), + } +} + +// ServerSitesControllerServerTransport connects instances of armmigrate.ServerSitesControllerClient to instances of ServerSitesControllerServer. +// Don't use this type directly, use NewServerSitesControllerServerTransport instead. +type ServerSitesControllerServerTransport struct { + srv *ServerSitesControllerServer + beginCreate *tracker[azfake.PollerResponder[armmigrate.ServerSitesControllerClientCreateResponse]] + beginExportApplications *tracker[azfake.PollerResponder[armmigrate.ServerSitesControllerClientExportApplicationsResponse]] + beginExportMachineErrors *tracker[azfake.PollerResponder[armmigrate.ServerSitesControllerClientExportMachineErrorsResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armmigrate.ServerSitesControllerClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armmigrate.ServerSitesControllerClientListBySubscriptionResponse]] + beginRefreshSite *tracker[azfake.PollerResponder[armmigrate.ServerSitesControllerClientRefreshSiteResponse]] + beginUpdateDependencyMapStatus *tracker[azfake.PollerResponder[armmigrate.ServerSitesControllerClientUpdateDependencyMapStatusResponse]] + beginUpdateProperties *tracker[azfake.PollerResponder[armmigrate.ServerSitesControllerClientUpdatePropertiesResponse]] +} + +// Do implements the policy.Transporter interface for ServerSitesControllerServerTransport. +func (s *ServerSitesControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ServerSitesControllerClient.ComputeErrorSummary": + resp, err = s.dispatchComputeErrorSummary(req) + case "ServerSitesControllerClient.Computeusage": + resp, err = s.dispatchComputeusage(req) + case "ServerSitesControllerClient.BeginCreate": + resp, err = s.dispatchBeginCreate(req) + case "ServerSitesControllerClient.Delete": + resp, err = s.dispatchDelete(req) + case "ServerSitesControllerClient.BeginExportApplications": + resp, err = s.dispatchBeginExportApplications(req) + case "ServerSitesControllerClient.BeginExportMachineErrors": + resp, err = s.dispatchBeginExportMachineErrors(req) + case "ServerSitesControllerClient.Get": + resp, err = s.dispatchGet(req) + case "ServerSitesControllerClient.NewListByResourceGroupPager": + resp, err = s.dispatchNewListByResourceGroupPager(req) + case "ServerSitesControllerClient.NewListBySubscriptionPager": + resp, err = s.dispatchNewListBySubscriptionPager(req) + case "ServerSitesControllerClient.ListHealthSummary": + resp, err = s.dispatchListHealthSummary(req) + case "ServerSitesControllerClient.BeginRefreshSite": + resp, err = s.dispatchBeginRefreshSite(req) + case "ServerSitesControllerClient.Summary": + resp, err = s.dispatchSummary(req) + case "ServerSitesControllerClient.Update": + resp, err = s.dispatchUpdate(req) + case "ServerSitesControllerClient.BeginUpdateDependencyMapStatus": + resp, err = s.dispatchBeginUpdateDependencyMapStatus(req) + case "ServerSitesControllerClient.BeginUpdateProperties": + resp, err = s.dispatchBeginUpdateProperties(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *ServerSitesControllerServerTransport) dispatchComputeErrorSummary(req *http.Request) (*http.Response, error) { + if s.srv.ComputeErrorSummary == nil { + return nil, &nonRetriableError{errors.New("fake for method ComputeErrorSummary not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/serverSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/computeErrorSummary` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[any](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.ComputeErrorSummary(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SiteErrorSummary, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *ServerSitesControllerServerTransport) dispatchComputeusage(req *http.Request) (*http.Response, error) { + if s.srv.Computeusage == nil { + return nil, &nonRetriableError{errors.New("fake for method Computeusage not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/serverSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/computeusage` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[any](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Computeusage(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ServerSiteUsageResponse, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *ServerSitesControllerServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { + if s.srv.BeginCreate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} + } + beginCreate := s.beginCreate.get(req) + if beginCreate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/serverSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.ServerSiteResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginCreate(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreate = &respr + s.beginCreate.add(req, beginCreate) + } + + resp, err := server.PollerResponderNext(beginCreate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + s.beginCreate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreate) { + s.beginCreate.remove(req) + } + + return resp, nil +} + +func (s *ServerSitesControllerServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if s.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/serverSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Delete(req.Context(), resourceGroupNameParam, siteNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *ServerSitesControllerServerTransport) dispatchBeginExportApplications(req *http.Request) (*http.Response, error) { + if s.srv.BeginExportApplications == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginExportApplications not implemented")} + } + beginExportApplications := s.beginExportApplications.get(req) + if beginExportApplications == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/serverSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/exportApplications` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[any](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginExportApplications(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginExportApplications = &respr + s.beginExportApplications.add(req, beginExportApplications) + } + + resp, err := server.PollerResponderNext(beginExportApplications, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + s.beginExportApplications.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginExportApplications) { + s.beginExportApplications.remove(req) + } + + return resp, nil +} + +func (s *ServerSitesControllerServerTransport) dispatchBeginExportMachineErrors(req *http.Request) (*http.Response, error) { + if s.srv.BeginExportMachineErrors == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginExportMachineErrors not implemented")} + } + beginExportMachineErrors := s.beginExportMachineErrors.get(req) + if beginExportMachineErrors == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/serverSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/exportMachineErrors` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.ExportMachineErrorsRequest](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginExportMachineErrors(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginExportMachineErrors = &respr + s.beginExportMachineErrors.add(req, beginExportMachineErrors) + } + + resp, err := server.PollerResponderNext(beginExportMachineErrors, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + s.beginExportMachineErrors.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginExportMachineErrors) { + s.beginExportMachineErrors.remove(req) + } + + return resp, nil +} + +func (s *ServerSitesControllerServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if s.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/serverSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, siteNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ServerSiteResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *ServerSitesControllerServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := s.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/serverSites` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resp := s.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + s.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armmigrate.ServerSitesControllerClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + s.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (s *ServerSitesControllerServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := s.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/serverSites` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resp := s.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + s.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armmigrate.ServerSitesControllerClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + s.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (s *ServerSitesControllerServerTransport) dispatchListHealthSummary(req *http.Request) (*http.Response, error) { + if s.srv.ListHealthSummary == nil { + return nil, &nonRetriableError{errors.New("fake for method ListHealthSummary not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/serverSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listHealthSummary` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.ListHealthSummary(req.Context(), resourceGroupNameParam, siteNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SiteHealthSummaryCollection, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *ServerSitesControllerServerTransport) dispatchBeginRefreshSite(req *http.Request) (*http.Response, error) { + if s.srv.BeginRefreshSite == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginRefreshSite not implemented")} + } + beginRefreshSite := s.beginRefreshSite.get(req) + if beginRefreshSite == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/serverSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/refreshSite` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginRefreshSite(req.Context(), resourceGroupNameParam, siteNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginRefreshSite = &respr + s.beginRefreshSite.add(req, beginRefreshSite) + } + + resp, err := server.PollerResponderNext(beginRefreshSite, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + s.beginRefreshSite.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginRefreshSite) { + s.beginRefreshSite.remove(req) + } + + return resp, nil +} + +func (s *ServerSitesControllerServerTransport) dispatchSummary(req *http.Request) (*http.Response, error) { + if s.srv.Summary == nil { + return nil, &nonRetriableError{errors.New("fake for method Summary not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/serverSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/summary` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Summary(req.Context(), resourceGroupNameParam, siteNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ServerSiteUsage, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *ServerSitesControllerServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if s.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/serverSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.ServerSiteResourceUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Update(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ServerSiteResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *ServerSitesControllerServerTransport) dispatchBeginUpdateDependencyMapStatus(req *http.Request) (*http.Response, error) { + if s.srv.BeginUpdateDependencyMapStatus == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdateDependencyMapStatus not implemented")} + } + beginUpdateDependencyMapStatus := s.beginUpdateDependencyMapStatus.get(req) + if beginUpdateDependencyMapStatus == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/serverSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updateDependencyMapStatus` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.UpdateMachineDepMapStatus](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginUpdateDependencyMapStatus(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdateDependencyMapStatus = &respr + s.beginUpdateDependencyMapStatus.add(req, beginUpdateDependencyMapStatus) + } + + resp, err := server.PollerResponderNext(beginUpdateDependencyMapStatus, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + s.beginUpdateDependencyMapStatus.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdateDependencyMapStatus) { + s.beginUpdateDependencyMapStatus.remove(req) + } + + return resp, nil +} + +func (s *ServerSitesControllerServerTransport) dispatchBeginUpdateProperties(req *http.Request) (*http.Response, error) { + if s.srv.BeginUpdateProperties == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdateProperties not implemented")} + } + beginUpdateProperties := s.beginUpdateProperties.get(req) + if beginUpdateProperties == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/serverSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updateProperties` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.MachineMetadataCollection](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginUpdateProperties(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdateProperties = &respr + s.beginUpdateProperties.add(req, beginUpdateProperties) + } + + resp, err := server.PollerResponderNext(beginUpdateProperties, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + s.beginUpdateProperties.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdateProperties) { + s.beginUpdateProperties.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/serversoftwareinventoriescontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/serversoftwareinventoriescontroller_server.go new file mode 100644 index 000000000000..b333b0428d4d --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/serversoftwareinventoriescontroller_server.go @@ -0,0 +1,170 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" +) + +// ServerSoftwareInventoriesControllerServer is a fake server for instances of the armmigrate.ServerSoftwareInventoriesControllerClient type. +type ServerSoftwareInventoriesControllerServer struct { + // GetMachineSoftwareInventory is the fake for method ServerSoftwareInventoriesControllerClient.GetMachineSoftwareInventory + // HTTP status codes to indicate success: http.StatusOK + GetMachineSoftwareInventory func(ctx context.Context, resourceGroupName string, siteName string, machineName string, defaultParam armmigrate.Default, options *armmigrate.ServerSoftwareInventoriesControllerClientGetMachineSoftwareInventoryOptions) (resp azfake.Responder[armmigrate.ServerSoftwareInventoriesControllerClientGetMachineSoftwareInventoryResponse], errResp azfake.ErrorResponder) + + // NewListByServerPager is the fake for method ServerSoftwareInventoriesControllerClient.NewListByServerPager + // HTTP status codes to indicate success: http.StatusOK + NewListByServerPager func(resourceGroupName string, siteName string, machineName string, options *armmigrate.ServerSoftwareInventoriesControllerClientListByServerOptions) (resp azfake.PagerResponder[armmigrate.ServerSoftwareInventoriesControllerClientListByServerResponse]) +} + +// NewServerSoftwareInventoriesControllerServerTransport creates a new instance of ServerSoftwareInventoriesControllerServerTransport with the provided implementation. +// The returned ServerSoftwareInventoriesControllerServerTransport instance is connected to an instance of armmigrate.ServerSoftwareInventoriesControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewServerSoftwareInventoriesControllerServerTransport(srv *ServerSoftwareInventoriesControllerServer) *ServerSoftwareInventoriesControllerServerTransport { + return &ServerSoftwareInventoriesControllerServerTransport{ + srv: srv, + newListByServerPager: newTracker[azfake.PagerResponder[armmigrate.ServerSoftwareInventoriesControllerClientListByServerResponse]](), + } +} + +// ServerSoftwareInventoriesControllerServerTransport connects instances of armmigrate.ServerSoftwareInventoriesControllerClient to instances of ServerSoftwareInventoriesControllerServer. +// Don't use this type directly, use NewServerSoftwareInventoriesControllerServerTransport instead. +type ServerSoftwareInventoriesControllerServerTransport struct { + srv *ServerSoftwareInventoriesControllerServer + newListByServerPager *tracker[azfake.PagerResponder[armmigrate.ServerSoftwareInventoriesControllerClientListByServerResponse]] +} + +// Do implements the policy.Transporter interface for ServerSoftwareInventoriesControllerServerTransport. +func (s *ServerSoftwareInventoriesControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ServerSoftwareInventoriesControllerClient.GetMachineSoftwareInventory": + resp, err = s.dispatchGetMachineSoftwareInventory(req) + case "ServerSoftwareInventoriesControllerClient.NewListByServerPager": + resp, err = s.dispatchNewListByServerPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *ServerSoftwareInventoriesControllerServerTransport) dispatchGetMachineSoftwareInventory(req *http.Request) (*http.Response, error) { + if s.srv.GetMachineSoftwareInventory == nil { + return nil, &nonRetriableError{errors.New("fake for method GetMachineSoftwareInventory not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/serverSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/machines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/softwareInventories/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + machineNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("machineName")]) + if err != nil { + return nil, err + } + defaultParamParam, err := parseWithCast(matches[regex.SubexpIndex("default")], func(v string) (armmigrate.Default, error) { + p, unescapeErr := url.PathUnescape(v) + if unescapeErr != nil { + return "", unescapeErr + } + return armmigrate.Default(p), nil + }) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.GetMachineSoftwareInventory(req.Context(), resourceGroupNameParam, siteNameParam, machineNameParam, defaultParamParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ServerSoftwareInventory, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *ServerSoftwareInventoriesControllerServerTransport) dispatchNewListByServerPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListByServerPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByServerPager not implemented")} + } + newListByServerPager := s.newListByServerPager.get(req) + if newListByServerPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/serverSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/machines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/softwareinventories` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + machineNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("machineName")]) + if err != nil { + return nil, err + } + resp := s.srv.NewListByServerPager(resourceGroupNameParam, siteNameParam, machineNameParam, nil) + newListByServerPager = &resp + s.newListByServerPager.add(req, newListByServerPager) + server.PagerResponderInjectNextLinks(newListByServerPager, req, func(page *armmigrate.ServerSoftwareInventoriesControllerClientListByServerResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByServerPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListByServerPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByServerPager) { + s.newListByServerPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/sitescontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/sitescontroller_server.go new file mode 100644 index 000000000000..fb2275f3b8d1 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/sitescontroller_server.go @@ -0,0 +1,650 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// SitesControllerServer is a fake server for instances of the armmigrate.SitesControllerClient type. +type SitesControllerServer struct { + // ComputeErrorSummary is the fake for method SitesControllerClient.ComputeErrorSummary + // HTTP status codes to indicate success: http.StatusOK + ComputeErrorSummary func(ctx context.Context, resourceGroupName string, siteName string, body any, options *armmigrate.SitesControllerClientComputeErrorSummaryOptions) (resp azfake.Responder[armmigrate.SitesControllerClientComputeErrorSummaryResponse], errResp azfake.ErrorResponder) + + // Computeusage is the fake for method SitesControllerClient.Computeusage + // HTTP status codes to indicate success: http.StatusOK + Computeusage func(ctx context.Context, resourceGroupName string, siteName string, body any, options *armmigrate.SitesControllerClientComputeusageOptions) (resp azfake.Responder[armmigrate.SitesControllerClientComputeusageResponse], errResp azfake.ErrorResponder) + + // Create is the fake for method SitesControllerClient.Create + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + Create func(ctx context.Context, resourceGroupName string, siteName string, body armmigrate.VmwareSite, options *armmigrate.SitesControllerClientCreateOptions) (resp azfake.Responder[armmigrate.SitesControllerClientCreateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method SitesControllerClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, siteName string, options *armmigrate.SitesControllerClientDeleteOptions) (resp azfake.Responder[armmigrate.SitesControllerClientDeleteResponse], errResp azfake.ErrorResponder) + + // BeginExportApplications is the fake for method SitesControllerClient.BeginExportApplications + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginExportApplications func(ctx context.Context, resourceGroupName string, siteName string, body any, options *armmigrate.SitesControllerClientBeginExportApplicationsOptions) (resp azfake.PollerResponder[armmigrate.SitesControllerClientExportApplicationsResponse], errResp azfake.ErrorResponder) + + // BeginExportMachineErrors is the fake for method SitesControllerClient.BeginExportMachineErrors + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginExportMachineErrors func(ctx context.Context, resourceGroupName string, siteName string, body armmigrate.ExportMachineErrorsRequest, options *armmigrate.SitesControllerClientBeginExportMachineErrorsOptions) (resp azfake.PollerResponder[armmigrate.SitesControllerClientExportMachineErrorsResponse], errResp azfake.ErrorResponder) + + // BeginExportMachines is the fake for method SitesControllerClient.BeginExportMachines + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginExportMachines func(ctx context.Context, resourceGroupName string, siteName string, body armmigrate.ExportMachinesRequest, options *armmigrate.SitesControllerClientBeginExportMachinesOptions) (resp azfake.PollerResponder[armmigrate.SitesControllerClientExportMachinesResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method SitesControllerClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, siteName string, options *armmigrate.SitesControllerClientGetOptions) (resp azfake.Responder[armmigrate.SitesControllerClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method SitesControllerClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armmigrate.SitesControllerClientListByResourceGroupOptions) (resp azfake.PagerResponder[armmigrate.SitesControllerClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method SitesControllerClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armmigrate.SitesControllerClientListBySubscriptionOptions) (resp azfake.PagerResponder[armmigrate.SitesControllerClientListBySubscriptionResponse]) + + // ListHealthSummary is the fake for method SitesControllerClient.ListHealthSummary + // HTTP status codes to indicate success: http.StatusOK + ListHealthSummary func(ctx context.Context, resourceGroupName string, siteName string, options *armmigrate.SitesControllerClientListHealthSummaryOptions) (resp azfake.Responder[armmigrate.SitesControllerClientListHealthSummaryResponse], errResp azfake.ErrorResponder) + + // Summary is the fake for method SitesControllerClient.Summary + // HTTP status codes to indicate success: http.StatusOK + Summary func(ctx context.Context, resourceGroupName string, siteName string, options *armmigrate.SitesControllerClientSummaryOptions) (resp azfake.Responder[armmigrate.SitesControllerClientSummaryResponse], errResp azfake.ErrorResponder) + + // Update is the fake for method SitesControllerClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, siteName string, body armmigrate.VmwareSiteUpdate, options *armmigrate.SitesControllerClientUpdateOptions) (resp azfake.Responder[armmigrate.SitesControllerClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewSitesControllerServerTransport creates a new instance of SitesControllerServerTransport with the provided implementation. +// The returned SitesControllerServerTransport instance is connected to an instance of armmigrate.SitesControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSitesControllerServerTransport(srv *SitesControllerServer) *SitesControllerServerTransport { + return &SitesControllerServerTransport{ + srv: srv, + beginExportApplications: newTracker[azfake.PollerResponder[armmigrate.SitesControllerClientExportApplicationsResponse]](), + beginExportMachineErrors: newTracker[azfake.PollerResponder[armmigrate.SitesControllerClientExportMachineErrorsResponse]](), + beginExportMachines: newTracker[azfake.PollerResponder[armmigrate.SitesControllerClientExportMachinesResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armmigrate.SitesControllerClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armmigrate.SitesControllerClientListBySubscriptionResponse]](), + } +} + +// SitesControllerServerTransport connects instances of armmigrate.SitesControllerClient to instances of SitesControllerServer. +// Don't use this type directly, use NewSitesControllerServerTransport instead. +type SitesControllerServerTransport struct { + srv *SitesControllerServer + beginExportApplications *tracker[azfake.PollerResponder[armmigrate.SitesControllerClientExportApplicationsResponse]] + beginExportMachineErrors *tracker[azfake.PollerResponder[armmigrate.SitesControllerClientExportMachineErrorsResponse]] + beginExportMachines *tracker[azfake.PollerResponder[armmigrate.SitesControllerClientExportMachinesResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armmigrate.SitesControllerClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armmigrate.SitesControllerClientListBySubscriptionResponse]] +} + +// Do implements the policy.Transporter interface for SitesControllerServerTransport. +func (s *SitesControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "SitesControllerClient.ComputeErrorSummary": + resp, err = s.dispatchComputeErrorSummary(req) + case "SitesControllerClient.Computeusage": + resp, err = s.dispatchComputeusage(req) + case "SitesControllerClient.Create": + resp, err = s.dispatchCreate(req) + case "SitesControllerClient.Delete": + resp, err = s.dispatchDelete(req) + case "SitesControllerClient.BeginExportApplications": + resp, err = s.dispatchBeginExportApplications(req) + case "SitesControllerClient.BeginExportMachineErrors": + resp, err = s.dispatchBeginExportMachineErrors(req) + case "SitesControllerClient.BeginExportMachines": + resp, err = s.dispatchBeginExportMachines(req) + case "SitesControllerClient.Get": + resp, err = s.dispatchGet(req) + case "SitesControllerClient.NewListByResourceGroupPager": + resp, err = s.dispatchNewListByResourceGroupPager(req) + case "SitesControllerClient.NewListBySubscriptionPager": + resp, err = s.dispatchNewListBySubscriptionPager(req) + case "SitesControllerClient.ListHealthSummary": + resp, err = s.dispatchListHealthSummary(req) + case "SitesControllerClient.Summary": + resp, err = s.dispatchSummary(req) + case "SitesControllerClient.Update": + resp, err = s.dispatchUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *SitesControllerServerTransport) dispatchComputeErrorSummary(req *http.Request) (*http.Response, error) { + if s.srv.ComputeErrorSummary == nil { + return nil, &nonRetriableError{errors.New("fake for method ComputeErrorSummary not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/vmwareSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/computeErrorSummary` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[any](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.ComputeErrorSummary(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SiteErrorSummary, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SitesControllerServerTransport) dispatchComputeusage(req *http.Request) (*http.Response, error) { + if s.srv.Computeusage == nil { + return nil, &nonRetriableError{errors.New("fake for method Computeusage not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/vmwareSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/computeusage` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[any](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Computeusage(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).VmwareSiteUsage, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SitesControllerServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { + if s.srv.Create == nil { + return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/vmwareSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.VmwareSite](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Create(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).VmwareSite, req) + if err != nil { + return nil, err + } + if val := server.GetResponse(respr).RetryAfter; val != nil { + resp.Header.Set("Retry-After", strconv.FormatInt(int64(*val), 10)) + } + return resp, nil +} + +func (s *SitesControllerServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if s.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/vmwareSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Delete(req.Context(), resourceGroupNameParam, siteNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SitesControllerServerTransport) dispatchBeginExportApplications(req *http.Request) (*http.Response, error) { + if s.srv.BeginExportApplications == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginExportApplications not implemented")} + } + beginExportApplications := s.beginExportApplications.get(req) + if beginExportApplications == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/vmwareSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/exportApplications` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[any](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginExportApplications(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginExportApplications = &respr + s.beginExportApplications.add(req, beginExportApplications) + } + + resp, err := server.PollerResponderNext(beginExportApplications, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + s.beginExportApplications.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginExportApplications) { + s.beginExportApplications.remove(req) + } + + return resp, nil +} + +func (s *SitesControllerServerTransport) dispatchBeginExportMachineErrors(req *http.Request) (*http.Response, error) { + if s.srv.BeginExportMachineErrors == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginExportMachineErrors not implemented")} + } + beginExportMachineErrors := s.beginExportMachineErrors.get(req) + if beginExportMachineErrors == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/vmwareSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/exportMachineErrors` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.ExportMachineErrorsRequest](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginExportMachineErrors(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginExportMachineErrors = &respr + s.beginExportMachineErrors.add(req, beginExportMachineErrors) + } + + resp, err := server.PollerResponderNext(beginExportMachineErrors, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + s.beginExportMachineErrors.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginExportMachineErrors) { + s.beginExportMachineErrors.remove(req) + } + + return resp, nil +} + +func (s *SitesControllerServerTransport) dispatchBeginExportMachines(req *http.Request) (*http.Response, error) { + if s.srv.BeginExportMachines == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginExportMachines not implemented")} + } + beginExportMachines := s.beginExportMachines.get(req) + if beginExportMachines == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/vmwareSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/exportMachines` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.ExportMachinesRequest](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginExportMachines(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginExportMachines = &respr + s.beginExportMachines.add(req, beginExportMachines) + } + + resp, err := server.PollerResponderNext(beginExportMachines, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + s.beginExportMachines.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginExportMachines) { + s.beginExportMachines.remove(req) + } + + return resp, nil +} + +func (s *SitesControllerServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if s.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/vmwareSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, siteNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).VmwareSite, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SitesControllerServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := s.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/vmwareSites` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resp := s.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + s.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armmigrate.SitesControllerClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + s.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (s *SitesControllerServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := s.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/vmwareSites` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resp := s.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + s.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armmigrate.SitesControllerClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + s.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (s *SitesControllerServerTransport) dispatchListHealthSummary(req *http.Request) (*http.Response, error) { + if s.srv.ListHealthSummary == nil { + return nil, &nonRetriableError{errors.New("fake for method ListHealthSummary not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/vmwareSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listHealthSummary` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.ListHealthSummary(req.Context(), resourceGroupNameParam, siteNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SiteHealthSummaryCollection, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SitesControllerServerTransport) dispatchSummary(req *http.Request) (*http.Response, error) { + if s.srv.Summary == nil { + return nil, &nonRetriableError{errors.New("fake for method Summary not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/vmwareSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/summary` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Summary(req.Context(), resourceGroupNameParam, siteNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).VmwareSiteUsage, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SitesControllerServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if s.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/vmwareSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.VmwareSiteUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Update(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).VmwareSite, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/sqlavailabilitygroupscontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/sqlavailabilitygroupscontroller_server.go new file mode 100644 index 000000000000..e23c552e2c0c --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/sqlavailabilitygroupscontroller_server.go @@ -0,0 +1,204 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// SQLAvailabilityGroupsControllerServer is a fake server for instances of the armmigrate.SQLAvailabilityGroupsControllerClient type. +type SQLAvailabilityGroupsControllerServer struct { + // Get is the fake for method SQLAvailabilityGroupsControllerClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, sqlAvailabilityGroupName string, options *armmigrate.SQLAvailabilityGroupsControllerClientGetOptions) (resp azfake.Responder[armmigrate.SQLAvailabilityGroupsControllerClientGetResponse], errResp azfake.ErrorResponder) + + // NewListBySQLSitePager is the fake for method SQLAvailabilityGroupsControllerClient.NewListBySQLSitePager + // HTTP status codes to indicate success: http.StatusOK + NewListBySQLSitePager func(resourceGroupName string, siteName string, sqlSiteName string, options *armmigrate.SQLAvailabilityGroupsControllerClientListBySQLSiteOptions) (resp azfake.PagerResponder[armmigrate.SQLAvailabilityGroupsControllerClientListBySQLSiteResponse]) +} + +// NewSQLAvailabilityGroupsControllerServerTransport creates a new instance of SQLAvailabilityGroupsControllerServerTransport with the provided implementation. +// The returned SQLAvailabilityGroupsControllerServerTransport instance is connected to an instance of armmigrate.SQLAvailabilityGroupsControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSQLAvailabilityGroupsControllerServerTransport(srv *SQLAvailabilityGroupsControllerServer) *SQLAvailabilityGroupsControllerServerTransport { + return &SQLAvailabilityGroupsControllerServerTransport{ + srv: srv, + newListBySQLSitePager: newTracker[azfake.PagerResponder[armmigrate.SQLAvailabilityGroupsControllerClientListBySQLSiteResponse]](), + } +} + +// SQLAvailabilityGroupsControllerServerTransport connects instances of armmigrate.SQLAvailabilityGroupsControllerClient to instances of SQLAvailabilityGroupsControllerServer. +// Don't use this type directly, use NewSQLAvailabilityGroupsControllerServerTransport instead. +type SQLAvailabilityGroupsControllerServerTransport struct { + srv *SQLAvailabilityGroupsControllerServer + newListBySQLSitePager *tracker[azfake.PagerResponder[armmigrate.SQLAvailabilityGroupsControllerClientListBySQLSiteResponse]] +} + +// Do implements the policy.Transporter interface for SQLAvailabilityGroupsControllerServerTransport. +func (s *SQLAvailabilityGroupsControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "SQLAvailabilityGroupsControllerClient.Get": + resp, err = s.dispatchGet(req) + case "SQLAvailabilityGroupsControllerClient.NewListBySQLSitePager": + resp, err = s.dispatchNewListBySQLSitePager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *SQLAvailabilityGroupsControllerServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if s.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sqlSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sqlAvailabilityGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + sqlSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sqlSiteName")]) + if err != nil { + return nil, err + } + sqlAvailabilityGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sqlAvailabilityGroupName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, siteNameParam, sqlSiteNameParam, sqlAvailabilityGroupNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SQLAvailabilityGroup, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SQLAvailabilityGroupsControllerServerTransport) dispatchNewListBySQLSitePager(req *http.Request) (*http.Response, error) { + if s.srv.NewListBySQLSitePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySQLSitePager not implemented")} + } + newListBySQLSitePager := s.newListBySQLSitePager.get(req) + if newListBySQLSitePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sqlSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sqlAvailabilityGroups` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("top")) + if err != nil { + return nil, err + } + topParam := getOptional(topUnescaped) + continuationTokenUnescaped, err := url.QueryUnescape(qp.Get("continuationToken")) + if err != nil { + return nil, err + } + continuationTokenParam := getOptional(continuationTokenUnescaped) + totalRecordCountUnescaped, err := url.QueryUnescape(qp.Get("totalRecordCount")) + if err != nil { + return nil, err + } + totalRecordCountParam, err := parseOptional(totalRecordCountUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + sqlSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sqlSiteName")]) + if err != nil { + return nil, err + } + var options *armmigrate.SQLAvailabilityGroupsControllerClientListBySQLSiteOptions + if filterParam != nil || topParam != nil || continuationTokenParam != nil || totalRecordCountParam != nil { + options = &armmigrate.SQLAvailabilityGroupsControllerClientListBySQLSiteOptions{ + Filter: filterParam, + Top: topParam, + ContinuationToken: continuationTokenParam, + TotalRecordCount: totalRecordCountParam, + } + } + resp := s.srv.NewListBySQLSitePager(resourceGroupNameParam, siteNameParam, sqlSiteNameParam, options) + newListBySQLSitePager = &resp + s.newListBySQLSitePager.add(req, newListBySQLSitePager) + server.PagerResponderInjectNextLinks(newListBySQLSitePager, req, func(page *armmigrate.SQLAvailabilityGroupsControllerClientListBySQLSiteResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySQLSitePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListBySQLSitePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySQLSitePager) { + s.newListBySQLSitePager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/sqldatabasescontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/sqldatabasescontroller_server.go new file mode 100644 index 000000000000..33cb5ea39fbb --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/sqldatabasescontroller_server.go @@ -0,0 +1,204 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// SQLDatabasesControllerServer is a fake server for instances of the armmigrate.SQLDatabasesControllerClient type. +type SQLDatabasesControllerServer struct { + // Get is the fake for method SQLDatabasesControllerClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, sqlDatabaseName string, options *armmigrate.SQLDatabasesControllerClientGetOptions) (resp azfake.Responder[armmigrate.SQLDatabasesControllerClientGetResponse], errResp azfake.ErrorResponder) + + // NewListBySQLSitePager is the fake for method SQLDatabasesControllerClient.NewListBySQLSitePager + // HTTP status codes to indicate success: http.StatusOK + NewListBySQLSitePager func(resourceGroupName string, siteName string, sqlSiteName string, options *armmigrate.SQLDatabasesControllerClientListBySQLSiteOptions) (resp azfake.PagerResponder[armmigrate.SQLDatabasesControllerClientListBySQLSiteResponse]) +} + +// NewSQLDatabasesControllerServerTransport creates a new instance of SQLDatabasesControllerServerTransport with the provided implementation. +// The returned SQLDatabasesControllerServerTransport instance is connected to an instance of armmigrate.SQLDatabasesControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSQLDatabasesControllerServerTransport(srv *SQLDatabasesControllerServer) *SQLDatabasesControllerServerTransport { + return &SQLDatabasesControllerServerTransport{ + srv: srv, + newListBySQLSitePager: newTracker[azfake.PagerResponder[armmigrate.SQLDatabasesControllerClientListBySQLSiteResponse]](), + } +} + +// SQLDatabasesControllerServerTransport connects instances of armmigrate.SQLDatabasesControllerClient to instances of SQLDatabasesControllerServer. +// Don't use this type directly, use NewSQLDatabasesControllerServerTransport instead. +type SQLDatabasesControllerServerTransport struct { + srv *SQLDatabasesControllerServer + newListBySQLSitePager *tracker[azfake.PagerResponder[armmigrate.SQLDatabasesControllerClientListBySQLSiteResponse]] +} + +// Do implements the policy.Transporter interface for SQLDatabasesControllerServerTransport. +func (s *SQLDatabasesControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "SQLDatabasesControllerClient.Get": + resp, err = s.dispatchGet(req) + case "SQLDatabasesControllerClient.NewListBySQLSitePager": + resp, err = s.dispatchNewListBySQLSitePager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *SQLDatabasesControllerServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if s.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sqlSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sqlDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + sqlSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sqlSiteName")]) + if err != nil { + return nil, err + } + sqlDatabaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sqlDatabaseName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, siteNameParam, sqlSiteNameParam, sqlDatabaseNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SQLDatabaseV2, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SQLDatabasesControllerServerTransport) dispatchNewListBySQLSitePager(req *http.Request) (*http.Response, error) { + if s.srv.NewListBySQLSitePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySQLSitePager not implemented")} + } + newListBySQLSitePager := s.newListBySQLSitePager.get(req) + if newListBySQLSitePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sqlSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sqlDatabases` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("top")) + if err != nil { + return nil, err + } + topParam := getOptional(topUnescaped) + continuationTokenUnescaped, err := url.QueryUnescape(qp.Get("continuationToken")) + if err != nil { + return nil, err + } + continuationTokenParam := getOptional(continuationTokenUnescaped) + totalRecordCountUnescaped, err := url.QueryUnescape(qp.Get("totalRecordCount")) + if err != nil { + return nil, err + } + totalRecordCountParam, err := parseOptional(totalRecordCountUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + sqlSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sqlSiteName")]) + if err != nil { + return nil, err + } + var options *armmigrate.SQLDatabasesControllerClientListBySQLSiteOptions + if filterParam != nil || topParam != nil || continuationTokenParam != nil || totalRecordCountParam != nil { + options = &armmigrate.SQLDatabasesControllerClientListBySQLSiteOptions{ + Filter: filterParam, + Top: topParam, + ContinuationToken: continuationTokenParam, + TotalRecordCount: totalRecordCountParam, + } + } + resp := s.srv.NewListBySQLSitePager(resourceGroupNameParam, siteNameParam, sqlSiteNameParam, options) + newListBySQLSitePager = &resp + s.newListBySQLSitePager.add(req, newListBySQLSitePager) + server.PagerResponderInjectNextLinks(newListBySQLSitePager, req, func(page *armmigrate.SQLDatabasesControllerClientListBySQLSiteResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySQLSitePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListBySQLSitePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySQLSitePager) { + s.newListBySQLSitePager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/sqldiscoverysitedatasourcecontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/sqldiscoverysitedatasourcecontroller_server.go new file mode 100644 index 000000000000..8855de465882 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/sqldiscoverysitedatasourcecontroller_server.go @@ -0,0 +1,275 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" +) + +// SQLDiscoverySiteDataSourceControllerServer is a fake server for instances of the armmigrate.SQLDiscoverySiteDataSourceControllerClient type. +type SQLDiscoverySiteDataSourceControllerServer struct { + // BeginCreate is the fake for method SQLDiscoverySiteDataSourceControllerClient.BeginCreate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreate func(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, discoverySiteDataSourceName string, body armmigrate.SQLDiscoverySiteDataSource, options *armmigrate.SQLDiscoverySiteDataSourceControllerClientBeginCreateOptions) (resp azfake.PollerResponder[armmigrate.SQLDiscoverySiteDataSourceControllerClientCreateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method SQLDiscoverySiteDataSourceControllerClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, discoverySiteDataSourceName string, options *armmigrate.SQLDiscoverySiteDataSourceControllerClientDeleteOptions) (resp azfake.Responder[armmigrate.SQLDiscoverySiteDataSourceControllerClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method SQLDiscoverySiteDataSourceControllerClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, discoverySiteDataSourceName string, options *armmigrate.SQLDiscoverySiteDataSourceControllerClientGetOptions) (resp azfake.Responder[armmigrate.SQLDiscoverySiteDataSourceControllerClientGetResponse], errResp azfake.ErrorResponder) + + // NewListBySQLSitePager is the fake for method SQLDiscoverySiteDataSourceControllerClient.NewListBySQLSitePager + // HTTP status codes to indicate success: http.StatusOK + NewListBySQLSitePager func(resourceGroupName string, siteName string, sqlSiteName string, options *armmigrate.SQLDiscoverySiteDataSourceControllerClientListBySQLSiteOptions) (resp azfake.PagerResponder[armmigrate.SQLDiscoverySiteDataSourceControllerClientListBySQLSiteResponse]) +} + +// NewSQLDiscoverySiteDataSourceControllerServerTransport creates a new instance of SQLDiscoverySiteDataSourceControllerServerTransport with the provided implementation. +// The returned SQLDiscoverySiteDataSourceControllerServerTransport instance is connected to an instance of armmigrate.SQLDiscoverySiteDataSourceControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSQLDiscoverySiteDataSourceControllerServerTransport(srv *SQLDiscoverySiteDataSourceControllerServer) *SQLDiscoverySiteDataSourceControllerServerTransport { + return &SQLDiscoverySiteDataSourceControllerServerTransport{ + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[armmigrate.SQLDiscoverySiteDataSourceControllerClientCreateResponse]](), + newListBySQLSitePager: newTracker[azfake.PagerResponder[armmigrate.SQLDiscoverySiteDataSourceControllerClientListBySQLSiteResponse]](), + } +} + +// SQLDiscoverySiteDataSourceControllerServerTransport connects instances of armmigrate.SQLDiscoverySiteDataSourceControllerClient to instances of SQLDiscoverySiteDataSourceControllerServer. +// Don't use this type directly, use NewSQLDiscoverySiteDataSourceControllerServerTransport instead. +type SQLDiscoverySiteDataSourceControllerServerTransport struct { + srv *SQLDiscoverySiteDataSourceControllerServer + beginCreate *tracker[azfake.PollerResponder[armmigrate.SQLDiscoverySiteDataSourceControllerClientCreateResponse]] + newListBySQLSitePager *tracker[azfake.PagerResponder[armmigrate.SQLDiscoverySiteDataSourceControllerClientListBySQLSiteResponse]] +} + +// Do implements the policy.Transporter interface for SQLDiscoverySiteDataSourceControllerServerTransport. +func (s *SQLDiscoverySiteDataSourceControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "SQLDiscoverySiteDataSourceControllerClient.BeginCreate": + resp, err = s.dispatchBeginCreate(req) + case "SQLDiscoverySiteDataSourceControllerClient.Delete": + resp, err = s.dispatchDelete(req) + case "SQLDiscoverySiteDataSourceControllerClient.Get": + resp, err = s.dispatchGet(req) + case "SQLDiscoverySiteDataSourceControllerClient.NewListBySQLSitePager": + resp, err = s.dispatchNewListBySQLSitePager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *SQLDiscoverySiteDataSourceControllerServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { + if s.srv.BeginCreate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} + } + beginCreate := s.beginCreate.get(req) + if beginCreate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sqlSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/discoverySiteDataSources/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.SQLDiscoverySiteDataSource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + sqlSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sqlSiteName")]) + if err != nil { + return nil, err + } + discoverySiteDataSourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("discoverySiteDataSourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginCreate(req.Context(), resourceGroupNameParam, siteNameParam, sqlSiteNameParam, discoverySiteDataSourceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreate = &respr + s.beginCreate.add(req, beginCreate) + } + + resp, err := server.PollerResponderNext(beginCreate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + s.beginCreate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreate) { + s.beginCreate.remove(req) + } + + return resp, nil +} + +func (s *SQLDiscoverySiteDataSourceControllerServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if s.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sqlSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/discoverySiteDataSources/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + sqlSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sqlSiteName")]) + if err != nil { + return nil, err + } + discoverySiteDataSourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("discoverySiteDataSourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Delete(req.Context(), resourceGroupNameParam, siteNameParam, sqlSiteNameParam, discoverySiteDataSourceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SQLDiscoverySiteDataSourceControllerServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if s.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sqlSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/discoverySiteDataSources/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + sqlSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sqlSiteName")]) + if err != nil { + return nil, err + } + discoverySiteDataSourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("discoverySiteDataSourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, siteNameParam, sqlSiteNameParam, discoverySiteDataSourceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SQLDiscoverySiteDataSource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SQLDiscoverySiteDataSourceControllerServerTransport) dispatchNewListBySQLSitePager(req *http.Request) (*http.Response, error) { + if s.srv.NewListBySQLSitePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySQLSitePager not implemented")} + } + newListBySQLSitePager := s.newListBySQLSitePager.get(req) + if newListBySQLSitePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sqlSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/discoverySiteDataSources` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + sqlSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sqlSiteName")]) + if err != nil { + return nil, err + } + resp := s.srv.NewListBySQLSitePager(resourceGroupNameParam, siteNameParam, sqlSiteNameParam, nil) + newListBySQLSitePager = &resp + s.newListBySQLSitePager.add(req, newListBySQLSitePager) + server.PagerResponderInjectNextLinks(newListBySQLSitePager, req, func(page *armmigrate.SQLDiscoverySiteDataSourceControllerClientListBySQLSiteResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySQLSitePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListBySQLSitePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySQLSitePager) { + s.newListBySQLSitePager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/sqljobscontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/sqljobscontroller_server.go new file mode 100644 index 000000000000..7347e16ad92f --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/sqljobscontroller_server.go @@ -0,0 +1,164 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" +) + +// SQLJobsControllerServer is a fake server for instances of the armmigrate.SQLJobsControllerClient type. +type SQLJobsControllerServer struct { + // Get is the fake for method SQLJobsControllerClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, jobName string, options *armmigrate.SQLJobsControllerClientGetOptions) (resp azfake.Responder[armmigrate.SQLJobsControllerClientGetResponse], errResp azfake.ErrorResponder) + + // NewListBySQLSitePager is the fake for method SQLJobsControllerClient.NewListBySQLSitePager + // HTTP status codes to indicate success: http.StatusOK + NewListBySQLSitePager func(resourceGroupName string, siteName string, sqlSiteName string, options *armmigrate.SQLJobsControllerClientListBySQLSiteOptions) (resp azfake.PagerResponder[armmigrate.SQLJobsControllerClientListBySQLSiteResponse]) +} + +// NewSQLJobsControllerServerTransport creates a new instance of SQLJobsControllerServerTransport with the provided implementation. +// The returned SQLJobsControllerServerTransport instance is connected to an instance of armmigrate.SQLJobsControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSQLJobsControllerServerTransport(srv *SQLJobsControllerServer) *SQLJobsControllerServerTransport { + return &SQLJobsControllerServerTransport{ + srv: srv, + newListBySQLSitePager: newTracker[azfake.PagerResponder[armmigrate.SQLJobsControllerClientListBySQLSiteResponse]](), + } +} + +// SQLJobsControllerServerTransport connects instances of armmigrate.SQLJobsControllerClient to instances of SQLJobsControllerServer. +// Don't use this type directly, use NewSQLJobsControllerServerTransport instead. +type SQLJobsControllerServerTransport struct { + srv *SQLJobsControllerServer + newListBySQLSitePager *tracker[azfake.PagerResponder[armmigrate.SQLJobsControllerClientListBySQLSiteResponse]] +} + +// Do implements the policy.Transporter interface for SQLJobsControllerServerTransport. +func (s *SQLJobsControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "SQLJobsControllerClient.Get": + resp, err = s.dispatchGet(req) + case "SQLJobsControllerClient.NewListBySQLSitePager": + resp, err = s.dispatchNewListBySQLSitePager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *SQLJobsControllerServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if s.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sqlSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/jobs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + sqlSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sqlSiteName")]) + if err != nil { + return nil, err + } + jobNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("jobName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, siteNameParam, sqlSiteNameParam, jobNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SQLJob, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SQLJobsControllerServerTransport) dispatchNewListBySQLSitePager(req *http.Request) (*http.Response, error) { + if s.srv.NewListBySQLSitePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySQLSitePager not implemented")} + } + newListBySQLSitePager := s.newListBySQLSitePager.get(req) + if newListBySQLSitePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sqlSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/jobs` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + sqlSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sqlSiteName")]) + if err != nil { + return nil, err + } + resp := s.srv.NewListBySQLSitePager(resourceGroupNameParam, siteNameParam, sqlSiteNameParam, nil) + newListBySQLSitePager = &resp + s.newListBySQLSitePager.add(req, newListBySQLSitePager) + server.PagerResponderInjectNextLinks(newListBySQLSitePager, req, func(page *armmigrate.SQLJobsControllerClientListBySQLSiteResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySQLSitePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListBySQLSitePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySQLSitePager) { + s.newListBySQLSitePager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/sqloperationsstatuscontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/sqloperationsstatuscontroller_server.go new file mode 100644 index 000000000000..b7417dbb2f39 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/sqloperationsstatuscontroller_server.go @@ -0,0 +1,108 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" +) + +// SQLOperationsStatusControllerServer is a fake server for instances of the armmigrate.SQLOperationsStatusControllerClient type. +type SQLOperationsStatusControllerServer struct { + // GetSQLOperationStatus is the fake for method SQLOperationsStatusControllerClient.GetSQLOperationStatus + // HTTP status codes to indicate success: http.StatusOK + GetSQLOperationStatus func(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, operationStatusName string, options *armmigrate.SQLOperationsStatusControllerClientGetSQLOperationStatusOptions) (resp azfake.Responder[armmigrate.SQLOperationsStatusControllerClientGetSQLOperationStatusResponse], errResp azfake.ErrorResponder) +} + +// NewSQLOperationsStatusControllerServerTransport creates a new instance of SQLOperationsStatusControllerServerTransport with the provided implementation. +// The returned SQLOperationsStatusControllerServerTransport instance is connected to an instance of armmigrate.SQLOperationsStatusControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSQLOperationsStatusControllerServerTransport(srv *SQLOperationsStatusControllerServer) *SQLOperationsStatusControllerServerTransport { + return &SQLOperationsStatusControllerServerTransport{srv: srv} +} + +// SQLOperationsStatusControllerServerTransport connects instances of armmigrate.SQLOperationsStatusControllerClient to instances of SQLOperationsStatusControllerServer. +// Don't use this type directly, use NewSQLOperationsStatusControllerServerTransport instead. +type SQLOperationsStatusControllerServerTransport struct { + srv *SQLOperationsStatusControllerServer +} + +// Do implements the policy.Transporter interface for SQLOperationsStatusControllerServerTransport. +func (s *SQLOperationsStatusControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "SQLOperationsStatusControllerClient.GetSQLOperationStatus": + resp, err = s.dispatchGetSQLOperationStatus(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *SQLOperationsStatusControllerServerTransport) dispatchGetSQLOperationStatus(req *http.Request) (*http.Response, error) { + if s.srv.GetSQLOperationStatus == nil { + return nil, &nonRetriableError{errors.New("fake for method GetSQLOperationStatus not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sqlSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operationsStatus/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + sqlSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sqlSiteName")]) + if err != nil { + return nil, err + } + operationStatusNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationStatusName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.GetSQLOperationStatus(req.Context(), resourceGroupNameParam, siteNameParam, sqlSiteNameParam, operationStatusNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationStatus, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/sqlrunasaccountscontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/sqlrunasaccountscontroller_server.go new file mode 100644 index 000000000000..c60b967f3ca2 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/sqlrunasaccountscontroller_server.go @@ -0,0 +1,164 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" +) + +// SQLRunAsAccountsControllerServer is a fake server for instances of the armmigrate.SQLRunAsAccountsControllerClient type. +type SQLRunAsAccountsControllerServer struct { + // Get is the fake for method SQLRunAsAccountsControllerClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, accountName string, options *armmigrate.SQLRunAsAccountsControllerClientGetOptions) (resp azfake.Responder[armmigrate.SQLRunAsAccountsControllerClientGetResponse], errResp azfake.ErrorResponder) + + // NewListBySQLSitePager is the fake for method SQLRunAsAccountsControllerClient.NewListBySQLSitePager + // HTTP status codes to indicate success: http.StatusOK + NewListBySQLSitePager func(resourceGroupName string, siteName string, sqlSiteName string, options *armmigrate.SQLRunAsAccountsControllerClientListBySQLSiteOptions) (resp azfake.PagerResponder[armmigrate.SQLRunAsAccountsControllerClientListBySQLSiteResponse]) +} + +// NewSQLRunAsAccountsControllerServerTransport creates a new instance of SQLRunAsAccountsControllerServerTransport with the provided implementation. +// The returned SQLRunAsAccountsControllerServerTransport instance is connected to an instance of armmigrate.SQLRunAsAccountsControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSQLRunAsAccountsControllerServerTransport(srv *SQLRunAsAccountsControllerServer) *SQLRunAsAccountsControllerServerTransport { + return &SQLRunAsAccountsControllerServerTransport{ + srv: srv, + newListBySQLSitePager: newTracker[azfake.PagerResponder[armmigrate.SQLRunAsAccountsControllerClientListBySQLSiteResponse]](), + } +} + +// SQLRunAsAccountsControllerServerTransport connects instances of armmigrate.SQLRunAsAccountsControllerClient to instances of SQLRunAsAccountsControllerServer. +// Don't use this type directly, use NewSQLRunAsAccountsControllerServerTransport instead. +type SQLRunAsAccountsControllerServerTransport struct { + srv *SQLRunAsAccountsControllerServer + newListBySQLSitePager *tracker[azfake.PagerResponder[armmigrate.SQLRunAsAccountsControllerClientListBySQLSiteResponse]] +} + +// Do implements the policy.Transporter interface for SQLRunAsAccountsControllerServerTransport. +func (s *SQLRunAsAccountsControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "SQLRunAsAccountsControllerClient.Get": + resp, err = s.dispatchGet(req) + case "SQLRunAsAccountsControllerClient.NewListBySQLSitePager": + resp, err = s.dispatchNewListBySQLSitePager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *SQLRunAsAccountsControllerServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if s.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sqlSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/runAsAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + sqlSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sqlSiteName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, siteNameParam, sqlSiteNameParam, accountNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SQLRunAsAccount, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SQLRunAsAccountsControllerServerTransport) dispatchNewListBySQLSitePager(req *http.Request) (*http.Response, error) { + if s.srv.NewListBySQLSitePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySQLSitePager not implemented")} + } + newListBySQLSitePager := s.newListBySQLSitePager.get(req) + if newListBySQLSitePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sqlSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/runAsAccounts` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + sqlSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sqlSiteName")]) + if err != nil { + return nil, err + } + resp := s.srv.NewListBySQLSitePager(resourceGroupNameParam, siteNameParam, sqlSiteNameParam, nil) + newListBySQLSitePager = &resp + s.newListBySQLSitePager.add(req, newListBySQLSitePager) + server.PagerResponderInjectNextLinks(newListBySQLSitePager, req, func(page *armmigrate.SQLRunAsAccountsControllerClientListBySQLSiteResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySQLSitePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListBySQLSitePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySQLSitePager) { + s.newListBySQLSitePager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/sqlserverscontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/sqlserverscontroller_server.go new file mode 100644 index 000000000000..2eda8d1cda99 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/sqlserverscontroller_server.go @@ -0,0 +1,255 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// SQLServersControllerServer is a fake server for instances of the armmigrate.SQLServersControllerClient type. +type SQLServersControllerServer struct { + // Get is the fake for method SQLServersControllerClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, sqlServerName string, options *armmigrate.SQLServersControllerClientGetOptions) (resp azfake.Responder[armmigrate.SQLServersControllerClientGetResponse], errResp azfake.ErrorResponder) + + // NewListBySQLSitePager is the fake for method SQLServersControllerClient.NewListBySQLSitePager + // HTTP status codes to indicate success: http.StatusOK + NewListBySQLSitePager func(resourceGroupName string, siteName string, sqlSiteName string, options *armmigrate.SQLServersControllerClientListBySQLSiteOptions) (resp azfake.PagerResponder[armmigrate.SQLServersControllerClientListBySQLSiteResponse]) + + // Update is the fake for method SQLServersControllerClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, sqlServerName string, body armmigrate.SQLServerV2Update, options *armmigrate.SQLServersControllerClientUpdateOptions) (resp azfake.Responder[armmigrate.SQLServersControllerClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewSQLServersControllerServerTransport creates a new instance of SQLServersControllerServerTransport with the provided implementation. +// The returned SQLServersControllerServerTransport instance is connected to an instance of armmigrate.SQLServersControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSQLServersControllerServerTransport(srv *SQLServersControllerServer) *SQLServersControllerServerTransport { + return &SQLServersControllerServerTransport{ + srv: srv, + newListBySQLSitePager: newTracker[azfake.PagerResponder[armmigrate.SQLServersControllerClientListBySQLSiteResponse]](), + } +} + +// SQLServersControllerServerTransport connects instances of armmigrate.SQLServersControllerClient to instances of SQLServersControllerServer. +// Don't use this type directly, use NewSQLServersControllerServerTransport instead. +type SQLServersControllerServerTransport struct { + srv *SQLServersControllerServer + newListBySQLSitePager *tracker[azfake.PagerResponder[armmigrate.SQLServersControllerClientListBySQLSiteResponse]] +} + +// Do implements the policy.Transporter interface for SQLServersControllerServerTransport. +func (s *SQLServersControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "SQLServersControllerClient.Get": + resp, err = s.dispatchGet(req) + case "SQLServersControllerClient.NewListBySQLSitePager": + resp, err = s.dispatchNewListBySQLSitePager(req) + case "SQLServersControllerClient.Update": + resp, err = s.dispatchUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *SQLServersControllerServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if s.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sqlSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sqlServers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + sqlSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sqlSiteName")]) + if err != nil { + return nil, err + } + sqlServerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sqlServerName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, siteNameParam, sqlSiteNameParam, sqlServerNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SQLServerV2, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SQLServersControllerServerTransport) dispatchNewListBySQLSitePager(req *http.Request) (*http.Response, error) { + if s.srv.NewListBySQLSitePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySQLSitePager not implemented")} + } + newListBySQLSitePager := s.newListBySQLSitePager.get(req) + if newListBySQLSitePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sqlSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sqlServers` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("top")) + if err != nil { + return nil, err + } + topParam := getOptional(topUnescaped) + continuationTokenUnescaped, err := url.QueryUnescape(qp.Get("continuationToken")) + if err != nil { + return nil, err + } + continuationTokenParam := getOptional(continuationTokenUnescaped) + totalRecordCountUnescaped, err := url.QueryUnescape(qp.Get("totalRecordCount")) + if err != nil { + return nil, err + } + totalRecordCountParam, err := parseOptional(totalRecordCountUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + sqlSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sqlSiteName")]) + if err != nil { + return nil, err + } + var options *armmigrate.SQLServersControllerClientListBySQLSiteOptions + if filterParam != nil || topParam != nil || continuationTokenParam != nil || totalRecordCountParam != nil { + options = &armmigrate.SQLServersControllerClientListBySQLSiteOptions{ + Filter: filterParam, + Top: topParam, + ContinuationToken: continuationTokenParam, + TotalRecordCount: totalRecordCountParam, + } + } + resp := s.srv.NewListBySQLSitePager(resourceGroupNameParam, siteNameParam, sqlSiteNameParam, options) + newListBySQLSitePager = &resp + s.newListBySQLSitePager.add(req, newListBySQLSitePager) + server.PagerResponderInjectNextLinks(newListBySQLSitePager, req, func(page *armmigrate.SQLServersControllerClientListBySQLSiteResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySQLSitePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListBySQLSitePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySQLSitePager) { + s.newListBySQLSitePager.remove(req) + } + return resp, nil +} + +func (s *SQLServersControllerServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if s.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sqlSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sqlServers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.SQLServerV2Update](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + sqlSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sqlSiteName")]) + if err != nil { + return nil, err + } + sqlServerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sqlServerName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Update(req.Context(), resourceGroupNameParam, siteNameParam, sqlSiteNameParam, sqlServerNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SQLServerV2, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/sqlsitescontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/sqlsitescontroller_server.go new file mode 100644 index 000000000000..f02b4ccbedb2 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/sqlsitescontroller_server.go @@ -0,0 +1,580 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// SQLSitesControllerServer is a fake server for instances of the armmigrate.SQLSitesControllerClient type. +type SQLSitesControllerServer struct { + // Create is the fake for method SQLSitesControllerClient.Create + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + Create func(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, body armmigrate.SQLSite, options *armmigrate.SQLSitesControllerClientCreateOptions) (resp azfake.Responder[armmigrate.SQLSitesControllerClientCreateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method SQLSitesControllerClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, options *armmigrate.SQLSitesControllerClientDeleteOptions) (resp azfake.Responder[armmigrate.SQLSitesControllerClientDeleteResponse], errResp azfake.ErrorResponder) + + // ErrorSummary is the fake for method SQLSitesControllerClient.ErrorSummary + // HTTP status codes to indicate success: http.StatusOK + ErrorSummary func(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, body armmigrate.ErrorSummaryRequest, options *armmigrate.SQLSitesControllerClientErrorSummaryOptions) (resp azfake.Responder[armmigrate.SQLSitesControllerClientErrorSummaryResponse], errResp azfake.ErrorResponder) + + // BeginExportSQLServerErrors is the fake for method SQLSitesControllerClient.BeginExportSQLServerErrors + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginExportSQLServerErrors func(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, body any, options *armmigrate.SQLSitesControllerClientBeginExportSQLServerErrorsOptions) (resp azfake.PollerResponder[armmigrate.SQLSitesControllerClientExportSQLServerErrorsResponse], errResp azfake.ErrorResponder) + + // BeginExportSQLServers is the fake for method SQLSitesControllerClient.BeginExportSQLServers + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginExportSQLServers func(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, body armmigrate.ExportSQLServersRequest, options *armmigrate.SQLSitesControllerClientBeginExportSQLServersOptions) (resp azfake.PollerResponder[armmigrate.SQLSitesControllerClientExportSQLServersResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method SQLSitesControllerClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, options *armmigrate.SQLSitesControllerClientGetOptions) (resp azfake.Responder[armmigrate.SQLSitesControllerClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByMasterSitePager is the fake for method SQLSitesControllerClient.NewListByMasterSitePager + // HTTP status codes to indicate success: http.StatusOK + NewListByMasterSitePager func(resourceGroupName string, siteName string, options *armmigrate.SQLSitesControllerClientListByMasterSiteOptions) (resp azfake.PagerResponder[armmigrate.SQLSitesControllerClientListByMasterSiteResponse]) + + // BeginRefresh is the fake for method SQLSitesControllerClient.BeginRefresh + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginRefresh func(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, body armmigrate.SQLSiteRefreshBody, options *armmigrate.SQLSitesControllerClientBeginRefreshOptions) (resp azfake.PollerResponder[armmigrate.SQLSitesControllerClientRefreshResponse], errResp azfake.ErrorResponder) + + // Summary is the fake for method SQLSitesControllerClient.Summary + // HTTP status codes to indicate success: http.StatusOK + Summary func(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, options *armmigrate.SQLSitesControllerClientSummaryOptions) (resp azfake.Responder[armmigrate.SQLSitesControllerClientSummaryResponse], errResp azfake.ErrorResponder) + + // BeginUpdate is the fake for method SQLSitesControllerClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, properties armmigrate.SQLSiteUpdate, options *armmigrate.SQLSitesControllerClientBeginUpdateOptions) (resp azfake.PollerResponder[armmigrate.SQLSitesControllerClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewSQLSitesControllerServerTransport creates a new instance of SQLSitesControllerServerTransport with the provided implementation. +// The returned SQLSitesControllerServerTransport instance is connected to an instance of armmigrate.SQLSitesControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSQLSitesControllerServerTransport(srv *SQLSitesControllerServer) *SQLSitesControllerServerTransport { + return &SQLSitesControllerServerTransport{ + srv: srv, + beginExportSQLServerErrors: newTracker[azfake.PollerResponder[armmigrate.SQLSitesControllerClientExportSQLServerErrorsResponse]](), + beginExportSQLServers: newTracker[azfake.PollerResponder[armmigrate.SQLSitesControllerClientExportSQLServersResponse]](), + newListByMasterSitePager: newTracker[azfake.PagerResponder[armmigrate.SQLSitesControllerClientListByMasterSiteResponse]](), + beginRefresh: newTracker[azfake.PollerResponder[armmigrate.SQLSitesControllerClientRefreshResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armmigrate.SQLSitesControllerClientUpdateResponse]](), + } +} + +// SQLSitesControllerServerTransport connects instances of armmigrate.SQLSitesControllerClient to instances of SQLSitesControllerServer. +// Don't use this type directly, use NewSQLSitesControllerServerTransport instead. +type SQLSitesControllerServerTransport struct { + srv *SQLSitesControllerServer + beginExportSQLServerErrors *tracker[azfake.PollerResponder[armmigrate.SQLSitesControllerClientExportSQLServerErrorsResponse]] + beginExportSQLServers *tracker[azfake.PollerResponder[armmigrate.SQLSitesControllerClientExportSQLServersResponse]] + newListByMasterSitePager *tracker[azfake.PagerResponder[armmigrate.SQLSitesControllerClientListByMasterSiteResponse]] + beginRefresh *tracker[azfake.PollerResponder[armmigrate.SQLSitesControllerClientRefreshResponse]] + beginUpdate *tracker[azfake.PollerResponder[armmigrate.SQLSitesControllerClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for SQLSitesControllerServerTransport. +func (s *SQLSitesControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "SQLSitesControllerClient.Create": + resp, err = s.dispatchCreate(req) + case "SQLSitesControllerClient.Delete": + resp, err = s.dispatchDelete(req) + case "SQLSitesControllerClient.ErrorSummary": + resp, err = s.dispatchErrorSummary(req) + case "SQLSitesControllerClient.BeginExportSQLServerErrors": + resp, err = s.dispatchBeginExportSQLServerErrors(req) + case "SQLSitesControllerClient.BeginExportSQLServers": + resp, err = s.dispatchBeginExportSQLServers(req) + case "SQLSitesControllerClient.Get": + resp, err = s.dispatchGet(req) + case "SQLSitesControllerClient.NewListByMasterSitePager": + resp, err = s.dispatchNewListByMasterSitePager(req) + case "SQLSitesControllerClient.BeginRefresh": + resp, err = s.dispatchBeginRefresh(req) + case "SQLSitesControllerClient.Summary": + resp, err = s.dispatchSummary(req) + case "SQLSitesControllerClient.BeginUpdate": + resp, err = s.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *SQLSitesControllerServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { + if s.srv.Create == nil { + return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sqlSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.SQLSite](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + sqlSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sqlSiteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Create(req.Context(), resourceGroupNameParam, siteNameParam, sqlSiteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SQLSite, req) + if err != nil { + return nil, err + } + if val := server.GetResponse(respr).RetryAfter; val != nil { + resp.Header.Set("Retry-After", strconv.FormatInt(int64(*val), 10)) + } + return resp, nil +} + +func (s *SQLSitesControllerServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if s.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sqlSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + sqlSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sqlSiteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Delete(req.Context(), resourceGroupNameParam, siteNameParam, sqlSiteNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SQLSitesControllerServerTransport) dispatchErrorSummary(req *http.Request) (*http.Response, error) { + if s.srv.ErrorSummary == nil { + return nil, &nonRetriableError{errors.New("fake for method ErrorSummary not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sqlSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/errorSummary` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.ErrorSummaryRequest](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + sqlSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sqlSiteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.ErrorSummary(req.Context(), resourceGroupNameParam, siteNameParam, sqlSiteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SiteErrorSummary, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SQLSitesControllerServerTransport) dispatchBeginExportSQLServerErrors(req *http.Request) (*http.Response, error) { + if s.srv.BeginExportSQLServerErrors == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginExportSQLServerErrors not implemented")} + } + beginExportSQLServerErrors := s.beginExportSQLServerErrors.get(req) + if beginExportSQLServerErrors == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sqlSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/exportSqlServerErrors` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[any](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + sqlSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sqlSiteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginExportSQLServerErrors(req.Context(), resourceGroupNameParam, siteNameParam, sqlSiteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginExportSQLServerErrors = &respr + s.beginExportSQLServerErrors.add(req, beginExportSQLServerErrors) + } + + resp, err := server.PollerResponderNext(beginExportSQLServerErrors, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + s.beginExportSQLServerErrors.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginExportSQLServerErrors) { + s.beginExportSQLServerErrors.remove(req) + } + + return resp, nil +} + +func (s *SQLSitesControllerServerTransport) dispatchBeginExportSQLServers(req *http.Request) (*http.Response, error) { + if s.srv.BeginExportSQLServers == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginExportSQLServers not implemented")} + } + beginExportSQLServers := s.beginExportSQLServers.get(req) + if beginExportSQLServers == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sqlSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/exportSqlServers` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.ExportSQLServersRequest](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + sqlSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sqlSiteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginExportSQLServers(req.Context(), resourceGroupNameParam, siteNameParam, sqlSiteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginExportSQLServers = &respr + s.beginExportSQLServers.add(req, beginExportSQLServers) + } + + resp, err := server.PollerResponderNext(beginExportSQLServers, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + s.beginExportSQLServers.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginExportSQLServers) { + s.beginExportSQLServers.remove(req) + } + + return resp, nil +} + +func (s *SQLSitesControllerServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if s.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sqlSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + sqlSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sqlSiteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, siteNameParam, sqlSiteNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SQLSite, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SQLSitesControllerServerTransport) dispatchNewListByMasterSitePager(req *http.Request) (*http.Response, error) { + if s.srv.NewListByMasterSitePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByMasterSitePager not implemented")} + } + newListByMasterSitePager := s.newListByMasterSitePager.get(req) + if newListByMasterSitePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sqlSites` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + resp := s.srv.NewListByMasterSitePager(resourceGroupNameParam, siteNameParam, nil) + newListByMasterSitePager = &resp + s.newListByMasterSitePager.add(req, newListByMasterSitePager) + server.PagerResponderInjectNextLinks(newListByMasterSitePager, req, func(page *armmigrate.SQLSitesControllerClientListByMasterSiteResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByMasterSitePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListByMasterSitePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByMasterSitePager) { + s.newListByMasterSitePager.remove(req) + } + return resp, nil +} + +func (s *SQLSitesControllerServerTransport) dispatchBeginRefresh(req *http.Request) (*http.Response, error) { + if s.srv.BeginRefresh == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginRefresh not implemented")} + } + beginRefresh := s.beginRefresh.get(req) + if beginRefresh == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sqlSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/refresh` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.SQLSiteRefreshBody](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + sqlSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sqlSiteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginRefresh(req.Context(), resourceGroupNameParam, siteNameParam, sqlSiteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginRefresh = &respr + s.beginRefresh.add(req, beginRefresh) + } + + resp, err := server.PollerResponderNext(beginRefresh, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + s.beginRefresh.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginRefresh) { + s.beginRefresh.remove(req) + } + + return resp, nil +} + +func (s *SQLSitesControllerServerTransport) dispatchSummary(req *http.Request) (*http.Response, error) { + if s.srv.Summary == nil { + return nil, &nonRetriableError{errors.New("fake for method Summary not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sqlSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/summary` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + sqlSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sqlSiteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Summary(req.Context(), resourceGroupNameParam, siteNameParam, sqlSiteNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SQLSiteUsage, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SQLSitesControllerServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if s.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := s.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sqlSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.SQLSiteUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + sqlSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sqlSiteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginUpdate(req.Context(), resourceGroupNameParam, siteNameParam, sqlSiteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + s.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + s.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + s.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/tomcatwebapplicationscontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/tomcatwebapplicationscontroller_server.go new file mode 100644 index 000000000000..e0815e477c58 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/tomcatwebapplicationscontroller_server.go @@ -0,0 +1,255 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// TomcatWebApplicationsControllerServer is a fake server for instances of the armmigrate.TomcatWebApplicationsControllerClient type. +type TomcatWebApplicationsControllerServer struct { + // Get is the fake for method TomcatWebApplicationsControllerClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, webApplicationName string, options *armmigrate.TomcatWebApplicationsControllerClientGetOptions) (resp azfake.Responder[armmigrate.TomcatWebApplicationsControllerClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByWebAppSitePager is the fake for method TomcatWebApplicationsControllerClient.NewListByWebAppSitePager + // HTTP status codes to indicate success: http.StatusOK + NewListByWebAppSitePager func(resourceGroupName string, siteName string, webAppSiteName string, options *armmigrate.TomcatWebApplicationsControllerClientListByWebAppSiteOptions) (resp azfake.PagerResponder[armmigrate.TomcatWebApplicationsControllerClientListByWebAppSiteResponse]) + + // Update is the fake for method TomcatWebApplicationsControllerClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, webApplicationName string, body any, options *armmigrate.TomcatWebApplicationsControllerClientUpdateOptions) (resp azfake.Responder[armmigrate.TomcatWebApplicationsControllerClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewTomcatWebApplicationsControllerServerTransport creates a new instance of TomcatWebApplicationsControllerServerTransport with the provided implementation. +// The returned TomcatWebApplicationsControllerServerTransport instance is connected to an instance of armmigrate.TomcatWebApplicationsControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewTomcatWebApplicationsControllerServerTransport(srv *TomcatWebApplicationsControllerServer) *TomcatWebApplicationsControllerServerTransport { + return &TomcatWebApplicationsControllerServerTransport{ + srv: srv, + newListByWebAppSitePager: newTracker[azfake.PagerResponder[armmigrate.TomcatWebApplicationsControllerClientListByWebAppSiteResponse]](), + } +} + +// TomcatWebApplicationsControllerServerTransport connects instances of armmigrate.TomcatWebApplicationsControllerClient to instances of TomcatWebApplicationsControllerServer. +// Don't use this type directly, use NewTomcatWebApplicationsControllerServerTransport instead. +type TomcatWebApplicationsControllerServerTransport struct { + srv *TomcatWebApplicationsControllerServer + newListByWebAppSitePager *tracker[azfake.PagerResponder[armmigrate.TomcatWebApplicationsControllerClientListByWebAppSiteResponse]] +} + +// Do implements the policy.Transporter interface for TomcatWebApplicationsControllerServerTransport. +func (t *TomcatWebApplicationsControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "TomcatWebApplicationsControllerClient.Get": + resp, err = t.dispatchGet(req) + case "TomcatWebApplicationsControllerClient.NewListByWebAppSitePager": + resp, err = t.dispatchNewListByWebAppSitePager(req) + case "TomcatWebApplicationsControllerClient.Update": + resp, err = t.dispatchUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (t *TomcatWebApplicationsControllerServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if t.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/webAppSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tomcatWebApplications/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + webAppSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("webAppSiteName")]) + if err != nil { + return nil, err + } + webApplicationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("webApplicationName")]) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.Get(req.Context(), resourceGroupNameParam, siteNameParam, webAppSiteNameParam, webApplicationNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).TomcatWebApplications, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (t *TomcatWebApplicationsControllerServerTransport) dispatchNewListByWebAppSitePager(req *http.Request) (*http.Response, error) { + if t.srv.NewListByWebAppSitePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByWebAppSitePager not implemented")} + } + newListByWebAppSitePager := t.newListByWebAppSitePager.get(req) + if newListByWebAppSitePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/webAppSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tomcatWebApplications` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("top")) + if err != nil { + return nil, err + } + topParam := getOptional(topUnescaped) + continuationTokenUnescaped, err := url.QueryUnescape(qp.Get("continuationToken")) + if err != nil { + return nil, err + } + continuationTokenParam := getOptional(continuationTokenUnescaped) + totalRecordCountUnescaped, err := url.QueryUnescape(qp.Get("totalRecordCount")) + if err != nil { + return nil, err + } + totalRecordCountParam, err := parseOptional(totalRecordCountUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + webAppSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("webAppSiteName")]) + if err != nil { + return nil, err + } + var options *armmigrate.TomcatWebApplicationsControllerClientListByWebAppSiteOptions + if filterParam != nil || topParam != nil || continuationTokenParam != nil || totalRecordCountParam != nil { + options = &armmigrate.TomcatWebApplicationsControllerClientListByWebAppSiteOptions{ + Filter: filterParam, + Top: topParam, + ContinuationToken: continuationTokenParam, + TotalRecordCount: totalRecordCountParam, + } + } + resp := t.srv.NewListByWebAppSitePager(resourceGroupNameParam, siteNameParam, webAppSiteNameParam, options) + newListByWebAppSitePager = &resp + t.newListByWebAppSitePager.add(req, newListByWebAppSitePager) + server.PagerResponderInjectNextLinks(newListByWebAppSitePager, req, func(page *armmigrate.TomcatWebApplicationsControllerClientListByWebAppSiteResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByWebAppSitePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + t.newListByWebAppSitePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByWebAppSitePager) { + t.newListByWebAppSitePager.remove(req) + } + return resp, nil +} + +func (t *TomcatWebApplicationsControllerServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if t.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/webAppSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tomcatWebApplications/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[any](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + webAppSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("webAppSiteName")]) + if err != nil { + return nil, err + } + webApplicationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("webApplicationName")]) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.Update(req.Context(), resourceGroupNameParam, siteNameParam, webAppSiteNameParam, webApplicationNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).TomcatWebApplications, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/tomcatwebserverscontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/tomcatwebserverscontroller_server.go new file mode 100644 index 000000000000..afd26074cea4 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/tomcatwebserverscontroller_server.go @@ -0,0 +1,204 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// TomcatWebServersControllerServer is a fake server for instances of the armmigrate.TomcatWebServersControllerClient type. +type TomcatWebServersControllerServer struct { + // Get is the fake for method TomcatWebServersControllerClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, webServerName string, options *armmigrate.TomcatWebServersControllerClientGetOptions) (resp azfake.Responder[armmigrate.TomcatWebServersControllerClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByWebAppSitePager is the fake for method TomcatWebServersControllerClient.NewListByWebAppSitePager + // HTTP status codes to indicate success: http.StatusOK + NewListByWebAppSitePager func(resourceGroupName string, siteName string, webAppSiteName string, options *armmigrate.TomcatWebServersControllerClientListByWebAppSiteOptions) (resp azfake.PagerResponder[armmigrate.TomcatWebServersControllerClientListByWebAppSiteResponse]) +} + +// NewTomcatWebServersControllerServerTransport creates a new instance of TomcatWebServersControllerServerTransport with the provided implementation. +// The returned TomcatWebServersControllerServerTransport instance is connected to an instance of armmigrate.TomcatWebServersControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewTomcatWebServersControllerServerTransport(srv *TomcatWebServersControllerServer) *TomcatWebServersControllerServerTransport { + return &TomcatWebServersControllerServerTransport{ + srv: srv, + newListByWebAppSitePager: newTracker[azfake.PagerResponder[armmigrate.TomcatWebServersControllerClientListByWebAppSiteResponse]](), + } +} + +// TomcatWebServersControllerServerTransport connects instances of armmigrate.TomcatWebServersControllerClient to instances of TomcatWebServersControllerServer. +// Don't use this type directly, use NewTomcatWebServersControllerServerTransport instead. +type TomcatWebServersControllerServerTransport struct { + srv *TomcatWebServersControllerServer + newListByWebAppSitePager *tracker[azfake.PagerResponder[armmigrate.TomcatWebServersControllerClientListByWebAppSiteResponse]] +} + +// Do implements the policy.Transporter interface for TomcatWebServersControllerServerTransport. +func (t *TomcatWebServersControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "TomcatWebServersControllerClient.Get": + resp, err = t.dispatchGet(req) + case "TomcatWebServersControllerClient.NewListByWebAppSitePager": + resp, err = t.dispatchNewListByWebAppSitePager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (t *TomcatWebServersControllerServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if t.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/webAppSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tomcatWebServers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + webAppSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("webAppSiteName")]) + if err != nil { + return nil, err + } + webServerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("webServerName")]) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.Get(req.Context(), resourceGroupNameParam, siteNameParam, webAppSiteNameParam, webServerNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).TomcatWebServers, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (t *TomcatWebServersControllerServerTransport) dispatchNewListByWebAppSitePager(req *http.Request) (*http.Response, error) { + if t.srv.NewListByWebAppSitePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByWebAppSitePager not implemented")} + } + newListByWebAppSitePager := t.newListByWebAppSitePager.get(req) + if newListByWebAppSitePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/webAppSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tomcatWebServers` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("top")) + if err != nil { + return nil, err + } + topParam := getOptional(topUnescaped) + continuationTokenUnescaped, err := url.QueryUnescape(qp.Get("continuationToken")) + if err != nil { + return nil, err + } + continuationTokenParam := getOptional(continuationTokenUnescaped) + totalRecordCountUnescaped, err := url.QueryUnescape(qp.Get("totalRecordCount")) + if err != nil { + return nil, err + } + totalRecordCountParam, err := parseOptional(totalRecordCountUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + webAppSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("webAppSiteName")]) + if err != nil { + return nil, err + } + var options *armmigrate.TomcatWebServersControllerClientListByWebAppSiteOptions + if filterParam != nil || topParam != nil || continuationTokenParam != nil || totalRecordCountParam != nil { + options = &armmigrate.TomcatWebServersControllerClientListByWebAppSiteOptions{ + Filter: filterParam, + Top: topParam, + ContinuationToken: continuationTokenParam, + TotalRecordCount: totalRecordCountParam, + } + } + resp := t.srv.NewListByWebAppSitePager(resourceGroupNameParam, siteNameParam, webAppSiteNameParam, options) + newListByWebAppSitePager = &resp + t.newListByWebAppSitePager.add(req, newListByWebAppSitePager) + server.PagerResponderInjectNextLinks(newListByWebAppSitePager, req, func(page *armmigrate.TomcatWebServersControllerClientListByWebAppSiteResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByWebAppSitePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + t.newListByWebAppSitePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByWebAppSitePager) { + t.newListByWebAppSitePager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/vcentercontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/vcentercontroller_server.go new file mode 100644 index 000000000000..ef9a08375353 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/vcentercontroller_server.go @@ -0,0 +1,271 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" +) + +// VcenterControllerServer is a fake server for instances of the armmigrate.VcenterControllerClient type. +type VcenterControllerServer struct { + // BeginCreate is the fake for method VcenterControllerClient.BeginCreate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreate func(ctx context.Context, resourceGroupName string, siteName string, vcenterName string, body armmigrate.Vcenter, options *armmigrate.VcenterControllerClientBeginCreateOptions) (resp azfake.PollerResponder[armmigrate.VcenterControllerClientCreateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method VcenterControllerClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, siteName string, vcenterName string, options *armmigrate.VcenterControllerClientDeleteOptions) (resp azfake.Responder[armmigrate.VcenterControllerClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method VcenterControllerClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, siteName string, vcenterName string, options *armmigrate.VcenterControllerClientGetOptions) (resp azfake.Responder[armmigrate.VcenterControllerClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByVmwareSitePager is the fake for method VcenterControllerClient.NewListByVmwareSitePager + // HTTP status codes to indicate success: http.StatusOK + NewListByVmwareSitePager func(resourceGroupName string, siteName string, options *armmigrate.VcenterControllerClientListByVmwareSiteOptions) (resp azfake.PagerResponder[armmigrate.VcenterControllerClientListByVmwareSiteResponse]) +} + +// NewVcenterControllerServerTransport creates a new instance of VcenterControllerServerTransport with the provided implementation. +// The returned VcenterControllerServerTransport instance is connected to an instance of armmigrate.VcenterControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewVcenterControllerServerTransport(srv *VcenterControllerServer) *VcenterControllerServerTransport { + return &VcenterControllerServerTransport{ + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[armmigrate.VcenterControllerClientCreateResponse]](), + newListByVmwareSitePager: newTracker[azfake.PagerResponder[armmigrate.VcenterControllerClientListByVmwareSiteResponse]](), + } +} + +// VcenterControllerServerTransport connects instances of armmigrate.VcenterControllerClient to instances of VcenterControllerServer. +// Don't use this type directly, use NewVcenterControllerServerTransport instead. +type VcenterControllerServerTransport struct { + srv *VcenterControllerServer + beginCreate *tracker[azfake.PollerResponder[armmigrate.VcenterControllerClientCreateResponse]] + newListByVmwareSitePager *tracker[azfake.PagerResponder[armmigrate.VcenterControllerClientListByVmwareSiteResponse]] +} + +// Do implements the policy.Transporter interface for VcenterControllerServerTransport. +func (v *VcenterControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "VcenterControllerClient.BeginCreate": + resp, err = v.dispatchBeginCreate(req) + case "VcenterControllerClient.Delete": + resp, err = v.dispatchDelete(req) + case "VcenterControllerClient.Get": + resp, err = v.dispatchGet(req) + case "VcenterControllerClient.NewListByVmwareSitePager": + resp, err = v.dispatchNewListByVmwareSitePager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (v *VcenterControllerServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { + if v.srv.BeginCreate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} + } + beginCreate := v.beginCreate.get(req) + if beginCreate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/vmwareSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/vcenters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.Vcenter](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + vcenterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vcenterName")]) + if err != nil { + return nil, err + } + respr, errRespr := v.srv.BeginCreate(req.Context(), resourceGroupNameParam, siteNameParam, vcenterNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreate = &respr + v.beginCreate.add(req, beginCreate) + } + + resp, err := server.PollerResponderNext(beginCreate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + v.beginCreate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreate) { + v.beginCreate.remove(req) + } + + return resp, nil +} + +func (v *VcenterControllerServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if v.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/vmwareSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/vcenters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + vcenterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vcenterName")]) + if err != nil { + return nil, err + } + respr, errRespr := v.srv.Delete(req.Context(), resourceGroupNameParam, siteNameParam, vcenterNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (v *VcenterControllerServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if v.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/vmwareSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/vcenters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + vcenterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vcenterName")]) + if err != nil { + return nil, err + } + respr, errRespr := v.srv.Get(req.Context(), resourceGroupNameParam, siteNameParam, vcenterNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Vcenter, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (v *VcenterControllerServerTransport) dispatchNewListByVmwareSitePager(req *http.Request) (*http.Response, error) { + if v.srv.NewListByVmwareSitePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByVmwareSitePager not implemented")} + } + newListByVmwareSitePager := v.newListByVmwareSitePager.get(req) + if newListByVmwareSitePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/vmwareSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/vcenters` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + var options *armmigrate.VcenterControllerClientListByVmwareSiteOptions + if filterParam != nil { + options = &armmigrate.VcenterControllerClientListByVmwareSiteOptions{ + Filter: filterParam, + } + } + resp := v.srv.NewListByVmwareSitePager(resourceGroupNameParam, siteNameParam, options) + newListByVmwareSitePager = &resp + v.newListByVmwareSitePager.add(req, newListByVmwareSitePager) + server.PagerResponderInjectNextLinks(newListByVmwareSitePager, req, func(page *armmigrate.VcenterControllerClientListByVmwareSiteResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByVmwareSitePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + v.newListByVmwareSitePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByVmwareSitePager) { + v.newListByVmwareSitePager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/vmwarecollectors_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/vmwarecollectors_server.go deleted file mode 100644 index 6cf3f68c910e..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/fake/vmwarecollectors_server.go +++ /dev/null @@ -1,258 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" - "net/http" - "net/url" - "reflect" - "regexp" -) - -// VMwareCollectorsServer is a fake server for instances of the armmigrate.VMwareCollectorsClient type. -type VMwareCollectorsServer struct { - // Create is the fake for method VMwareCollectorsClient.Create - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - Create func(ctx context.Context, resourceGroupName string, projectName string, vmWareCollectorName string, options *armmigrate.VMwareCollectorsClientCreateOptions) (resp azfake.Responder[armmigrate.VMwareCollectorsClientCreateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method VMwareCollectorsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, projectName string, vmWareCollectorName string, options *armmigrate.VMwareCollectorsClientDeleteOptions) (resp azfake.Responder[armmigrate.VMwareCollectorsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method VMwareCollectorsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, projectName string, vmWareCollectorName string, options *armmigrate.VMwareCollectorsClientGetOptions) (resp azfake.Responder[armmigrate.VMwareCollectorsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByProjectPager is the fake for method VMwareCollectorsClient.NewListByProjectPager - // HTTP status codes to indicate success: http.StatusOK - NewListByProjectPager func(resourceGroupName string, projectName string, options *armmigrate.VMwareCollectorsClientListByProjectOptions) (resp azfake.PagerResponder[armmigrate.VMwareCollectorsClientListByProjectResponse]) -} - -// NewVMwareCollectorsServerTransport creates a new instance of VMwareCollectorsServerTransport with the provided implementation. -// The returned VMwareCollectorsServerTransport instance is connected to an instance of armmigrate.VMwareCollectorsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewVMwareCollectorsServerTransport(srv *VMwareCollectorsServer) *VMwareCollectorsServerTransport { - return &VMwareCollectorsServerTransport{ - srv: srv, - newListByProjectPager: newTracker[azfake.PagerResponder[armmigrate.VMwareCollectorsClientListByProjectResponse]](), - } -} - -// VMwareCollectorsServerTransport connects instances of armmigrate.VMwareCollectorsClient to instances of VMwareCollectorsServer. -// Don't use this type directly, use NewVMwareCollectorsServerTransport instead. -type VMwareCollectorsServerTransport struct { - srv *VMwareCollectorsServer - newListByProjectPager *tracker[azfake.PagerResponder[armmigrate.VMwareCollectorsClientListByProjectResponse]] -} - -// Do implements the policy.Transporter interface for VMwareCollectorsServerTransport. -func (v *VMwareCollectorsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "VMwareCollectorsClient.Create": - resp, err = v.dispatchCreate(req) - case "VMwareCollectorsClient.Delete": - resp, err = v.dispatchDelete(req) - case "VMwareCollectorsClient.Get": - resp, err = v.dispatchGet(req) - case "VMwareCollectorsClient.NewListByProjectPager": - resp, err = v.dispatchNewListByProjectPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (v *VMwareCollectorsServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { - if v.srv.Create == nil { - return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/vmwarecollectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmigrate.VMwareCollector](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - vmWareCollectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vmWareCollectorName")]) - if err != nil { - return nil, err - } - var options *armmigrate.VMwareCollectorsClientCreateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armmigrate.VMwareCollectorsClientCreateOptions{ - CollectorBody: &body, - } - } - respr, errRespr := v.srv.Create(req.Context(), resourceGroupNameParam, projectNameParam, vmWareCollectorNameParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).VMwareCollector, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (v *VMwareCollectorsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if v.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/vmwarecollectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - vmWareCollectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vmWareCollectorName")]) - if err != nil { - return nil, err - } - respr, errRespr := v.srv.Delete(req.Context(), resourceGroupNameParam, projectNameParam, vmWareCollectorNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (v *VMwareCollectorsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if v.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/vmwarecollectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - vmWareCollectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vmWareCollectorName")]) - if err != nil { - return nil, err - } - respr, errRespr := v.srv.Get(req.Context(), resourceGroupNameParam, projectNameParam, vmWareCollectorNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).VMwareCollector, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).XMSRequestID; val != nil { - resp.Header.Set("x-ms-request-id", *val) - } - return resp, nil -} - -func (v *VMwareCollectorsServerTransport) dispatchNewListByProjectPager(req *http.Request) (*http.Response, error) { - if v.srv.NewListByProjectPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByProjectPager not implemented")} - } - newListByProjectPager := v.newListByProjectPager.get(req) - if newListByProjectPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Migrate/assessmentProjects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/vmwarecollectors` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - resp := v.srv.NewListByProjectPager(resourceGroupNameParam, projectNameParam, nil) - newListByProjectPager = &resp - v.newListByProjectPager.add(req, newListByProjectPager) - } - resp, err := server.PagerResponderNext(newListByProjectPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - v.newListByProjectPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByProjectPager) { - v.newListByProjectPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/vmwarehostcontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/vmwarehostcontroller_server.go new file mode 100644 index 000000000000..62a38950667f --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/vmwarehostcontroller_server.go @@ -0,0 +1,156 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" +) + +// VmwareHostControllerServer is a fake server for instances of the armmigrate.VmwareHostControllerClient type. +type VmwareHostControllerServer struct { + // Get is the fake for method VmwareHostControllerClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, siteName string, hostName string, options *armmigrate.VmwareHostControllerClientGetOptions) (resp azfake.Responder[armmigrate.VmwareHostControllerClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByVmwareSitePager is the fake for method VmwareHostControllerClient.NewListByVmwareSitePager + // HTTP status codes to indicate success: http.StatusOK + NewListByVmwareSitePager func(resourceGroupName string, siteName string, options *armmigrate.VmwareHostControllerClientListByVmwareSiteOptions) (resp azfake.PagerResponder[armmigrate.VmwareHostControllerClientListByVmwareSiteResponse]) +} + +// NewVmwareHostControllerServerTransport creates a new instance of VmwareHostControllerServerTransport with the provided implementation. +// The returned VmwareHostControllerServerTransport instance is connected to an instance of armmigrate.VmwareHostControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewVmwareHostControllerServerTransport(srv *VmwareHostControllerServer) *VmwareHostControllerServerTransport { + return &VmwareHostControllerServerTransport{ + srv: srv, + newListByVmwareSitePager: newTracker[azfake.PagerResponder[armmigrate.VmwareHostControllerClientListByVmwareSiteResponse]](), + } +} + +// VmwareHostControllerServerTransport connects instances of armmigrate.VmwareHostControllerClient to instances of VmwareHostControllerServer. +// Don't use this type directly, use NewVmwareHostControllerServerTransport instead. +type VmwareHostControllerServerTransport struct { + srv *VmwareHostControllerServer + newListByVmwareSitePager *tracker[azfake.PagerResponder[armmigrate.VmwareHostControllerClientListByVmwareSiteResponse]] +} + +// Do implements the policy.Transporter interface for VmwareHostControllerServerTransport. +func (v *VmwareHostControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "VmwareHostControllerClient.Get": + resp, err = v.dispatchGet(req) + case "VmwareHostControllerClient.NewListByVmwareSitePager": + resp, err = v.dispatchNewListByVmwareSitePager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (v *VmwareHostControllerServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if v.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/vmwareSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/hosts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + hostNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("hostName")]) + if err != nil { + return nil, err + } + respr, errRespr := v.srv.Get(req.Context(), resourceGroupNameParam, siteNameParam, hostNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).VmwareHost, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (v *VmwareHostControllerServerTransport) dispatchNewListByVmwareSitePager(req *http.Request) (*http.Response, error) { + if v.srv.NewListByVmwareSitePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByVmwareSitePager not implemented")} + } + newListByVmwareSitePager := v.newListByVmwareSitePager.get(req) + if newListByVmwareSitePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/vmwareSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/hosts` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + resp := v.srv.NewListByVmwareSitePager(resourceGroupNameParam, siteNameParam, nil) + newListByVmwareSitePager = &resp + v.newListByVmwareSitePager.add(req, newListByVmwareSitePager) + server.PagerResponderInjectNextLinks(newListByVmwareSitePager, req, func(page *armmigrate.VmwareHostControllerClientListByVmwareSiteResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByVmwareSitePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + v.newListByVmwareSitePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByVmwareSitePager) { + v.newListByVmwareSitePager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/vmwareoperationsstatus_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/vmwareoperationsstatus_server.go new file mode 100644 index 000000000000..583a6773464d --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/vmwareoperationsstatus_server.go @@ -0,0 +1,104 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" +) + +// VmwareOperationsStatusServer is a fake server for instances of the armmigrate.VmwareOperationsStatusClient type. +type VmwareOperationsStatusServer struct { + // GetVmwareOperationStatus is the fake for method VmwareOperationsStatusClient.GetVmwareOperationStatus + // HTTP status codes to indicate success: http.StatusOK + GetVmwareOperationStatus func(ctx context.Context, resourceGroupName string, siteName string, operationStatusName string, options *armmigrate.VmwareOperationsStatusClientGetVmwareOperationStatusOptions) (resp azfake.Responder[armmigrate.VmwareOperationsStatusClientGetVmwareOperationStatusResponse], errResp azfake.ErrorResponder) +} + +// NewVmwareOperationsStatusServerTransport creates a new instance of VmwareOperationsStatusServerTransport with the provided implementation. +// The returned VmwareOperationsStatusServerTransport instance is connected to an instance of armmigrate.VmwareOperationsStatusClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewVmwareOperationsStatusServerTransport(srv *VmwareOperationsStatusServer) *VmwareOperationsStatusServerTransport { + return &VmwareOperationsStatusServerTransport{srv: srv} +} + +// VmwareOperationsStatusServerTransport connects instances of armmigrate.VmwareOperationsStatusClient to instances of VmwareOperationsStatusServer. +// Don't use this type directly, use NewVmwareOperationsStatusServerTransport instead. +type VmwareOperationsStatusServerTransport struct { + srv *VmwareOperationsStatusServer +} + +// Do implements the policy.Transporter interface for VmwareOperationsStatusServerTransport. +func (v *VmwareOperationsStatusServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "VmwareOperationsStatusClient.GetVmwareOperationStatus": + resp, err = v.dispatchGetVmwareOperationStatus(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (v *VmwareOperationsStatusServerTransport) dispatchGetVmwareOperationStatus(req *http.Request) (*http.Response, error) { + if v.srv.GetVmwareOperationStatus == nil { + return nil, &nonRetriableError{errors.New("fake for method GetVmwareOperationStatus not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/vmwareSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operationsStatus/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + operationStatusNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationStatusName")]) + if err != nil { + return nil, err + } + respr, errRespr := v.srv.GetVmwareOperationStatus(req.Context(), resourceGroupNameParam, siteNameParam, operationStatusNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationStatus, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/vmwarepropertiescontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/vmwarepropertiescontroller_server.go new file mode 100644 index 000000000000..c6922cf25cef --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/vmwarepropertiescontroller_server.go @@ -0,0 +1,287 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" +) + +// VmwarePropertiesControllerServer is a fake server for instances of the armmigrate.VmwarePropertiesControllerClient type. +type VmwarePropertiesControllerServer struct { + // BeginUpdateDependencyMapStatus is the fake for method VmwarePropertiesControllerClient.BeginUpdateDependencyMapStatus + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdateDependencyMapStatus func(ctx context.Context, resourceGroupName string, siteName string, updateMachineDepMapStatus armmigrate.UpdateMachineDepMapStatus, options *armmigrate.VmwarePropertiesControllerClientBeginUpdateDependencyMapStatusOptions) (resp azfake.PollerResponder[armmigrate.VmwarePropertiesControllerClientUpdateDependencyMapStatusResponse], errResp azfake.ErrorResponder) + + // BeginUpdateProperties is the fake for method VmwarePropertiesControllerClient.BeginUpdateProperties + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdateProperties func(ctx context.Context, resourceGroupName string, siteName string, metaData armmigrate.MachineMetadataCollection, options *armmigrate.VmwarePropertiesControllerClientBeginUpdatePropertiesOptions) (resp azfake.PollerResponder[armmigrate.VmwarePropertiesControllerClientUpdatePropertiesResponse], errResp azfake.ErrorResponder) + + // BeginUpdateRunAsAccount is the fake for method VmwarePropertiesControllerClient.BeginUpdateRunAsAccount + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdateRunAsAccount func(ctx context.Context, resourceGroupName string, siteName string, updateMachineRunAsAccount armmigrate.UpdateMachineRunAsAccount, options *armmigrate.VmwarePropertiesControllerClientBeginUpdateRunAsAccountOptions) (resp azfake.PollerResponder[armmigrate.VmwarePropertiesControllerClientUpdateRunAsAccountResponse], errResp azfake.ErrorResponder) + + // BeginUpdateTags is the fake for method VmwarePropertiesControllerClient.BeginUpdateTags + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdateTags func(ctx context.Context, resourceGroupName string, siteName string, updateMachineTags armmigrate.UpdateMachineTags, options *armmigrate.VmwarePropertiesControllerClientBeginUpdateTagsOptions) (resp azfake.PollerResponder[armmigrate.VmwarePropertiesControllerClientUpdateTagsResponse], errResp azfake.ErrorResponder) +} + +// NewVmwarePropertiesControllerServerTransport creates a new instance of VmwarePropertiesControllerServerTransport with the provided implementation. +// The returned VmwarePropertiesControllerServerTransport instance is connected to an instance of armmigrate.VmwarePropertiesControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewVmwarePropertiesControllerServerTransport(srv *VmwarePropertiesControllerServer) *VmwarePropertiesControllerServerTransport { + return &VmwarePropertiesControllerServerTransport{ + srv: srv, + beginUpdateDependencyMapStatus: newTracker[azfake.PollerResponder[armmigrate.VmwarePropertiesControllerClientUpdateDependencyMapStatusResponse]](), + beginUpdateProperties: newTracker[azfake.PollerResponder[armmigrate.VmwarePropertiesControllerClientUpdatePropertiesResponse]](), + beginUpdateRunAsAccount: newTracker[azfake.PollerResponder[armmigrate.VmwarePropertiesControllerClientUpdateRunAsAccountResponse]](), + beginUpdateTags: newTracker[azfake.PollerResponder[armmigrate.VmwarePropertiesControllerClientUpdateTagsResponse]](), + } +} + +// VmwarePropertiesControllerServerTransport connects instances of armmigrate.VmwarePropertiesControllerClient to instances of VmwarePropertiesControllerServer. +// Don't use this type directly, use NewVmwarePropertiesControllerServerTransport instead. +type VmwarePropertiesControllerServerTransport struct { + srv *VmwarePropertiesControllerServer + beginUpdateDependencyMapStatus *tracker[azfake.PollerResponder[armmigrate.VmwarePropertiesControllerClientUpdateDependencyMapStatusResponse]] + beginUpdateProperties *tracker[azfake.PollerResponder[armmigrate.VmwarePropertiesControllerClientUpdatePropertiesResponse]] + beginUpdateRunAsAccount *tracker[azfake.PollerResponder[armmigrate.VmwarePropertiesControllerClientUpdateRunAsAccountResponse]] + beginUpdateTags *tracker[azfake.PollerResponder[armmigrate.VmwarePropertiesControllerClientUpdateTagsResponse]] +} + +// Do implements the policy.Transporter interface for VmwarePropertiesControllerServerTransport. +func (v *VmwarePropertiesControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "VmwarePropertiesControllerClient.BeginUpdateDependencyMapStatus": + resp, err = v.dispatchBeginUpdateDependencyMapStatus(req) + case "VmwarePropertiesControllerClient.BeginUpdateProperties": + resp, err = v.dispatchBeginUpdateProperties(req) + case "VmwarePropertiesControllerClient.BeginUpdateRunAsAccount": + resp, err = v.dispatchBeginUpdateRunAsAccount(req) + case "VmwarePropertiesControllerClient.BeginUpdateTags": + resp, err = v.dispatchBeginUpdateTags(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (v *VmwarePropertiesControllerServerTransport) dispatchBeginUpdateDependencyMapStatus(req *http.Request) (*http.Response, error) { + if v.srv.BeginUpdateDependencyMapStatus == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdateDependencyMapStatus not implemented")} + } + beginUpdateDependencyMapStatus := v.beginUpdateDependencyMapStatus.get(req) + if beginUpdateDependencyMapStatus == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/vmwareSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updateDependencyMapStatus` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.UpdateMachineDepMapStatus](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := v.srv.BeginUpdateDependencyMapStatus(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdateDependencyMapStatus = &respr + v.beginUpdateDependencyMapStatus.add(req, beginUpdateDependencyMapStatus) + } + + resp, err := server.PollerResponderNext(beginUpdateDependencyMapStatus, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + v.beginUpdateDependencyMapStatus.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdateDependencyMapStatus) { + v.beginUpdateDependencyMapStatus.remove(req) + } + + return resp, nil +} + +func (v *VmwarePropertiesControllerServerTransport) dispatchBeginUpdateProperties(req *http.Request) (*http.Response, error) { + if v.srv.BeginUpdateProperties == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdateProperties not implemented")} + } + beginUpdateProperties := v.beginUpdateProperties.get(req) + if beginUpdateProperties == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/vmwareSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updateProperties` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.MachineMetadataCollection](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := v.srv.BeginUpdateProperties(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdateProperties = &respr + v.beginUpdateProperties.add(req, beginUpdateProperties) + } + + resp, err := server.PollerResponderNext(beginUpdateProperties, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + v.beginUpdateProperties.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdateProperties) { + v.beginUpdateProperties.remove(req) + } + + return resp, nil +} + +func (v *VmwarePropertiesControllerServerTransport) dispatchBeginUpdateRunAsAccount(req *http.Request) (*http.Response, error) { + if v.srv.BeginUpdateRunAsAccount == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdateRunAsAccount not implemented")} + } + beginUpdateRunAsAccount := v.beginUpdateRunAsAccount.get(req) + if beginUpdateRunAsAccount == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/vmwareSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updateRunAsAccount` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.UpdateMachineRunAsAccount](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := v.srv.BeginUpdateRunAsAccount(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdateRunAsAccount = &respr + v.beginUpdateRunAsAccount.add(req, beginUpdateRunAsAccount) + } + + resp, err := server.PollerResponderNext(beginUpdateRunAsAccount, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + v.beginUpdateRunAsAccount.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdateRunAsAccount) { + v.beginUpdateRunAsAccount.remove(req) + } + + return resp, nil +} + +func (v *VmwarePropertiesControllerServerTransport) dispatchBeginUpdateTags(req *http.Request) (*http.Response, error) { + if v.srv.BeginUpdateTags == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdateTags not implemented")} + } + beginUpdateTags := v.beginUpdateTags.get(req) + if beginUpdateTags == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/vmwareSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updateTags` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.UpdateMachineTags](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := v.srv.BeginUpdateTags(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdateTags = &respr + v.beginUpdateTags.add(req, beginUpdateTags) + } + + resp, err := server.PollerResponderNext(beginUpdateTags, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + v.beginUpdateTags.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdateTags) { + v.beginUpdateTags.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/vmwaresoftwareinventoriescontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/vmwaresoftwareinventoriescontroller_server.go new file mode 100644 index 000000000000..6293bb00b134 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/vmwaresoftwareinventoriescontroller_server.go @@ -0,0 +1,170 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" +) + +// VmwareSoftwareInventoriesControllerServer is a fake server for instances of the armmigrate.VmwareSoftwareInventoriesControllerClient type. +type VmwareSoftwareInventoriesControllerServer struct { + // GetMachineSoftwareInventory is the fake for method VmwareSoftwareInventoriesControllerClient.GetMachineSoftwareInventory + // HTTP status codes to indicate success: http.StatusOK + GetMachineSoftwareInventory func(ctx context.Context, resourceGroupName string, siteName string, machineName string, defaultParam armmigrate.Default, options *armmigrate.VmwareSoftwareInventoriesControllerClientGetMachineSoftwareInventoryOptions) (resp azfake.Responder[armmigrate.VmwareSoftwareInventoriesControllerClientGetMachineSoftwareInventoryResponse], errResp azfake.ErrorResponder) + + // NewListByMachineResourcePager is the fake for method VmwareSoftwareInventoriesControllerClient.NewListByMachineResourcePager + // HTTP status codes to indicate success: http.StatusOK + NewListByMachineResourcePager func(resourceGroupName string, siteName string, machineName string, options *armmigrate.VmwareSoftwareInventoriesControllerClientListByMachineResourceOptions) (resp azfake.PagerResponder[armmigrate.VmwareSoftwareInventoriesControllerClientListByMachineResourceResponse]) +} + +// NewVmwareSoftwareInventoriesControllerServerTransport creates a new instance of VmwareSoftwareInventoriesControllerServerTransport with the provided implementation. +// The returned VmwareSoftwareInventoriesControllerServerTransport instance is connected to an instance of armmigrate.VmwareSoftwareInventoriesControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewVmwareSoftwareInventoriesControllerServerTransport(srv *VmwareSoftwareInventoriesControllerServer) *VmwareSoftwareInventoriesControllerServerTransport { + return &VmwareSoftwareInventoriesControllerServerTransport{ + srv: srv, + newListByMachineResourcePager: newTracker[azfake.PagerResponder[armmigrate.VmwareSoftwareInventoriesControllerClientListByMachineResourceResponse]](), + } +} + +// VmwareSoftwareInventoriesControllerServerTransport connects instances of armmigrate.VmwareSoftwareInventoriesControllerClient to instances of VmwareSoftwareInventoriesControllerServer. +// Don't use this type directly, use NewVmwareSoftwareInventoriesControllerServerTransport instead. +type VmwareSoftwareInventoriesControllerServerTransport struct { + srv *VmwareSoftwareInventoriesControllerServer + newListByMachineResourcePager *tracker[azfake.PagerResponder[armmigrate.VmwareSoftwareInventoriesControllerClientListByMachineResourceResponse]] +} + +// Do implements the policy.Transporter interface for VmwareSoftwareInventoriesControllerServerTransport. +func (v *VmwareSoftwareInventoriesControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "VmwareSoftwareInventoriesControllerClient.GetMachineSoftwareInventory": + resp, err = v.dispatchGetMachineSoftwareInventory(req) + case "VmwareSoftwareInventoriesControllerClient.NewListByMachineResourcePager": + resp, err = v.dispatchNewListByMachineResourcePager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (v *VmwareSoftwareInventoriesControllerServerTransport) dispatchGetMachineSoftwareInventory(req *http.Request) (*http.Response, error) { + if v.srv.GetMachineSoftwareInventory == nil { + return nil, &nonRetriableError{errors.New("fake for method GetMachineSoftwareInventory not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/vmwareSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/machines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/softwareInventories/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + machineNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("machineName")]) + if err != nil { + return nil, err + } + defaultParamParam, err := parseWithCast(matches[regex.SubexpIndex("default")], func(v string) (armmigrate.Default, error) { + p, unescapeErr := url.PathUnescape(v) + if unescapeErr != nil { + return "", unescapeErr + } + return armmigrate.Default(p), nil + }) + if err != nil { + return nil, err + } + respr, errRespr := v.srv.GetMachineSoftwareInventory(req.Context(), resourceGroupNameParam, siteNameParam, machineNameParam, defaultParamParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).VmwareMachineSoftwareInventory, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (v *VmwareSoftwareInventoriesControllerServerTransport) dispatchNewListByMachineResourcePager(req *http.Request) (*http.Response, error) { + if v.srv.NewListByMachineResourcePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByMachineResourcePager not implemented")} + } + newListByMachineResourcePager := v.newListByMachineResourcePager.get(req) + if newListByMachineResourcePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/vmwareSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/machines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/softwareinventories` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + machineNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("machineName")]) + if err != nil { + return nil, err + } + resp := v.srv.NewListByMachineResourcePager(resourceGroupNameParam, siteNameParam, machineNameParam, nil) + newListByMachineResourcePager = &resp + v.newListByMachineResourcePager.add(req, newListByMachineResourcePager) + server.PagerResponderInjectNextLinks(newListByMachineResourcePager, req, func(page *armmigrate.VmwareSoftwareInventoriesControllerClientListByMachineResourceResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByMachineResourcePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + v.newListByMachineResourcePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByMachineResourcePager) { + v.newListByMachineResourcePager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/webappdiscoverysitedatasourcescontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/webappdiscoverysitedatasourcescontroller_server.go new file mode 100644 index 000000000000..5de58d3ad6b5 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/webappdiscoverysitedatasourcescontroller_server.go @@ -0,0 +1,288 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" +) + +// WebAppDiscoverySiteDataSourcesControllerServer is a fake server for instances of the armmigrate.WebAppDiscoverySiteDataSourcesControllerClient type. +type WebAppDiscoverySiteDataSourcesControllerServer struct { + // BeginCreate is the fake for method WebAppDiscoverySiteDataSourcesControllerClient.BeginCreate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreate func(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, discoverySiteDataSourceName string, body armmigrate.DiscoverySiteDataSource, options *armmigrate.WebAppDiscoverySiteDataSourcesControllerClientBeginCreateOptions) (resp azfake.PollerResponder[armmigrate.WebAppDiscoverySiteDataSourcesControllerClientCreateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method WebAppDiscoverySiteDataSourcesControllerClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, discoverySiteDataSourceName string, options *armmigrate.WebAppDiscoverySiteDataSourcesControllerClientBeginDeleteOptions) (resp azfake.PollerResponder[armmigrate.WebAppDiscoverySiteDataSourcesControllerClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method WebAppDiscoverySiteDataSourcesControllerClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, discoverySiteDataSourceName string, options *armmigrate.WebAppDiscoverySiteDataSourcesControllerClientGetOptions) (resp azfake.Responder[armmigrate.WebAppDiscoverySiteDataSourcesControllerClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByWebAppSitePager is the fake for method WebAppDiscoverySiteDataSourcesControllerClient.NewListByWebAppSitePager + // HTTP status codes to indicate success: http.StatusOK + NewListByWebAppSitePager func(resourceGroupName string, siteName string, webAppSiteName string, options *armmigrate.WebAppDiscoverySiteDataSourcesControllerClientListByWebAppSiteOptions) (resp azfake.PagerResponder[armmigrate.WebAppDiscoverySiteDataSourcesControllerClientListByWebAppSiteResponse]) +} + +// NewWebAppDiscoverySiteDataSourcesControllerServerTransport creates a new instance of WebAppDiscoverySiteDataSourcesControllerServerTransport with the provided implementation. +// The returned WebAppDiscoverySiteDataSourcesControllerServerTransport instance is connected to an instance of armmigrate.WebAppDiscoverySiteDataSourcesControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewWebAppDiscoverySiteDataSourcesControllerServerTransport(srv *WebAppDiscoverySiteDataSourcesControllerServer) *WebAppDiscoverySiteDataSourcesControllerServerTransport { + return &WebAppDiscoverySiteDataSourcesControllerServerTransport{ + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[armmigrate.WebAppDiscoverySiteDataSourcesControllerClientCreateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armmigrate.WebAppDiscoverySiteDataSourcesControllerClientDeleteResponse]](), + newListByWebAppSitePager: newTracker[azfake.PagerResponder[armmigrate.WebAppDiscoverySiteDataSourcesControllerClientListByWebAppSiteResponse]](), + } +} + +// WebAppDiscoverySiteDataSourcesControllerServerTransport connects instances of armmigrate.WebAppDiscoverySiteDataSourcesControllerClient to instances of WebAppDiscoverySiteDataSourcesControllerServer. +// Don't use this type directly, use NewWebAppDiscoverySiteDataSourcesControllerServerTransport instead. +type WebAppDiscoverySiteDataSourcesControllerServerTransport struct { + srv *WebAppDiscoverySiteDataSourcesControllerServer + beginCreate *tracker[azfake.PollerResponder[armmigrate.WebAppDiscoverySiteDataSourcesControllerClientCreateResponse]] + beginDelete *tracker[azfake.PollerResponder[armmigrate.WebAppDiscoverySiteDataSourcesControllerClientDeleteResponse]] + newListByWebAppSitePager *tracker[azfake.PagerResponder[armmigrate.WebAppDiscoverySiteDataSourcesControllerClientListByWebAppSiteResponse]] +} + +// Do implements the policy.Transporter interface for WebAppDiscoverySiteDataSourcesControllerServerTransport. +func (w *WebAppDiscoverySiteDataSourcesControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "WebAppDiscoverySiteDataSourcesControllerClient.BeginCreate": + resp, err = w.dispatchBeginCreate(req) + case "WebAppDiscoverySiteDataSourcesControllerClient.BeginDelete": + resp, err = w.dispatchBeginDelete(req) + case "WebAppDiscoverySiteDataSourcesControllerClient.Get": + resp, err = w.dispatchGet(req) + case "WebAppDiscoverySiteDataSourcesControllerClient.NewListByWebAppSitePager": + resp, err = w.dispatchNewListByWebAppSitePager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (w *WebAppDiscoverySiteDataSourcesControllerServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { + if w.srv.BeginCreate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} + } + beginCreate := w.beginCreate.get(req) + if beginCreate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/webAppSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/discoverySiteDataSources/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.DiscoverySiteDataSource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + webAppSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("webAppSiteName")]) + if err != nil { + return nil, err + } + discoverySiteDataSourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("discoverySiteDataSourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := w.srv.BeginCreate(req.Context(), resourceGroupNameParam, siteNameParam, webAppSiteNameParam, discoverySiteDataSourceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreate = &respr + w.beginCreate.add(req, beginCreate) + } + + resp, err := server.PollerResponderNext(beginCreate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + w.beginCreate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreate) { + w.beginCreate.remove(req) + } + + return resp, nil +} + +func (w *WebAppDiscoverySiteDataSourcesControllerServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if w.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := w.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/webAppSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/discoverySiteDataSources/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + webAppSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("webAppSiteName")]) + if err != nil { + return nil, err + } + discoverySiteDataSourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("discoverySiteDataSourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := w.srv.BeginDelete(req.Context(), resourceGroupNameParam, siteNameParam, webAppSiteNameParam, discoverySiteDataSourceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + w.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + w.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + w.beginDelete.remove(req) + } + + return resp, nil +} + +func (w *WebAppDiscoverySiteDataSourcesControllerServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if w.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/webAppSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/discoverySiteDataSources/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + webAppSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("webAppSiteName")]) + if err != nil { + return nil, err + } + discoverySiteDataSourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("discoverySiteDataSourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := w.srv.Get(req.Context(), resourceGroupNameParam, siteNameParam, webAppSiteNameParam, discoverySiteDataSourceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DiscoverySiteDataSource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (w *WebAppDiscoverySiteDataSourcesControllerServerTransport) dispatchNewListByWebAppSitePager(req *http.Request) (*http.Response, error) { + if w.srv.NewListByWebAppSitePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByWebAppSitePager not implemented")} + } + newListByWebAppSitePager := w.newListByWebAppSitePager.get(req) + if newListByWebAppSitePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/webAppSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/discoverySiteDataSources` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + webAppSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("webAppSiteName")]) + if err != nil { + return nil, err + } + resp := w.srv.NewListByWebAppSitePager(resourceGroupNameParam, siteNameParam, webAppSiteNameParam, nil) + newListByWebAppSitePager = &resp + w.newListByWebAppSitePager.add(req, newListByWebAppSitePager) + server.PagerResponderInjectNextLinks(newListByWebAppSitePager, req, func(page *armmigrate.WebAppDiscoverySiteDataSourcesControllerClientListByWebAppSiteResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByWebAppSitePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + w.newListByWebAppSitePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByWebAppSitePager) { + w.newListByWebAppSitePager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/webappextendedmachinescontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/webappextendedmachinescontroller_server.go new file mode 100644 index 000000000000..0f1b55edc3a0 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/webappextendedmachinescontroller_server.go @@ -0,0 +1,204 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// WebAppExtendedMachinesControllerServer is a fake server for instances of the armmigrate.WebAppExtendedMachinesControllerClient type. +type WebAppExtendedMachinesControllerServer struct { + // Get is the fake for method WebAppExtendedMachinesControllerClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, extendedMachineName string, options *armmigrate.WebAppExtendedMachinesControllerClientGetOptions) (resp azfake.Responder[armmigrate.WebAppExtendedMachinesControllerClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByWebAppSitePager is the fake for method WebAppExtendedMachinesControllerClient.NewListByWebAppSitePager + // HTTP status codes to indicate success: http.StatusOK + NewListByWebAppSitePager func(resourceGroupName string, siteName string, webAppSiteName string, options *armmigrate.WebAppExtendedMachinesControllerClientListByWebAppSiteOptions) (resp azfake.PagerResponder[armmigrate.WebAppExtendedMachinesControllerClientListByWebAppSiteResponse]) +} + +// NewWebAppExtendedMachinesControllerServerTransport creates a new instance of WebAppExtendedMachinesControllerServerTransport with the provided implementation. +// The returned WebAppExtendedMachinesControllerServerTransport instance is connected to an instance of armmigrate.WebAppExtendedMachinesControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewWebAppExtendedMachinesControllerServerTransport(srv *WebAppExtendedMachinesControllerServer) *WebAppExtendedMachinesControllerServerTransport { + return &WebAppExtendedMachinesControllerServerTransport{ + srv: srv, + newListByWebAppSitePager: newTracker[azfake.PagerResponder[armmigrate.WebAppExtendedMachinesControllerClientListByWebAppSiteResponse]](), + } +} + +// WebAppExtendedMachinesControllerServerTransport connects instances of armmigrate.WebAppExtendedMachinesControllerClient to instances of WebAppExtendedMachinesControllerServer. +// Don't use this type directly, use NewWebAppExtendedMachinesControllerServerTransport instead. +type WebAppExtendedMachinesControllerServerTransport struct { + srv *WebAppExtendedMachinesControllerServer + newListByWebAppSitePager *tracker[azfake.PagerResponder[armmigrate.WebAppExtendedMachinesControllerClientListByWebAppSiteResponse]] +} + +// Do implements the policy.Transporter interface for WebAppExtendedMachinesControllerServerTransport. +func (w *WebAppExtendedMachinesControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "WebAppExtendedMachinesControllerClient.Get": + resp, err = w.dispatchGet(req) + case "WebAppExtendedMachinesControllerClient.NewListByWebAppSitePager": + resp, err = w.dispatchNewListByWebAppSitePager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (w *WebAppExtendedMachinesControllerServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if w.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/webAppSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/extendedMachines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + webAppSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("webAppSiteName")]) + if err != nil { + return nil, err + } + extendedMachineNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("extendedMachineName")]) + if err != nil { + return nil, err + } + respr, errRespr := w.srv.Get(req.Context(), resourceGroupNameParam, siteNameParam, webAppSiteNameParam, extendedMachineNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).WebAppExtendedMachine, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (w *WebAppExtendedMachinesControllerServerTransport) dispatchNewListByWebAppSitePager(req *http.Request) (*http.Response, error) { + if w.srv.NewListByWebAppSitePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByWebAppSitePager not implemented")} + } + newListByWebAppSitePager := w.newListByWebAppSitePager.get(req) + if newListByWebAppSitePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/webAppSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/extendedMachines` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("top")) + if err != nil { + return nil, err + } + topParam := getOptional(topUnescaped) + continuationTokenUnescaped, err := url.QueryUnescape(qp.Get("continuationToken")) + if err != nil { + return nil, err + } + continuationTokenParam := getOptional(continuationTokenUnescaped) + totalRecordCountUnescaped, err := url.QueryUnescape(qp.Get("totalRecordCount")) + if err != nil { + return nil, err + } + totalRecordCountParam, err := parseOptional(totalRecordCountUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + webAppSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("webAppSiteName")]) + if err != nil { + return nil, err + } + var options *armmigrate.WebAppExtendedMachinesControllerClientListByWebAppSiteOptions + if filterParam != nil || topParam != nil || continuationTokenParam != nil || totalRecordCountParam != nil { + options = &armmigrate.WebAppExtendedMachinesControllerClientListByWebAppSiteOptions{ + Filter: filterParam, + Top: topParam, + ContinuationToken: continuationTokenParam, + TotalRecordCount: totalRecordCountParam, + } + } + resp := w.srv.NewListByWebAppSitePager(resourceGroupNameParam, siteNameParam, webAppSiteNameParam, options) + newListByWebAppSitePager = &resp + w.newListByWebAppSitePager.add(req, newListByWebAppSitePager) + server.PagerResponderInjectNextLinks(newListByWebAppSitePager, req, func(page *armmigrate.WebAppExtendedMachinesControllerClientListByWebAppSiteResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByWebAppSitePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + w.newListByWebAppSitePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByWebAppSitePager) { + w.newListByWebAppSitePager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/webapplicationscontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/webapplicationscontroller_server.go new file mode 100644 index 000000000000..7424234e8d99 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/webapplicationscontroller_server.go @@ -0,0 +1,156 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// WebApplicationsControllerServer is a fake server for instances of the armmigrate.WebApplicationsControllerClient type. +type WebApplicationsControllerServer struct { + // NewListByWebAppSitePager is the fake for method WebApplicationsControllerClient.NewListByWebAppSitePager + // HTTP status codes to indicate success: http.StatusOK + NewListByWebAppSitePager func(resourceGroupName string, siteName string, webAppSiteName string, options *armmigrate.WebApplicationsControllerClientListByWebAppSiteOptions) (resp azfake.PagerResponder[armmigrate.WebApplicationsControllerClientListByWebAppSiteResponse]) +} + +// NewWebApplicationsControllerServerTransport creates a new instance of WebApplicationsControllerServerTransport with the provided implementation. +// The returned WebApplicationsControllerServerTransport instance is connected to an instance of armmigrate.WebApplicationsControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewWebApplicationsControllerServerTransport(srv *WebApplicationsControllerServer) *WebApplicationsControllerServerTransport { + return &WebApplicationsControllerServerTransport{ + srv: srv, + newListByWebAppSitePager: newTracker[azfake.PagerResponder[armmigrate.WebApplicationsControllerClientListByWebAppSiteResponse]](), + } +} + +// WebApplicationsControllerServerTransport connects instances of armmigrate.WebApplicationsControllerClient to instances of WebApplicationsControllerServer. +// Don't use this type directly, use NewWebApplicationsControllerServerTransport instead. +type WebApplicationsControllerServerTransport struct { + srv *WebApplicationsControllerServer + newListByWebAppSitePager *tracker[azfake.PagerResponder[armmigrate.WebApplicationsControllerClientListByWebAppSiteResponse]] +} + +// Do implements the policy.Transporter interface for WebApplicationsControllerServerTransport. +func (w *WebApplicationsControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "WebApplicationsControllerClient.NewListByWebAppSitePager": + resp, err = w.dispatchNewListByWebAppSitePager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (w *WebApplicationsControllerServerTransport) dispatchNewListByWebAppSitePager(req *http.Request) (*http.Response, error) { + if w.srv.NewListByWebAppSitePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByWebAppSitePager not implemented")} + } + newListByWebAppSitePager := w.newListByWebAppSitePager.get(req) + if newListByWebAppSitePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/webAppSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/webApplications` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("top")) + if err != nil { + return nil, err + } + topParam := getOptional(topUnescaped) + continuationTokenUnescaped, err := url.QueryUnescape(qp.Get("continuationToken")) + if err != nil { + return nil, err + } + continuationTokenParam := getOptional(continuationTokenUnescaped) + totalRecordCountUnescaped, err := url.QueryUnescape(qp.Get("totalRecordCount")) + if err != nil { + return nil, err + } + totalRecordCountParam, err := parseOptional(totalRecordCountUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + webAppSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("webAppSiteName")]) + if err != nil { + return nil, err + } + var options *armmigrate.WebApplicationsControllerClientListByWebAppSiteOptions + if filterParam != nil || topParam != nil || continuationTokenParam != nil || totalRecordCountParam != nil { + options = &armmigrate.WebApplicationsControllerClientListByWebAppSiteOptions{ + Filter: filterParam, + Top: topParam, + ContinuationToken: continuationTokenParam, + TotalRecordCount: totalRecordCountParam, + } + } + resp := w.srv.NewListByWebAppSitePager(resourceGroupNameParam, siteNameParam, webAppSiteNameParam, options) + newListByWebAppSitePager = &resp + w.newListByWebAppSitePager.add(req, newListByWebAppSitePager) + server.PagerResponderInjectNextLinks(newListByWebAppSitePager, req, func(page *armmigrate.WebApplicationsControllerClientListByWebAppSiteResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByWebAppSitePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + w.newListByWebAppSitePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByWebAppSitePager) { + w.newListByWebAppSitePager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/webapppropertiescontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/webapppropertiescontroller_server.go new file mode 100644 index 000000000000..06faf121da1e --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/webapppropertiescontroller_server.go @@ -0,0 +1,123 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" +) + +// WebAppPropertiesControllerServer is a fake server for instances of the armmigrate.WebAppPropertiesControllerClient type. +type WebAppPropertiesControllerServer struct { + // BeginUpdateProperties is the fake for method WebAppPropertiesControllerClient.BeginUpdateProperties + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdateProperties func(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, body armmigrate.WebAppPropertiesCollection, options *armmigrate.WebAppPropertiesControllerClientBeginUpdatePropertiesOptions) (resp azfake.PollerResponder[armmigrate.WebAppPropertiesControllerClientUpdatePropertiesResponse], errResp azfake.ErrorResponder) +} + +// NewWebAppPropertiesControllerServerTransport creates a new instance of WebAppPropertiesControllerServerTransport with the provided implementation. +// The returned WebAppPropertiesControllerServerTransport instance is connected to an instance of armmigrate.WebAppPropertiesControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewWebAppPropertiesControllerServerTransport(srv *WebAppPropertiesControllerServer) *WebAppPropertiesControllerServerTransport { + return &WebAppPropertiesControllerServerTransport{ + srv: srv, + beginUpdateProperties: newTracker[azfake.PollerResponder[armmigrate.WebAppPropertiesControllerClientUpdatePropertiesResponse]](), + } +} + +// WebAppPropertiesControllerServerTransport connects instances of armmigrate.WebAppPropertiesControllerClient to instances of WebAppPropertiesControllerServer. +// Don't use this type directly, use NewWebAppPropertiesControllerServerTransport instead. +type WebAppPropertiesControllerServerTransport struct { + srv *WebAppPropertiesControllerServer + beginUpdateProperties *tracker[azfake.PollerResponder[armmigrate.WebAppPropertiesControllerClientUpdatePropertiesResponse]] +} + +// Do implements the policy.Transporter interface for WebAppPropertiesControllerServerTransport. +func (w *WebAppPropertiesControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "WebAppPropertiesControllerClient.BeginUpdateProperties": + resp, err = w.dispatchBeginUpdateProperties(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (w *WebAppPropertiesControllerServerTransport) dispatchBeginUpdateProperties(req *http.Request) (*http.Response, error) { + if w.srv.BeginUpdateProperties == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdateProperties not implemented")} + } + beginUpdateProperties := w.beginUpdateProperties.get(req) + if beginUpdateProperties == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/webAppSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updateProperties` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.WebAppPropertiesCollection](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + webAppSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("webAppSiteName")]) + if err != nil { + return nil, err + } + respr, errRespr := w.srv.BeginUpdateProperties(req.Context(), resourceGroupNameParam, siteNameParam, webAppSiteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdateProperties = &respr + w.beginUpdateProperties.add(req, beginUpdateProperties) + } + + resp, err := server.PollerResponderNext(beginUpdateProperties, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + w.beginUpdateProperties.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdateProperties) { + w.beginUpdateProperties.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/webapprunasaccountscontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/webapprunasaccountscontroller_server.go new file mode 100644 index 000000000000..86b620b54d11 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/webapprunasaccountscontroller_server.go @@ -0,0 +1,164 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" +) + +// WebAppRunAsAccountsControllerServer is a fake server for instances of the armmigrate.WebAppRunAsAccountsControllerClient type. +type WebAppRunAsAccountsControllerServer struct { + // Get is the fake for method WebAppRunAsAccountsControllerClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, accountName string, options *armmigrate.WebAppRunAsAccountsControllerClientGetOptions) (resp azfake.Responder[armmigrate.WebAppRunAsAccountsControllerClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByWebAppSitePager is the fake for method WebAppRunAsAccountsControllerClient.NewListByWebAppSitePager + // HTTP status codes to indicate success: http.StatusOK + NewListByWebAppSitePager func(resourceGroupName string, siteName string, webAppSiteName string, options *armmigrate.WebAppRunAsAccountsControllerClientListByWebAppSiteOptions) (resp azfake.PagerResponder[armmigrate.WebAppRunAsAccountsControllerClientListByWebAppSiteResponse]) +} + +// NewWebAppRunAsAccountsControllerServerTransport creates a new instance of WebAppRunAsAccountsControllerServerTransport with the provided implementation. +// The returned WebAppRunAsAccountsControllerServerTransport instance is connected to an instance of armmigrate.WebAppRunAsAccountsControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewWebAppRunAsAccountsControllerServerTransport(srv *WebAppRunAsAccountsControllerServer) *WebAppRunAsAccountsControllerServerTransport { + return &WebAppRunAsAccountsControllerServerTransport{ + srv: srv, + newListByWebAppSitePager: newTracker[azfake.PagerResponder[armmigrate.WebAppRunAsAccountsControllerClientListByWebAppSiteResponse]](), + } +} + +// WebAppRunAsAccountsControllerServerTransport connects instances of armmigrate.WebAppRunAsAccountsControllerClient to instances of WebAppRunAsAccountsControllerServer. +// Don't use this type directly, use NewWebAppRunAsAccountsControllerServerTransport instead. +type WebAppRunAsAccountsControllerServerTransport struct { + srv *WebAppRunAsAccountsControllerServer + newListByWebAppSitePager *tracker[azfake.PagerResponder[armmigrate.WebAppRunAsAccountsControllerClientListByWebAppSiteResponse]] +} + +// Do implements the policy.Transporter interface for WebAppRunAsAccountsControllerServerTransport. +func (w *WebAppRunAsAccountsControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "WebAppRunAsAccountsControllerClient.Get": + resp, err = w.dispatchGet(req) + case "WebAppRunAsAccountsControllerClient.NewListByWebAppSitePager": + resp, err = w.dispatchNewListByWebAppSitePager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (w *WebAppRunAsAccountsControllerServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if w.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/webAppSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/runasaccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + webAppSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("webAppSiteName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + respr, errRespr := w.srv.Get(req.Context(), resourceGroupNameParam, siteNameParam, webAppSiteNameParam, accountNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).WebAppRunAsAccount, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (w *WebAppRunAsAccountsControllerServerTransport) dispatchNewListByWebAppSitePager(req *http.Request) (*http.Response, error) { + if w.srv.NewListByWebAppSitePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByWebAppSitePager not implemented")} + } + newListByWebAppSitePager := w.newListByWebAppSitePager.get(req) + if newListByWebAppSitePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/webAppSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/runasaccounts` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + webAppSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("webAppSiteName")]) + if err != nil { + return nil, err + } + resp := w.srv.NewListByWebAppSitePager(resourceGroupNameParam, siteNameParam, webAppSiteNameParam, nil) + newListByWebAppSitePager = &resp + w.newListByWebAppSitePager.add(req, newListByWebAppSitePager) + server.PagerResponderInjectNextLinks(newListByWebAppSitePager, req, func(page *armmigrate.WebAppRunAsAccountsControllerClientListByWebAppSiteResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByWebAppSitePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + w.newListByWebAppSitePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByWebAppSitePager) { + w.newListByWebAppSitePager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/webappsitescontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/webappsitescontroller_server.go new file mode 100644 index 000000000000..d28a5a25c0c5 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/webappsitescontroller_server.go @@ -0,0 +1,533 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// WebAppSitesControllerServer is a fake server for instances of the armmigrate.WebAppSitesControllerClient type. +type WebAppSitesControllerServer struct { + // Create is the fake for method WebAppSitesControllerClient.Create + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + Create func(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, body armmigrate.WebAppSite, options *armmigrate.WebAppSitesControllerClientCreateOptions) (resp azfake.Responder[armmigrate.WebAppSitesControllerClientCreateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method WebAppSitesControllerClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, options *armmigrate.WebAppSitesControllerClientBeginDeleteOptions) (resp azfake.PollerResponder[armmigrate.WebAppSitesControllerClientDeleteResponse], errResp azfake.ErrorResponder) + + // ErrorSummary is the fake for method WebAppSitesControllerClient.ErrorSummary + // HTTP status codes to indicate success: http.StatusOK + ErrorSummary func(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, body armmigrate.ErrorSummaryRequest, options *armmigrate.WebAppSitesControllerClientErrorSummaryOptions) (resp azfake.Responder[armmigrate.WebAppSitesControllerClientErrorSummaryResponse], errResp azfake.ErrorResponder) + + // BeginExportInventory is the fake for method WebAppSitesControllerClient.BeginExportInventory + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginExportInventory func(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, body armmigrate.ExportWebAppsRequest, options *armmigrate.WebAppSitesControllerClientBeginExportInventoryOptions) (resp azfake.PollerResponder[armmigrate.WebAppSitesControllerClientExportInventoryResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method WebAppSitesControllerClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, options *armmigrate.WebAppSitesControllerClientGetOptions) (resp azfake.Responder[armmigrate.WebAppSitesControllerClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByMasterSitePager is the fake for method WebAppSitesControllerClient.NewListByMasterSitePager + // HTTP status codes to indicate success: http.StatusOK + NewListByMasterSitePager func(resourceGroupName string, siteName string, options *armmigrate.WebAppSitesControllerClientListByMasterSiteOptions) (resp azfake.PagerResponder[armmigrate.WebAppSitesControllerClientListByMasterSiteResponse]) + + // BeginRefresh is the fake for method WebAppSitesControllerClient.BeginRefresh + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginRefresh func(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, body armmigrate.ProxySiteRefreshBody, options *armmigrate.WebAppSitesControllerClientBeginRefreshOptions) (resp azfake.PollerResponder[armmigrate.WebAppSitesControllerClientRefreshResponse], errResp azfake.ErrorResponder) + + // Summary is the fake for method WebAppSitesControllerClient.Summary + // HTTP status codes to indicate success: http.StatusOK + Summary func(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, options *armmigrate.WebAppSitesControllerClientSummaryOptions) (resp azfake.Responder[armmigrate.WebAppSitesControllerClientSummaryResponse], errResp azfake.ErrorResponder) + + // BeginUpdate is the fake for method WebAppSitesControllerClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, properties armmigrate.WebAppSiteUpdate, options *armmigrate.WebAppSitesControllerClientBeginUpdateOptions) (resp azfake.PollerResponder[armmigrate.WebAppSitesControllerClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewWebAppSitesControllerServerTransport creates a new instance of WebAppSitesControllerServerTransport with the provided implementation. +// The returned WebAppSitesControllerServerTransport instance is connected to an instance of armmigrate.WebAppSitesControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewWebAppSitesControllerServerTransport(srv *WebAppSitesControllerServer) *WebAppSitesControllerServerTransport { + return &WebAppSitesControllerServerTransport{ + srv: srv, + beginDelete: newTracker[azfake.PollerResponder[armmigrate.WebAppSitesControllerClientDeleteResponse]](), + beginExportInventory: newTracker[azfake.PollerResponder[armmigrate.WebAppSitesControllerClientExportInventoryResponse]](), + newListByMasterSitePager: newTracker[azfake.PagerResponder[armmigrate.WebAppSitesControllerClientListByMasterSiteResponse]](), + beginRefresh: newTracker[azfake.PollerResponder[armmigrate.WebAppSitesControllerClientRefreshResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armmigrate.WebAppSitesControllerClientUpdateResponse]](), + } +} + +// WebAppSitesControllerServerTransport connects instances of armmigrate.WebAppSitesControllerClient to instances of WebAppSitesControllerServer. +// Don't use this type directly, use NewWebAppSitesControllerServerTransport instead. +type WebAppSitesControllerServerTransport struct { + srv *WebAppSitesControllerServer + beginDelete *tracker[azfake.PollerResponder[armmigrate.WebAppSitesControllerClientDeleteResponse]] + beginExportInventory *tracker[azfake.PollerResponder[armmigrate.WebAppSitesControllerClientExportInventoryResponse]] + newListByMasterSitePager *tracker[azfake.PagerResponder[armmigrate.WebAppSitesControllerClientListByMasterSiteResponse]] + beginRefresh *tracker[azfake.PollerResponder[armmigrate.WebAppSitesControllerClientRefreshResponse]] + beginUpdate *tracker[azfake.PollerResponder[armmigrate.WebAppSitesControllerClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for WebAppSitesControllerServerTransport. +func (w *WebAppSitesControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "WebAppSitesControllerClient.Create": + resp, err = w.dispatchCreate(req) + case "WebAppSitesControllerClient.BeginDelete": + resp, err = w.dispatchBeginDelete(req) + case "WebAppSitesControllerClient.ErrorSummary": + resp, err = w.dispatchErrorSummary(req) + case "WebAppSitesControllerClient.BeginExportInventory": + resp, err = w.dispatchBeginExportInventory(req) + case "WebAppSitesControllerClient.Get": + resp, err = w.dispatchGet(req) + case "WebAppSitesControllerClient.NewListByMasterSitePager": + resp, err = w.dispatchNewListByMasterSitePager(req) + case "WebAppSitesControllerClient.BeginRefresh": + resp, err = w.dispatchBeginRefresh(req) + case "WebAppSitesControllerClient.Summary": + resp, err = w.dispatchSummary(req) + case "WebAppSitesControllerClient.BeginUpdate": + resp, err = w.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (w *WebAppSitesControllerServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { + if w.srv.Create == nil { + return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/webAppSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.WebAppSite](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + webAppSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("webAppSiteName")]) + if err != nil { + return nil, err + } + respr, errRespr := w.srv.Create(req.Context(), resourceGroupNameParam, siteNameParam, webAppSiteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).WebAppSite, req) + if err != nil { + return nil, err + } + if val := server.GetResponse(respr).RetryAfter; val != nil { + resp.Header.Set("Retry-After", strconv.FormatInt(int64(*val), 10)) + } + return resp, nil +} + +func (w *WebAppSitesControllerServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if w.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := w.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/webAppSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + webAppSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("webAppSiteName")]) + if err != nil { + return nil, err + } + respr, errRespr := w.srv.BeginDelete(req.Context(), resourceGroupNameParam, siteNameParam, webAppSiteNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + w.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + w.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + w.beginDelete.remove(req) + } + + return resp, nil +} + +func (w *WebAppSitesControllerServerTransport) dispatchErrorSummary(req *http.Request) (*http.Response, error) { + if w.srv.ErrorSummary == nil { + return nil, &nonRetriableError{errors.New("fake for method ErrorSummary not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/webAppSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/errorSummary` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.ErrorSummaryRequest](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + webAppSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("webAppSiteName")]) + if err != nil { + return nil, err + } + respr, errRespr := w.srv.ErrorSummary(req.Context(), resourceGroupNameParam, siteNameParam, webAppSiteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SiteErrorSummary, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (w *WebAppSitesControllerServerTransport) dispatchBeginExportInventory(req *http.Request) (*http.Response, error) { + if w.srv.BeginExportInventory == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginExportInventory not implemented")} + } + beginExportInventory := w.beginExportInventory.get(req) + if beginExportInventory == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/webAppSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/exportInventory` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.ExportWebAppsRequest](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + webAppSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("webAppSiteName")]) + if err != nil { + return nil, err + } + respr, errRespr := w.srv.BeginExportInventory(req.Context(), resourceGroupNameParam, siteNameParam, webAppSiteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginExportInventory = &respr + w.beginExportInventory.add(req, beginExportInventory) + } + + resp, err := server.PollerResponderNext(beginExportInventory, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + w.beginExportInventory.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginExportInventory) { + w.beginExportInventory.remove(req) + } + + return resp, nil +} + +func (w *WebAppSitesControllerServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if w.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/webAppSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + webAppSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("webAppSiteName")]) + if err != nil { + return nil, err + } + respr, errRespr := w.srv.Get(req.Context(), resourceGroupNameParam, siteNameParam, webAppSiteNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).WebAppSite, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (w *WebAppSitesControllerServerTransport) dispatchNewListByMasterSitePager(req *http.Request) (*http.Response, error) { + if w.srv.NewListByMasterSitePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByMasterSitePager not implemented")} + } + newListByMasterSitePager := w.newListByMasterSitePager.get(req) + if newListByMasterSitePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/webAppSites` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + resp := w.srv.NewListByMasterSitePager(resourceGroupNameParam, siteNameParam, nil) + newListByMasterSitePager = &resp + w.newListByMasterSitePager.add(req, newListByMasterSitePager) + server.PagerResponderInjectNextLinks(newListByMasterSitePager, req, func(page *armmigrate.WebAppSitesControllerClientListByMasterSiteResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByMasterSitePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + w.newListByMasterSitePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByMasterSitePager) { + w.newListByMasterSitePager.remove(req) + } + return resp, nil +} + +func (w *WebAppSitesControllerServerTransport) dispatchBeginRefresh(req *http.Request) (*http.Response, error) { + if w.srv.BeginRefresh == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginRefresh not implemented")} + } + beginRefresh := w.beginRefresh.get(req) + if beginRefresh == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/webAppSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/refresh` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.ProxySiteRefreshBody](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + webAppSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("webAppSiteName")]) + if err != nil { + return nil, err + } + respr, errRespr := w.srv.BeginRefresh(req.Context(), resourceGroupNameParam, siteNameParam, webAppSiteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginRefresh = &respr + w.beginRefresh.add(req, beginRefresh) + } + + resp, err := server.PollerResponderNext(beginRefresh, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + w.beginRefresh.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginRefresh) { + w.beginRefresh.remove(req) + } + + return resp, nil +} + +func (w *WebAppSitesControllerServerTransport) dispatchSummary(req *http.Request) (*http.Response, error) { + if w.srv.Summary == nil { + return nil, &nonRetriableError{errors.New("fake for method Summary not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/webAppSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/summary` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + webAppSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("webAppSiteName")]) + if err != nil { + return nil, err + } + respr, errRespr := w.srv.Summary(req.Context(), resourceGroupNameParam, siteNameParam, webAppSiteNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).WebAppSiteUsage, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (w *WebAppSitesControllerServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if w.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := w.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/webAppSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmigrate.WebAppSiteUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + webAppSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("webAppSiteName")]) + if err != nil { + return nil, err + } + respr, errRespr := w.srv.BeginUpdate(req.Context(), resourceGroupNameParam, siteNameParam, webAppSiteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + w.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + w.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + w.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/fake/webserverscontroller_server.go b/sdk/resourcemanager/migrate/armmigrate/fake/webserverscontroller_server.go new file mode 100644 index 000000000000..80dd18486274 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/fake/webserverscontroller_server.go @@ -0,0 +1,156 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// WebServersControllerServer is a fake server for instances of the armmigrate.WebServersControllerClient type. +type WebServersControllerServer struct { + // NewListByWebAppSitePager is the fake for method WebServersControllerClient.NewListByWebAppSitePager + // HTTP status codes to indicate success: http.StatusOK + NewListByWebAppSitePager func(resourceGroupName string, siteName string, webAppSiteName string, options *armmigrate.WebServersControllerClientListByWebAppSiteOptions) (resp azfake.PagerResponder[armmigrate.WebServersControllerClientListByWebAppSiteResponse]) +} + +// NewWebServersControllerServerTransport creates a new instance of WebServersControllerServerTransport with the provided implementation. +// The returned WebServersControllerServerTransport instance is connected to an instance of armmigrate.WebServersControllerClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewWebServersControllerServerTransport(srv *WebServersControllerServer) *WebServersControllerServerTransport { + return &WebServersControllerServerTransport{ + srv: srv, + newListByWebAppSitePager: newTracker[azfake.PagerResponder[armmigrate.WebServersControllerClientListByWebAppSiteResponse]](), + } +} + +// WebServersControllerServerTransport connects instances of armmigrate.WebServersControllerClient to instances of WebServersControllerServer. +// Don't use this type directly, use NewWebServersControllerServerTransport instead. +type WebServersControllerServerTransport struct { + srv *WebServersControllerServer + newListByWebAppSitePager *tracker[azfake.PagerResponder[armmigrate.WebServersControllerClientListByWebAppSiteResponse]] +} + +// Do implements the policy.Transporter interface for WebServersControllerServerTransport. +func (w *WebServersControllerServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "WebServersControllerClient.NewListByWebAppSitePager": + resp, err = w.dispatchNewListByWebAppSitePager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (w *WebServersControllerServerTransport) dispatchNewListByWebAppSitePager(req *http.Request) (*http.Response, error) { + if w.srv.NewListByWebAppSitePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByWebAppSitePager not implemented")} + } + newListByWebAppSitePager := w.newListByWebAppSitePager.get(req) + if newListByWebAppSitePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OffAzure/masterSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/webAppSites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/webServers` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("top")) + if err != nil { + return nil, err + } + topParam := getOptional(topUnescaped) + continuationTokenUnescaped, err := url.QueryUnescape(qp.Get("continuationToken")) + if err != nil { + return nil, err + } + continuationTokenParam := getOptional(continuationTokenUnescaped) + totalRecordCountUnescaped, err := url.QueryUnescape(qp.Get("totalRecordCount")) + if err != nil { + return nil, err + } + totalRecordCountParam, err := parseOptional(totalRecordCountUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + webAppSiteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("webAppSiteName")]) + if err != nil { + return nil, err + } + var options *armmigrate.WebServersControllerClientListByWebAppSiteOptions + if filterParam != nil || topParam != nil || continuationTokenParam != nil || totalRecordCountParam != nil { + options = &armmigrate.WebServersControllerClientListByWebAppSiteOptions{ + Filter: filterParam, + Top: topParam, + ContinuationToken: continuationTokenParam, + TotalRecordCount: totalRecordCountParam, + } + } + resp := w.srv.NewListByWebAppSitePager(resourceGroupNameParam, siteNameParam, webAppSiteNameParam, options) + newListByWebAppSitePager = &resp + w.newListByWebAppSitePager.add(req, newListByWebAppSitePager) + server.PagerResponderInjectNextLinks(newListByWebAppSitePager, req, func(page *armmigrate.WebServersControllerClientListByWebAppSiteResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByWebAppSitePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + w.newListByWebAppSitePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByWebAppSitePager) { + w.newListByWebAppSitePager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/go.mod b/sdk/resourcemanager/migrate/armmigrate/go.mod index 215b22b5ab82..bef70942782a 100644 --- a/sdk/resourcemanager/migrate/armmigrate/go.mod +++ b/sdk/resourcemanager/migrate/armmigrate/go.mod @@ -1,21 +1,11 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate/v2 go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1 // indirect - github.com/golang-jwt/jwt/v5 v5.0.0 // indirect - github.com/google/uuid v1.3.1 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect - golang.org/x/crypto v0.14.0 // indirect golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect ) diff --git a/sdk/resourcemanager/migrate/armmigrate/go.sum b/sdk/resourcemanager/migrate/armmigrate/go.sum index 7985f1da436f..428cd71de305 100644 --- a/sdk/resourcemanager/migrate/armmigrate/go.sum +++ b/sdk/resourcemanager/migrate/armmigrate/go.sum @@ -1,31 +1,12 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0 h1:fb8kj/Dh4CSwgsOzHeZY4Xh68cFVbzXx+ONXGMY//4w= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0/go.mod h1:uReU2sSxZExRPBAg3qKzmAucSi51+SP1OhohieR821Q= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 h1:BMAjVKJM0U/CYF27gA0ZMmXGkOcvfFtD0oHVZ1TIPRI= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0/go.mod h1:1fXstnBMas5kzG+S3q8UoJcmyU6nUeunJcMDHcRYHhs= github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0 h1:d81/ng9rET2YqdVkVwkb6EXeRrLJIwyGnJcAlAWKwhs= github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0/go.mod h1:s4kgfzA0covAXNicZHDMN58jExvcng2mC/DepXiF1EI= -github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1 h1:WpB/QDNLpMw72xHJc34BNNykqSOeEJDAWkhf0u12/Jk= -github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI= -github.com/golang-jwt/jwt/v5 v5.0.0 h1:1n1XNM9hk7O9mnQoNBGolZvzebBQ7p93ULHRc28XJUE= -github.com/golang-jwt/jwt/v5 v5.0.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= -github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= -github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= -golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/migrate/armmigrate/groups_client.go b/sdk/resourcemanager/migrate/armmigrate/groups_client.go deleted file mode 100644 index e4a940a6f6d6..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/groups_client.go +++ /dev/null @@ -1,416 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmigrate - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// GroupsClient contains the methods for the Groups group. -// Don't use this type directly, use NewGroupsClient() instead. -type GroupsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewGroupsClient creates a new instance of GroupsClient with the specified values. -// - subscriptionID - Azure Subscription Id in which project was created. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GroupsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &GroupsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Create - Create a new group by sending a json object of type 'group' as given in Models section as part of the Request -// Body. The group name in a project is unique. -// This operation is Idempotent. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - groupName - Unique name of a group within a project. -// - options - GroupsClientCreateOptions contains the optional parameters for the GroupsClient.Create method. -func (client *GroupsClient) Create(ctx context.Context, resourceGroupName string, projectName string, groupName string, options *GroupsClientCreateOptions) (GroupsClientCreateResponse, error) { - var err error - const operationName = "GroupsClient.Create" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createCreateRequest(ctx, resourceGroupName, projectName, groupName, options) - if err != nil { - return GroupsClientCreateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return GroupsClientCreateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return GroupsClientCreateResponse{}, err - } - resp, err := client.createHandleResponse(httpResp) - return resp, err -} - -// createCreateRequest creates the Create request. -func (client *GroupsClient) createCreateRequest(ctx context.Context, resourceGroupName string, projectName string, groupName string, options *GroupsClientCreateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if groupName == "" { - return nil, errors.New("parameter groupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.Group != nil { - if err := runtime.MarshalAsJSON(req, *options.Group); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// createHandleResponse handles the Create response. -func (client *GroupsClient) createHandleResponse(resp *http.Response) (GroupsClientCreateResponse, error) { - result := GroupsClientCreateResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.Group); err != nil { - return GroupsClientCreateResponse{}, err - } - return result, nil -} - -// Delete - Delete the group from the project. The machines remain in the project. Deleting a non-existent group results in -// a no-operation. -// A group is an aggregation mechanism for machines in a project. Therefore, deleting group does not delete machines in it. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - groupName - Unique name of a group within a project. -// - options - GroupsClientDeleteOptions contains the optional parameters for the GroupsClient.Delete method. -func (client *GroupsClient) Delete(ctx context.Context, resourceGroupName string, projectName string, groupName string, options *GroupsClientDeleteOptions) (GroupsClientDeleteResponse, error) { - var err error - const operationName = "GroupsClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, projectName, groupName, options) - if err != nil { - return GroupsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return GroupsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return GroupsClientDeleteResponse{}, err - } - resp, err := client.deleteHandleResponse(httpResp) - return resp, err -} - -// deleteCreateRequest creates the Delete request. -func (client *GroupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, projectName string, groupName string, options *GroupsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if groupName == "" { - return nil, errors.New("parameter groupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// deleteHandleResponse handles the Delete response. -func (client *GroupsClient) deleteHandleResponse(resp *http.Response) (GroupsClientDeleteResponse, error) { - result := GroupsClientDeleteResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - return result, nil -} - -// Get - Get information related to a specific group in the project. Returns a json object of type 'group' as specified in -// the models section. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - groupName - Unique name of a group within a project. -// - options - GroupsClientGetOptions contains the optional parameters for the GroupsClient.Get method. -func (client *GroupsClient) Get(ctx context.Context, resourceGroupName string, projectName string, groupName string, options *GroupsClientGetOptions) (GroupsClientGetResponse, error) { - var err error - const operationName = "GroupsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, groupName, options) - if err != nil { - return GroupsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return GroupsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return GroupsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *GroupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, projectName string, groupName string, options *GroupsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if groupName == "" { - return nil, errors.New("parameter groupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *GroupsClient) getHandleResponse(resp *http.Response) (GroupsClientGetResponse, error) { - result := GroupsClientGetResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.Group); err != nil { - return GroupsClientGetResponse{}, err - } - return result, nil -} - -// NewListByProjectPager - Get all groups created in the project. Returns a json array of objects of type 'group' as specified -// in the Models section. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - options - GroupsClientListByProjectOptions contains the optional parameters for the GroupsClient.NewListByProjectPager -// method. -func (client *GroupsClient) NewListByProjectPager(resourceGroupName string, projectName string, options *GroupsClientListByProjectOptions) *runtime.Pager[GroupsClientListByProjectResponse] { - return runtime.NewPager(runtime.PagingHandler[GroupsClientListByProjectResponse]{ - More: func(page GroupsClientListByProjectResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *GroupsClientListByProjectResponse) (GroupsClientListByProjectResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "GroupsClient.NewListByProjectPager") - req, err := client.listByProjectCreateRequest(ctx, resourceGroupName, projectName, options) - if err != nil { - return GroupsClientListByProjectResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return GroupsClientListByProjectResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return GroupsClientListByProjectResponse{}, runtime.NewResponseError(resp) - } - return client.listByProjectHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByProjectCreateRequest creates the ListByProject request. -func (client *GroupsClient) listByProjectCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *GroupsClientListByProjectOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByProjectHandleResponse handles the ListByProject response. -func (client *GroupsClient) listByProjectHandleResponse(resp *http.Response) (GroupsClientListByProjectResponse, error) { - result := GroupsClientListByProjectResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.GroupResultList); err != nil { - return GroupsClientListByProjectResponse{}, err - } - return result, nil -} - -// UpdateMachines - Update machines in group by adding or removing machines. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - groupName - Unique name of a group within a project. -// - options - GroupsClientUpdateMachinesOptions contains the optional parameters for the GroupsClient.UpdateMachines method. -func (client *GroupsClient) UpdateMachines(ctx context.Context, resourceGroupName string, projectName string, groupName string, options *GroupsClientUpdateMachinesOptions) (GroupsClientUpdateMachinesResponse, error) { - var err error - const operationName = "GroupsClient.UpdateMachines" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateMachinesCreateRequest(ctx, resourceGroupName, projectName, groupName, options) - if err != nil { - return GroupsClientUpdateMachinesResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return GroupsClientUpdateMachinesResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return GroupsClientUpdateMachinesResponse{}, err - } - resp, err := client.updateMachinesHandleResponse(httpResp) - return resp, err -} - -// updateMachinesCreateRequest creates the UpdateMachines request. -func (client *GroupsClient) updateMachinesCreateRequest(ctx context.Context, resourceGroupName string, projectName string, groupName string, options *GroupsClientUpdateMachinesOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/updateMachines" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if groupName == "" { - return nil, errors.New("parameter groupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.GroupUpdateProperties != nil { - if err := runtime.MarshalAsJSON(req, *options.GroupUpdateProperties); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// updateMachinesHandleResponse handles the UpdateMachines response. -func (client *GroupsClient) updateMachinesHandleResponse(resp *http.Response) (GroupsClientUpdateMachinesResponse, error) { - result := GroupsClientUpdateMachinesResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.Group); err != nil { - return GroupsClientUpdateMachinesResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/groups_client_example_test.go b/sdk/resourcemanager/migrate/armmigrate/groups_client_example_test.go deleted file mode 100644 index a6e0775e1793..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/groups_client_example_test.go +++ /dev/null @@ -1,204 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmigrate_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Groups_ListByProject.json -func ExampleGroupsClient_NewListByProjectPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGroupsClient().NewListByProjectPager("abgoyal-westEurope", "abgoyalWEselfhostb72bproject", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.GroupResultList = armmigrate.GroupResultList{ - // Value: []*armmigrate.Group{ - // { - // Name: to.Ptr("Test1"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/groups"), - // ETag: to.Ptr("\"21009c31-0000-0d00-0000-5cd585ad0000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/Test1"), - // Properties: &armmigrate.GroupProperties{ - // AreAssessmentsRunning: to.Ptr(false), - // Assessments: []*string{ - // to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/Test1/assessments/assessment_5_9_2019_16_22_14")}, - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:52:07.736Z"); return t}()), - // GroupStatus: to.Ptr(armmigrate.GroupStatusCompleted), - // MachineCount: to.Ptr[int32](26), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-10T14:07:41.752Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("Group2"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/groups"), - // ETag: to.Ptr("\"1e000c2c-0000-0d00-0000-5cdaa4190000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/Group2"), - // Properties: &armmigrate.GroupProperties{ - // AreAssessmentsRunning: to.Ptr(false), - // Assessments: []*string{ - // to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/Group2/assessments/assessment_5_9_2019_17_0_56"), - // to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/Group2/assessments/assessment_5_14_2019_16_48_47")}, - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:52:56.157Z"); return t}()), - // GroupStatus: to.Ptr(armmigrate.GroupStatusCompleted), - // MachineCount: to.Ptr[int32](5), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-14T11:18:49.548Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Groups_Get.json -func ExampleGroupsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGroupsClient().Get(ctx, "abgoyal-westEurope", "abgoyalWEselfhostb72bproject", "Test1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Group = armmigrate.Group{ - // Name: to.Ptr("Test1"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/groups"), - // ETag: to.Ptr("\"21009c31-0000-0d00-0000-5cd585ad0000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/Test1"), - // Properties: &armmigrate.GroupProperties{ - // AreAssessmentsRunning: to.Ptr(false), - // Assessments: []*string{ - // to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/Test1/assessments/assessment_5_9_2019_16_22_14")}, - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:52:07.736Z"); return t}()), - // GroupStatus: to.Ptr(armmigrate.GroupStatusCompleted), - // MachineCount: to.Ptr[int32](26), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-10T14:07:41.752Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Groups_Create.json -func ExampleGroupsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGroupsClient().Create(ctx, "abgoyal-westEurope", "abgoyalWEselfhostb72bproject", "Group2", &armmigrate.GroupsClientCreateOptions{Group: &armmigrate.Group{ - ETag: to.Ptr("\"1e000c2c-0000-0d00-0000-5cdaa4190000\""), - Properties: &armmigrate.GroupProperties{}, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Group = armmigrate.Group{ - // Name: to.Ptr("Group2"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/groups"), - // ETag: to.Ptr("\"1e000c2c-0000-0d00-0000-5cdaa4190000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/Group2"), - // Properties: &armmigrate.GroupProperties{ - // AreAssessmentsRunning: to.Ptr(false), - // Assessments: []*string{ - // }, - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:52:56.157Z"); return t}()), - // GroupStatus: to.Ptr(armmigrate.GroupStatusCompleted), - // MachineCount: to.Ptr[int32](0), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-14T11:18:49.548Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Groups_Delete.json -func ExampleGroupsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewGroupsClient().Delete(ctx, "abgoyal-westEurope", "abgoyalWEselfhostb72bproject", "Test1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Groups_UpdateMachines.json -func ExampleGroupsClient_UpdateMachines() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGroupsClient().UpdateMachines(ctx, "abgoyal-westEurope", "abgoyalWEselfhostb72bproject", "Group2", &armmigrate.GroupsClientUpdateMachinesOptions{GroupUpdateProperties: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Group = armmigrate.Group{ - // Name: to.Ptr("Group2"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/groups"), - // ETag: to.Ptr("\"1e000c2c-0000-0d00-0000-5cdaa4190000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/Test1"), - // Properties: &armmigrate.GroupProperties{ - // AreAssessmentsRunning: to.Ptr(false), - // Assessments: []*string{ - // to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/Test1/assessments/assessment_5_9_2019_16_22_14")}, - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:52:07.736Z"); return t}()), - // GroupStatus: to.Ptr(armmigrate.GroupStatusCompleted), - // MachineCount: to.Ptr[int32](26), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-10T14:07:41.752Z"); return t}()), - // }, - // } -} diff --git a/sdk/resourcemanager/migrate/armmigrate/hypervclustercontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/hypervclustercontroller_client.go new file mode 100644 index 000000000000..99fc825843ee --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/hypervclustercontroller_client.go @@ -0,0 +1,328 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// HypervClusterControllerClient contains the methods for the HypervClusterController group. +// Don't use this type directly, use NewHypervClusterControllerClient() instead. +type HypervClusterControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewHypervClusterControllerClient creates a new instance of HypervClusterControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewHypervClusterControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*HypervClusterControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &HypervClusterControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateCluster - Method to create or update a Hyper-V cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - clusterName - Cluster ARM name +// - body - Resource create parameters. +// - options - HypervClusterControllerClientBeginCreateClusterOptions contains the optional parameters for the HypervClusterControllerClient.BeginCreateCluster +// method. +func (client *HypervClusterControllerClient) BeginCreateCluster(ctx context.Context, resourceGroupName string, siteName string, clusterName string, body HypervCluster, options *HypervClusterControllerClientBeginCreateClusterOptions) (*runtime.Poller[HypervClusterControllerClientCreateClusterResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createCluster(ctx, resourceGroupName, siteName, clusterName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[HypervClusterControllerClientCreateClusterResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[HypervClusterControllerClientCreateClusterResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateCluster - Method to create or update a Hyper-V cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *HypervClusterControllerClient) createCluster(ctx context.Context, resourceGroupName string, siteName string, clusterName string, body HypervCluster, options *HypervClusterControllerClientBeginCreateClusterOptions) (*http.Response, error) { + var err error + const operationName = "HypervClusterControllerClient.BeginCreateCluster" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createClusterCreateRequest(ctx, resourceGroupName, siteName, clusterName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createClusterCreateRequest creates the CreateCluster request. +func (client *HypervClusterControllerClient) createClusterCreateRequest(ctx context.Context, resourceGroupName string, siteName string, clusterName string, body HypervCluster, options *HypervClusterControllerClientBeginCreateClusterOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/hypervSites/{siteName}/clusters/{clusterName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// Delete - Delete a HypervCluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - clusterName - Cluster ARM name +// - options - HypervClusterControllerClientDeleteOptions contains the optional parameters for the HypervClusterControllerClient.Delete +// method. +func (client *HypervClusterControllerClient) Delete(ctx context.Context, resourceGroupName string, siteName string, clusterName string, options *HypervClusterControllerClientDeleteOptions) (HypervClusterControllerClientDeleteResponse, error) { + var err error + const operationName = "HypervClusterControllerClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, siteName, clusterName, options) + if err != nil { + return HypervClusterControllerClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return HypervClusterControllerClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return HypervClusterControllerClientDeleteResponse{}, err + } + return HypervClusterControllerClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *HypervClusterControllerClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, clusterName string, options *HypervClusterControllerClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/hypervSites/{siteName}/clusters/{clusterName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// GetCluster - Method to get a Hyper-V cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - clusterName - Cluster ARM name +// - options - HypervClusterControllerClientGetClusterOptions contains the optional parameters for the HypervClusterControllerClient.GetCluster +// method. +func (client *HypervClusterControllerClient) GetCluster(ctx context.Context, resourceGroupName string, siteName string, clusterName string, options *HypervClusterControllerClientGetClusterOptions) (HypervClusterControllerClientGetClusterResponse, error) { + var err error + const operationName = "HypervClusterControllerClient.GetCluster" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getClusterCreateRequest(ctx, resourceGroupName, siteName, clusterName, options) + if err != nil { + return HypervClusterControllerClientGetClusterResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return HypervClusterControllerClientGetClusterResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return HypervClusterControllerClientGetClusterResponse{}, err + } + resp, err := client.getClusterHandleResponse(httpResp) + return resp, err +} + +// getClusterCreateRequest creates the GetCluster request. +func (client *HypervClusterControllerClient) getClusterCreateRequest(ctx context.Context, resourceGroupName string, siteName string, clusterName string, options *HypervClusterControllerClientGetClusterOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/hypervSites/{siteName}/clusters/{clusterName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getClusterHandleResponse handles the GetCluster response. +func (client *HypervClusterControllerClient) getClusterHandleResponse(resp *http.Response) (HypervClusterControllerClientGetClusterResponse, error) { + result := HypervClusterControllerClientGetClusterResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.HypervCluster); err != nil { + return HypervClusterControllerClientGetClusterResponse{}, err + } + return result, nil +} + +// NewListByHypervSitePager - List HypervCluster resources by HypervSite +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - options - HypervClusterControllerClientListByHypervSiteOptions contains the optional parameters for the HypervClusterControllerClient.NewListByHypervSitePager +// method. +func (client *HypervClusterControllerClient) NewListByHypervSitePager(resourceGroupName string, siteName string, options *HypervClusterControllerClientListByHypervSiteOptions) *runtime.Pager[HypervClusterControllerClientListByHypervSiteResponse] { + return runtime.NewPager(runtime.PagingHandler[HypervClusterControllerClientListByHypervSiteResponse]{ + More: func(page HypervClusterControllerClientListByHypervSiteResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *HypervClusterControllerClientListByHypervSiteResponse) (HypervClusterControllerClientListByHypervSiteResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "HypervClusterControllerClient.NewListByHypervSitePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByHypervSiteCreateRequest(ctx, resourceGroupName, siteName, options) + }, nil) + if err != nil { + return HypervClusterControllerClientListByHypervSiteResponse{}, err + } + return client.listByHypervSiteHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByHypervSiteCreateRequest creates the ListByHypervSite request. +func (client *HypervClusterControllerClient) listByHypervSiteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *HypervClusterControllerClientListByHypervSiteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/hypervSites/{siteName}/clusters" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + if options != nil && options.Filter != nil { + reqQP.Set("filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByHypervSiteHandleResponse handles the ListByHypervSite response. +func (client *HypervClusterControllerClient) listByHypervSiteHandleResponse(resp *http.Response) (HypervClusterControllerClientListByHypervSiteResponse, error) { + result := HypervClusterControllerClientListByHypervSiteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.HypervClusterListResult); err != nil { + return HypervClusterControllerClientListByHypervSiteResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/hypervcollectors_client.go b/sdk/resourcemanager/migrate/armmigrate/hypervcollectors_client.go deleted file mode 100644 index 89be6d5d146f..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/hypervcollectors_client.go +++ /dev/null @@ -1,332 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmigrate - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// HyperVCollectorsClient contains the methods for the HyperVCollectors group. -// Don't use this type directly, use NewHyperVCollectorsClient() instead. -type HyperVCollectorsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewHyperVCollectorsClient creates a new instance of HyperVCollectorsClient with the specified values. -// - subscriptionID - Azure Subscription Id in which project was created. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewHyperVCollectorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*HyperVCollectorsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &HyperVCollectorsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Create - Create or Update Hyper-V collector -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - hyperVCollectorName - Unique name of a Hyper-V collector within a project. -// - options - HyperVCollectorsClientCreateOptions contains the optional parameters for the HyperVCollectorsClient.Create method. -func (client *HyperVCollectorsClient) Create(ctx context.Context, resourceGroupName string, projectName string, hyperVCollectorName string, options *HyperVCollectorsClientCreateOptions) (HyperVCollectorsClientCreateResponse, error) { - var err error - const operationName = "HyperVCollectorsClient.Create" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createCreateRequest(ctx, resourceGroupName, projectName, hyperVCollectorName, options) - if err != nil { - return HyperVCollectorsClientCreateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return HyperVCollectorsClientCreateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return HyperVCollectorsClientCreateResponse{}, err - } - resp, err := client.createHandleResponse(httpResp) - return resp, err -} - -// createCreateRequest creates the Create request. -func (client *HyperVCollectorsClient) createCreateRequest(ctx context.Context, resourceGroupName string, projectName string, hyperVCollectorName string, options *HyperVCollectorsClientCreateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/hypervcollectors/{hyperVCollectorName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if hyperVCollectorName == "" { - return nil, errors.New("parameter hyperVCollectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{hyperVCollectorName}", url.PathEscape(hyperVCollectorName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.CollectorBody != nil { - if err := runtime.MarshalAsJSON(req, *options.CollectorBody); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// createHandleResponse handles the Create response. -func (client *HyperVCollectorsClient) createHandleResponse(resp *http.Response) (HyperVCollectorsClientCreateResponse, error) { - result := HyperVCollectorsClientCreateResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.HyperVCollector); err != nil { - return HyperVCollectorsClientCreateResponse{}, err - } - return result, nil -} - -// Delete - Delete a Hyper-V collector from the project. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - hyperVCollectorName - Unique name of a Hyper-V collector within a project. -// - options - HyperVCollectorsClientDeleteOptions contains the optional parameters for the HyperVCollectorsClient.Delete method. -func (client *HyperVCollectorsClient) Delete(ctx context.Context, resourceGroupName string, projectName string, hyperVCollectorName string, options *HyperVCollectorsClientDeleteOptions) (HyperVCollectorsClientDeleteResponse, error) { - var err error - const operationName = "HyperVCollectorsClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, projectName, hyperVCollectorName, options) - if err != nil { - return HyperVCollectorsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return HyperVCollectorsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return HyperVCollectorsClientDeleteResponse{}, err - } - resp, err := client.deleteHandleResponse(httpResp) - return resp, err -} - -// deleteCreateRequest creates the Delete request. -func (client *HyperVCollectorsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, projectName string, hyperVCollectorName string, options *HyperVCollectorsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/hypervcollectors/{hyperVCollectorName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if hyperVCollectorName == "" { - return nil, errors.New("parameter hyperVCollectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{hyperVCollectorName}", url.PathEscape(hyperVCollectorName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// deleteHandleResponse handles the Delete response. -func (client *HyperVCollectorsClient) deleteHandleResponse(resp *http.Response) (HyperVCollectorsClientDeleteResponse, error) { - result := HyperVCollectorsClientDeleteResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - return result, nil -} - -// Get - Get a Hyper-V collector. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - hyperVCollectorName - Unique name of a Hyper-V collector within a project. -// - options - HyperVCollectorsClientGetOptions contains the optional parameters for the HyperVCollectorsClient.Get method. -func (client *HyperVCollectorsClient) Get(ctx context.Context, resourceGroupName string, projectName string, hyperVCollectorName string, options *HyperVCollectorsClientGetOptions) (HyperVCollectorsClientGetResponse, error) { - var err error - const operationName = "HyperVCollectorsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, hyperVCollectorName, options) - if err != nil { - return HyperVCollectorsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return HyperVCollectorsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return HyperVCollectorsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *HyperVCollectorsClient) getCreateRequest(ctx context.Context, resourceGroupName string, projectName string, hyperVCollectorName string, options *HyperVCollectorsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/hypervcollectors/{hyperVCollectorName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if hyperVCollectorName == "" { - return nil, errors.New("parameter hyperVCollectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{hyperVCollectorName}", url.PathEscape(hyperVCollectorName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *HyperVCollectorsClient) getHandleResponse(resp *http.Response) (HyperVCollectorsClientGetResponse, error) { - result := HyperVCollectorsClientGetResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.HyperVCollector); err != nil { - return HyperVCollectorsClientGetResponse{}, err - } - return result, nil -} - -// NewListByProjectPager - Get a list of Hyper-V collector. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - options - HyperVCollectorsClientListByProjectOptions contains the optional parameters for the HyperVCollectorsClient.NewListByProjectPager -// method. -func (client *HyperVCollectorsClient) NewListByProjectPager(resourceGroupName string, projectName string, options *HyperVCollectorsClientListByProjectOptions) *runtime.Pager[HyperVCollectorsClientListByProjectResponse] { - return runtime.NewPager(runtime.PagingHandler[HyperVCollectorsClientListByProjectResponse]{ - More: func(page HyperVCollectorsClientListByProjectResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *HyperVCollectorsClientListByProjectResponse) (HyperVCollectorsClientListByProjectResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "HyperVCollectorsClient.NewListByProjectPager") - req, err := client.listByProjectCreateRequest(ctx, resourceGroupName, projectName, options) - if err != nil { - return HyperVCollectorsClientListByProjectResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return HyperVCollectorsClientListByProjectResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return HyperVCollectorsClientListByProjectResponse{}, runtime.NewResponseError(resp) - } - return client.listByProjectHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByProjectCreateRequest creates the ListByProject request. -func (client *HyperVCollectorsClient) listByProjectCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *HyperVCollectorsClientListByProjectOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/hypervcollectors" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByProjectHandleResponse handles the ListByProject response. -func (client *HyperVCollectorsClient) listByProjectHandleResponse(resp *http.Response) (HyperVCollectorsClientListByProjectResponse, error) { - result := HyperVCollectorsClientListByProjectResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.HyperVCollectorList); err != nil { - return HyperVCollectorsClientListByProjectResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/hypervcollectors_client_example_test.go b/sdk/resourcemanager/migrate/armmigrate/hypervcollectors_client_example_test.go deleted file mode 100644 index 3c3f410d860e..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/hypervcollectors_client_example_test.go +++ /dev/null @@ -1,188 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmigrate_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/HyperVCollectors_ListByProject.json -func ExampleHyperVCollectorsClient_NewListByProjectPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewHyperVCollectorsClient().NewListByProjectPager("contosoithyperv", "migrateprojectce73project", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.HyperVCollectorList = armmigrate.HyperVCollectorList{ - // Value: []*armmigrate.HyperVCollector{ - // { - // Name: to.Ptr("migrateprojectce73collector"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/hypervcollectors"), - // ETag: to.Ptr("\"00000981-0000-0300-0000-5d74cd5f0000\""), - // ID: to.Ptr("/subscriptions/8c3c936a-c09b-4de3-830b-3f5f244d72e9/resourceGroups/contosoithyperv/providers/Microsoft.Migrate/assessmentprojects/migrateprojectce73project/hypervcollectors/migrateprojectce73collector"), - // Properties: &armmigrate.CollectorProperties{ - // AgentProperties: &armmigrate.CollectorAgentProperties{ - // ID: to.Ptr("d86c7d5a-2103-5157-bb20-9026b75e5de8"), - // LastHeartbeatUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-08T09:43:59.057Z"); return t}()), - // SpnDetails: &armmigrate.CollectorBodyAgentSpnProperties{ - // ApplicationID: to.Ptr("827f1053-44dc-439f-b832-05416dcce12b"), - // Audience: to.Ptr("https://72f988bf-86f1-41af-91ab-2d7cd011db47/migrateprojectce73agentauthaadapp"), - // Authority: to.Ptr("https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47"), - // ObjectID: to.Ptr("be75098e-c0fc-4ac4-98c7-282ebbcf8370"), - // TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), - // }, - // Version: to.Ptr("1.0.8.218"), - // }, - // CreatedTimestamp: to.Ptr("2019-04-10T10:22:51.6271816Z"), - // DiscoverySiteID: to.Ptr("/subscriptions/8c3c936a-c09b-4de3-830b-3f5f244d72e9/resourceGroups/ContosoITHyperV/providers/Microsoft.OffAzure/HyperVSites/migrateprojectce73site"), - // UpdatedTimestamp: to.Ptr("2019-09-08T09:43:59.0573145Z"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/HyperVCollectors_Get.json -func ExampleHyperVCollectorsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewHyperVCollectorsClient().Get(ctx, "contosoithyperv", "migrateprojectce73project", "migrateprojectce73collector", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.HyperVCollector = armmigrate.HyperVCollector{ - // Name: to.Ptr("migrateprojectce73collector"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/hypervcollectors"), - // ETag: to.Ptr("\"00000981-0000-0300-0000-5d74cd5f0000\""), - // ID: to.Ptr("/subscriptions/8c3c936a-c09b-4de3-830b-3f5f244d72e9/resourceGroups/contosoithyperv/providers/Microsoft.Migrate/assessmentprojects/migrateprojectce73project/hypervcollectors/migrateprojectce73collector"), - // Properties: &armmigrate.CollectorProperties{ - // AgentProperties: &armmigrate.CollectorAgentProperties{ - // ID: to.Ptr("d86c7d5a-2103-5157-bb20-9026b75e5de8"), - // LastHeartbeatUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-08T09:43:59.057Z"); return t}()), - // SpnDetails: &armmigrate.CollectorBodyAgentSpnProperties{ - // ApplicationID: to.Ptr("827f1053-44dc-439f-b832-05416dcce12b"), - // Audience: to.Ptr("https://72f988bf-86f1-41af-91ab-2d7cd011db47/migrateprojectce73agentauthaadapp"), - // Authority: to.Ptr("https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47"), - // ObjectID: to.Ptr("be75098e-c0fc-4ac4-98c7-282ebbcf8370"), - // TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), - // }, - // Version: to.Ptr("1.0.8.218"), - // }, - // CreatedTimestamp: to.Ptr("2019-04-10T10:22:51.6271816Z"), - // DiscoverySiteID: to.Ptr("/subscriptions/8c3c936a-c09b-4de3-830b-3f5f244d72e9/resourceGroups/ContosoITHyperV/providers/Microsoft.OffAzure/HyperVSites/migrateprojectce73site"), - // UpdatedTimestamp: to.Ptr("2019-09-08T09:43:59.0573145Z"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/HyperVCollectors_Create.json -func ExampleHyperVCollectorsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewHyperVCollectorsClient().Create(ctx, "contosoithyperv", "migrateprojectce73project", "migrateprojectce73collector", &armmigrate.HyperVCollectorsClientCreateOptions{CollectorBody: &armmigrate.HyperVCollector{ - ETag: to.Ptr("\"00000981-0000-0300-0000-5d74cd5f0000\""), - Properties: &armmigrate.CollectorProperties{ - AgentProperties: &armmigrate.CollectorAgentProperties{ - SpnDetails: &armmigrate.CollectorBodyAgentSpnProperties{ - ApplicationID: to.Ptr("827f1053-44dc-439f-b832-05416dcce12b"), - Audience: to.Ptr("https://72f988bf-86f1-41af-91ab-2d7cd011db47/migrateprojectce73agentauthaadapp"), - Authority: to.Ptr("https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47"), - ObjectID: to.Ptr("be75098e-c0fc-4ac4-98c7-282ebbcf8370"), - TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), - }, - }, - DiscoverySiteID: to.Ptr("/subscriptions/8c3c936a-c09b-4de3-830b-3f5f244d72e9/resourceGroups/ContosoITHyperV/providers/Microsoft.OffAzure/HyperVSites/migrateprojectce73site"), - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.HyperVCollector = armmigrate.HyperVCollector{ - // Name: to.Ptr("migrateprojectce73collector"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/hypervcollectors"), - // ETag: to.Ptr("\"00000981-0000-0300-0000-5d74cd5f0000\""), - // ID: to.Ptr("/subscriptions/8c3c936a-c09b-4de3-830b-3f5f244d72e9/resourceGroups/contosoithyperv/providers/Microsoft.Migrate/assessmentprojects/migrateprojectce73project/hypervcollectors/migrateprojectce73collector"), - // Properties: &armmigrate.CollectorProperties{ - // AgentProperties: &armmigrate.CollectorAgentProperties{ - // ID: to.Ptr("d86c7d5a-2103-5157-bb20-9026b75e5de8"), - // LastHeartbeatUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-08T09:43:59.057Z"); return t}()), - // SpnDetails: &armmigrate.CollectorBodyAgentSpnProperties{ - // ApplicationID: to.Ptr("827f1053-44dc-439f-b832-05416dcce12b"), - // Audience: to.Ptr("https://72f988bf-86f1-41af-91ab-2d7cd011db47/migrateprojectce73agentauthaadapp"), - // Authority: to.Ptr("https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47"), - // ObjectID: to.Ptr("be75098e-c0fc-4ac4-98c7-282ebbcf8370"), - // TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), - // }, - // Version: to.Ptr("1.0.8.218"), - // }, - // CreatedTimestamp: to.Ptr("2019-04-10T10:22:51.6271816Z"), - // DiscoverySiteID: to.Ptr("/subscriptions/8c3c936a-c09b-4de3-830b-3f5f244d72e9/resourceGroups/ContosoITHyperV/providers/Microsoft.OffAzure/HyperVSites/migrateprojectce73site"), - // UpdatedTimestamp: to.Ptr("2019-09-08T09:43:59.0573145Z"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/HyperVCollectors_Delete.json -func ExampleHyperVCollectorsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewHyperVCollectorsClient().Delete(ctx, "contosoithyperv", "migrateprojectce73project", "migrateprojectce73collector", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/migrate/armmigrate/hypervdependencymapcontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/hypervdependencymapcontroller_client.go new file mode 100644 index 000000000000..9453e32b3f49 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/hypervdependencymapcontroller_client.go @@ -0,0 +1,530 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// HypervDependencyMapControllerClient contains the methods for the HypervDependencyMapController group. +// Don't use this type directly, use NewHypervDependencyMapControllerClient() instead. +type HypervDependencyMapControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewHypervDependencyMapControllerClient creates a new instance of HypervDependencyMapControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewHypervDependencyMapControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*HypervDependencyMapControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &HypervDependencyMapControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginClientGroupMembers - API to list client group members for the selected client group. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - mapRequest - The content of the action request +// - options - HypervDependencyMapControllerClientBeginClientGroupMembersOptions contains the optional parameters for the HypervDependencyMapControllerClient.BeginClientGroupMembers +// method. +func (client *HypervDependencyMapControllerClient) BeginClientGroupMembers(ctx context.Context, resourceGroupName string, siteName string, mapRequest DependencyMapServiceMapextensionsClientGroupMembersRequest, options *HypervDependencyMapControllerClientBeginClientGroupMembersOptions) (*runtime.Poller[HypervDependencyMapControllerClientClientGroupMembersResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.clientGroupMembers(ctx, resourceGroupName, siteName, mapRequest, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[HypervDependencyMapControllerClientClientGroupMembersResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[HypervDependencyMapControllerClientClientGroupMembersResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ClientGroupMembers - API to list client group members for the selected client group. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *HypervDependencyMapControllerClient) clientGroupMembers(ctx context.Context, resourceGroupName string, siteName string, mapRequest DependencyMapServiceMapextensionsClientGroupMembersRequest, options *HypervDependencyMapControllerClientBeginClientGroupMembersOptions) (*http.Response, error) { + var err error + const operationName = "HypervDependencyMapControllerClient.BeginClientGroupMembers" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.clientGroupMembersCreateRequest(ctx, resourceGroupName, siteName, mapRequest, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// clientGroupMembersCreateRequest creates the ClientGroupMembers request. +func (client *HypervDependencyMapControllerClient) clientGroupMembersCreateRequest(ctx context.Context, resourceGroupName string, siteName string, mapRequest DependencyMapServiceMapextensionsClientGroupMembersRequest, options *HypervDependencyMapControllerClientBeginClientGroupMembersOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/hypervSites/{siteName}/clientGroupMembers" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, mapRequest); err != nil { + return nil, err + } + return req, nil +} + +// BeginExportDependencies - API to generate report containing agentless dependencies. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - requestBody - The content of the action request +// - options - HypervDependencyMapControllerClientBeginExportDependenciesOptions contains the optional parameters for the HypervDependencyMapControllerClient.BeginExportDependencies +// method. +func (client *HypervDependencyMapControllerClient) BeginExportDependencies(ctx context.Context, resourceGroupName string, siteName string, requestBody DependencyMapServiceMapextensionsExportDependenciesRequest, options *HypervDependencyMapControllerClientBeginExportDependenciesOptions) (*runtime.Poller[HypervDependencyMapControllerClientExportDependenciesResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.exportDependencies(ctx, resourceGroupName, siteName, requestBody, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[HypervDependencyMapControllerClientExportDependenciesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[HypervDependencyMapControllerClientExportDependenciesResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ExportDependencies - API to generate report containing agentless dependencies. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *HypervDependencyMapControllerClient) exportDependencies(ctx context.Context, resourceGroupName string, siteName string, requestBody DependencyMapServiceMapextensionsExportDependenciesRequest, options *HypervDependencyMapControllerClientBeginExportDependenciesOptions) (*http.Response, error) { + var err error + const operationName = "HypervDependencyMapControllerClient.BeginExportDependencies" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.exportDependenciesCreateRequest(ctx, resourceGroupName, siteName, requestBody, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// exportDependenciesCreateRequest creates the ExportDependencies request. +func (client *HypervDependencyMapControllerClient) exportDependenciesCreateRequest(ctx context.Context, resourceGroupName string, siteName string, requestBody DependencyMapServiceMapextensionsExportDependenciesRequest, options *HypervDependencyMapControllerClientBeginExportDependenciesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/hypervSites/{siteName}/exportDependencies" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, requestBody); err != nil { + return nil, err + } + return req, nil +} + +// BeginGenerateCoarseMap - API to generate coarse map for the list of machines. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - mapRequest - The content of the action request +// - options - HypervDependencyMapControllerClientBeginGenerateCoarseMapOptions contains the optional parameters for the HypervDependencyMapControllerClient.BeginGenerateCoarseMap +// method. +func (client *HypervDependencyMapControllerClient) BeginGenerateCoarseMap(ctx context.Context, resourceGroupName string, siteName string, mapRequest DependencyMapServiceMapextensionsScopeMapRequest, options *HypervDependencyMapControllerClientBeginGenerateCoarseMapOptions) (*runtime.Poller[HypervDependencyMapControllerClientGenerateCoarseMapResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.generateCoarseMap(ctx, resourceGroupName, siteName, mapRequest, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[HypervDependencyMapControllerClientGenerateCoarseMapResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[HypervDependencyMapControllerClientGenerateCoarseMapResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// GenerateCoarseMap - API to generate coarse map for the list of machines. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *HypervDependencyMapControllerClient) generateCoarseMap(ctx context.Context, resourceGroupName string, siteName string, mapRequest DependencyMapServiceMapextensionsScopeMapRequest, options *HypervDependencyMapControllerClientBeginGenerateCoarseMapOptions) (*http.Response, error) { + var err error + const operationName = "HypervDependencyMapControllerClient.BeginGenerateCoarseMap" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.generateCoarseMapCreateRequest(ctx, resourceGroupName, siteName, mapRequest, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// generateCoarseMapCreateRequest creates the GenerateCoarseMap request. +func (client *HypervDependencyMapControllerClient) generateCoarseMapCreateRequest(ctx context.Context, resourceGroupName string, siteName string, mapRequest DependencyMapServiceMapextensionsScopeMapRequest, options *HypervDependencyMapControllerClientBeginGenerateCoarseMapOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/hypervSites/{siteName}/generateCoarseMap" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, mapRequest); err != nil { + return nil, err + } + return req, nil +} + +// BeginGenerateDetailedMap - API to generate detailed map for a selected machine. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - mapRequest - The content of the action request +// - options - HypervDependencyMapControllerClientBeginGenerateDetailedMapOptions contains the optional parameters for the HypervDependencyMapControllerClient.BeginGenerateDetailedMap +// method. +func (client *HypervDependencyMapControllerClient) BeginGenerateDetailedMap(ctx context.Context, resourceGroupName string, siteName string, mapRequest DependencyMapServiceMapextensionsSingleMachineDetailedMapRequest, options *HypervDependencyMapControllerClientBeginGenerateDetailedMapOptions) (*runtime.Poller[HypervDependencyMapControllerClientGenerateDetailedMapResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.generateDetailedMap(ctx, resourceGroupName, siteName, mapRequest, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[HypervDependencyMapControllerClientGenerateDetailedMapResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[HypervDependencyMapControllerClientGenerateDetailedMapResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// GenerateDetailedMap - API to generate detailed map for a selected machine. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *HypervDependencyMapControllerClient) generateDetailedMap(ctx context.Context, resourceGroupName string, siteName string, mapRequest DependencyMapServiceMapextensionsSingleMachineDetailedMapRequest, options *HypervDependencyMapControllerClientBeginGenerateDetailedMapOptions) (*http.Response, error) { + var err error + const operationName = "HypervDependencyMapControllerClient.BeginGenerateDetailedMap" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.generateDetailedMapCreateRequest(ctx, resourceGroupName, siteName, mapRequest, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// generateDetailedMapCreateRequest creates the GenerateDetailedMap request. +func (client *HypervDependencyMapControllerClient) generateDetailedMapCreateRequest(ctx context.Context, resourceGroupName string, siteName string, mapRequest DependencyMapServiceMapextensionsSingleMachineDetailedMapRequest, options *HypervDependencyMapControllerClientBeginGenerateDetailedMapOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/hypervSites/{siteName}/generateDetailedMap" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, mapRequest); err != nil { + return nil, err + } + return req, nil +} + +// BeginServerGroupMembers - API to list server group members for the selected server group. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - mapRequest - The content of the action request +// - options - HypervDependencyMapControllerClientBeginServerGroupMembersOptions contains the optional parameters for the HypervDependencyMapControllerClient.BeginServerGroupMembers +// method. +func (client *HypervDependencyMapControllerClient) BeginServerGroupMembers(ctx context.Context, resourceGroupName string, siteName string, mapRequest DependencyMapServiceMapextensionsServerGroupMembersRequest, options *HypervDependencyMapControllerClientBeginServerGroupMembersOptions) (*runtime.Poller[HypervDependencyMapControllerClientServerGroupMembersResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.serverGroupMembers(ctx, resourceGroupName, siteName, mapRequest, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[HypervDependencyMapControllerClientServerGroupMembersResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[HypervDependencyMapControllerClientServerGroupMembersResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ServerGroupMembers - API to list server group members for the selected server group. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *HypervDependencyMapControllerClient) serverGroupMembers(ctx context.Context, resourceGroupName string, siteName string, mapRequest DependencyMapServiceMapextensionsServerGroupMembersRequest, options *HypervDependencyMapControllerClientBeginServerGroupMembersOptions) (*http.Response, error) { + var err error + const operationName = "HypervDependencyMapControllerClient.BeginServerGroupMembers" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.serverGroupMembersCreateRequest(ctx, resourceGroupName, siteName, mapRequest, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// serverGroupMembersCreateRequest creates the ServerGroupMembers request. +func (client *HypervDependencyMapControllerClient) serverGroupMembersCreateRequest(ctx context.Context, resourceGroupName string, siteName string, mapRequest DependencyMapServiceMapextensionsServerGroupMembersRequest, options *HypervDependencyMapControllerClientBeginServerGroupMembersOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/hypervSites/{siteName}/serverGroupMembers" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, mapRequest); err != nil { + return nil, err + } + return req, nil +} + +// BeginUpdateDependencyMapStatus - Method to enable disable dependency map status for machines in a site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - mapRequest - The content of the action request +// - options - HypervDependencyMapControllerClientBeginUpdateDependencyMapStatusOptions contains the optional parameters for +// the HypervDependencyMapControllerClient.BeginUpdateDependencyMapStatus method. +func (client *HypervDependencyMapControllerClient) BeginUpdateDependencyMapStatus(ctx context.Context, resourceGroupName string, siteName string, mapRequest UpdateMachineDepMapStatus, options *HypervDependencyMapControllerClientBeginUpdateDependencyMapStatusOptions) (*runtime.Poller[HypervDependencyMapControllerClientUpdateDependencyMapStatusResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.updateDependencyMapStatus(ctx, resourceGroupName, siteName, mapRequest, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[HypervDependencyMapControllerClientUpdateDependencyMapStatusResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[HypervDependencyMapControllerClientUpdateDependencyMapStatusResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// UpdateDependencyMapStatus - Method to enable disable dependency map status for machines in a site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *HypervDependencyMapControllerClient) updateDependencyMapStatus(ctx context.Context, resourceGroupName string, siteName string, mapRequest UpdateMachineDepMapStatus, options *HypervDependencyMapControllerClientBeginUpdateDependencyMapStatusOptions) (*http.Response, error) { + var err error + const operationName = "HypervDependencyMapControllerClient.BeginUpdateDependencyMapStatus" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateDependencyMapStatusCreateRequest(ctx, resourceGroupName, siteName, mapRequest, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateDependencyMapStatusCreateRequest creates the UpdateDependencyMapStatus request. +func (client *HypervDependencyMapControllerClient) updateDependencyMapStatusCreateRequest(ctx context.Context, resourceGroupName string, siteName string, mapRequest UpdateMachineDepMapStatus, options *HypervDependencyMapControllerClientBeginUpdateDependencyMapStatusOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/hypervSites/{siteName}/updateDependencyMapStatus" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, mapRequest); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/hypervhostcontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/hypervhostcontroller_client.go new file mode 100644 index 000000000000..855d32639c01 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/hypervhostcontroller_client.go @@ -0,0 +1,350 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// HypervHostControllerClient contains the methods for the HypervHostController group. +// Don't use this type directly, use NewHypervHostControllerClient() instead. +type HypervHostControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewHypervHostControllerClient creates a new instance of HypervHostControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewHypervHostControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*HypervHostControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &HypervHostControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreate - Create a HypervHost +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - hostName - Host name +// - body - Resource create parameters. +// - options - HypervHostControllerClientBeginCreateOptions contains the optional parameters for the HypervHostControllerClient.BeginCreate +// method. +func (client *HypervHostControllerClient) BeginCreate(ctx context.Context, resourceGroupName string, siteName string, hostName string, body HypervHost, options *HypervHostControllerClientBeginCreateOptions) (*runtime.Poller[HypervHostControllerClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, siteName, hostName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[HypervHostControllerClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[HypervHostControllerClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Create a HypervHost +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *HypervHostControllerClient) create(ctx context.Context, resourceGroupName string, siteName string, hostName string, body HypervHost, options *HypervHostControllerClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "HypervHostControllerClient.BeginCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, siteName, hostName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createCreateRequest creates the Create request. +func (client *HypervHostControllerClient) createCreateRequest(ctx context.Context, resourceGroupName string, siteName string, hostName string, body HypervHost, options *HypervHostControllerClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/hypervSites/{siteName}/hosts/{hostName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if hostName == "" { + return nil, errors.New("parameter hostName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hostName}", url.PathEscape(hostName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Delete a HypervHost +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - hostName - Host name +// - options - HypervHostControllerClientBeginDeleteOptions contains the optional parameters for the HypervHostControllerClient.BeginDelete +// method. +func (client *HypervHostControllerClient) BeginDelete(ctx context.Context, resourceGroupName string, siteName string, hostName string, options *HypervHostControllerClientBeginDeleteOptions) (*runtime.Poller[HypervHostControllerClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, siteName, hostName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[HypervHostControllerClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[HypervHostControllerClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a HypervHost +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *HypervHostControllerClient) deleteOperation(ctx context.Context, resourceGroupName string, siteName string, hostName string, options *HypervHostControllerClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "HypervHostControllerClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, siteName, hostName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *HypervHostControllerClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, hostName string, options *HypervHostControllerClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/hypervSites/{siteName}/hosts/{hostName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if hostName == "" { + return nil, errors.New("parameter hostName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hostName}", url.PathEscape(hostName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a HypervHost +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - hostName - Host name +// - options - HypervHostControllerClientGetOptions contains the optional parameters for the HypervHostControllerClient.Get +// method. +func (client *HypervHostControllerClient) Get(ctx context.Context, resourceGroupName string, siteName string, hostName string, options *HypervHostControllerClientGetOptions) (HypervHostControllerClientGetResponse, error) { + var err error + const operationName = "HypervHostControllerClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, siteName, hostName, options) + if err != nil { + return HypervHostControllerClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return HypervHostControllerClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return HypervHostControllerClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *HypervHostControllerClient) getCreateRequest(ctx context.Context, resourceGroupName string, siteName string, hostName string, options *HypervHostControllerClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/hypervSites/{siteName}/hosts/{hostName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if hostName == "" { + return nil, errors.New("parameter hostName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hostName}", url.PathEscape(hostName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *HypervHostControllerClient) getHandleResponse(resp *http.Response) (HypervHostControllerClientGetResponse, error) { + result := HypervHostControllerClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.HypervHost); err != nil { + return HypervHostControllerClientGetResponse{}, err + } + return result, nil +} + +// NewListByHypervSitePager - List HypervHost resources by HypervSite +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - options - HypervHostControllerClientListByHypervSiteOptions contains the optional parameters for the HypervHostControllerClient.NewListByHypervSitePager +// method. +func (client *HypervHostControllerClient) NewListByHypervSitePager(resourceGroupName string, siteName string, options *HypervHostControllerClientListByHypervSiteOptions) *runtime.Pager[HypervHostControllerClientListByHypervSiteResponse] { + return runtime.NewPager(runtime.PagingHandler[HypervHostControllerClientListByHypervSiteResponse]{ + More: func(page HypervHostControllerClientListByHypervSiteResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *HypervHostControllerClientListByHypervSiteResponse) (HypervHostControllerClientListByHypervSiteResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "HypervHostControllerClient.NewListByHypervSitePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByHypervSiteCreateRequest(ctx, resourceGroupName, siteName, options) + }, nil) + if err != nil { + return HypervHostControllerClientListByHypervSiteResponse{}, err + } + return client.listByHypervSiteHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByHypervSiteCreateRequest creates the ListByHypervSite request. +func (client *HypervHostControllerClient) listByHypervSiteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *HypervHostControllerClientListByHypervSiteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/hypervSites/{siteName}/hosts" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + if options != nil && options.Filter != nil { + reqQP.Set("filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByHypervSiteHandleResponse handles the ListByHypervSite response. +func (client *HypervHostControllerClient) listByHypervSiteHandleResponse(resp *http.Response) (HypervHostControllerClientListByHypervSiteResponse, error) { + result := HypervHostControllerClientListByHypervSiteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.HypervHostListResult); err != nil { + return HypervHostControllerClientListByHypervSiteResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/hypervjobs_client.go b/sdk/resourcemanager/migrate/armmigrate/hypervjobs_client.go new file mode 100644 index 000000000000..5ad9b51680f0 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/hypervjobs_client.go @@ -0,0 +1,178 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// HypervJobsClient contains the methods for the HypervJobs group. +// Don't use this type directly, use NewHypervJobsClient() instead. +type HypervJobsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewHypervJobsClient creates a new instance of HypervJobsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewHypervJobsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*HypervJobsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &HypervJobsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get a HypervJob +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - jobName - Job name +// - options - HypervJobsClientGetOptions contains the optional parameters for the HypervJobsClient.Get method. +func (client *HypervJobsClient) Get(ctx context.Context, resourceGroupName string, siteName string, jobName string, options *HypervJobsClientGetOptions) (HypervJobsClientGetResponse, error) { + var err error + const operationName = "HypervJobsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, siteName, jobName, options) + if err != nil { + return HypervJobsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return HypervJobsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return HypervJobsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *HypervJobsClient) getCreateRequest(ctx context.Context, resourceGroupName string, siteName string, jobName string, options *HypervJobsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/hypervSites/{siteName}/jobs/{jobName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *HypervJobsClient) getHandleResponse(resp *http.Response) (HypervJobsClientGetResponse, error) { + result := HypervJobsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.HypervJob); err != nil { + return HypervJobsClientGetResponse{}, err + } + return result, nil +} + +// NewListByHypervSitePager - List HypervJob resources by HypervSite +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - options - HypervJobsClientListByHypervSiteOptions contains the optional parameters for the HypervJobsClient.NewListByHypervSitePager +// method. +func (client *HypervJobsClient) NewListByHypervSitePager(resourceGroupName string, siteName string, options *HypervJobsClientListByHypervSiteOptions) *runtime.Pager[HypervJobsClientListByHypervSiteResponse] { + return runtime.NewPager(runtime.PagingHandler[HypervJobsClientListByHypervSiteResponse]{ + More: func(page HypervJobsClientListByHypervSiteResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *HypervJobsClientListByHypervSiteResponse) (HypervJobsClientListByHypervSiteResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "HypervJobsClient.NewListByHypervSitePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByHypervSiteCreateRequest(ctx, resourceGroupName, siteName, options) + }, nil) + if err != nil { + return HypervJobsClientListByHypervSiteResponse{}, err + } + return client.listByHypervSiteHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByHypervSiteCreateRequest creates the ListByHypervSite request. +func (client *HypervJobsClient) listByHypervSiteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *HypervJobsClientListByHypervSiteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/hypervSites/{siteName}/jobs" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByHypervSiteHandleResponse handles the ListByHypervSite response. +func (client *HypervJobsClient) listByHypervSiteHandleResponse(resp *http.Response) (HypervJobsClientListByHypervSiteResponse, error) { + result := HypervJobsClientListByHypervSiteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.HypervJobListResult); err != nil { + return HypervJobsClientListByHypervSiteResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/hypervjobscontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/hypervjobscontroller_client.go new file mode 100644 index 000000000000..c3df7da33d59 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/hypervjobscontroller_client.go @@ -0,0 +1,179 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// HypervJobsControllerClient contains the methods for the HypervJobsController group. +// Don't use this type directly, use NewHypervJobsControllerClient() instead. +type HypervJobsControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewHypervJobsControllerClient creates a new instance of HypervJobsControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewHypervJobsControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*HypervJobsControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &HypervJobsControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get a VmwareJob +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - jobName - Jobs name +// - options - HypervJobsControllerClientGetOptions contains the optional parameters for the HypervJobsControllerClient.Get +// method. +func (client *HypervJobsControllerClient) Get(ctx context.Context, resourceGroupName string, siteName string, jobName string, options *HypervJobsControllerClientGetOptions) (HypervJobsControllerClientGetResponse, error) { + var err error + const operationName = "HypervJobsControllerClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, siteName, jobName, options) + if err != nil { + return HypervJobsControllerClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return HypervJobsControllerClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return HypervJobsControllerClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *HypervJobsControllerClient) getCreateRequest(ctx context.Context, resourceGroupName string, siteName string, jobName string, options *HypervJobsControllerClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/vmwareSites/{siteName}/jobs/{jobName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *HypervJobsControllerClient) getHandleResponse(resp *http.Response) (HypervJobsControllerClientGetResponse, error) { + result := HypervJobsControllerClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VmwareJob); err != nil { + return HypervJobsControllerClientGetResponse{}, err + } + return result, nil +} + +// NewListByVmwareSitePager - List VmwareJob resources by VmwareSite +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - options - HypervJobsControllerClientListByVmwareSiteOptions contains the optional parameters for the HypervJobsControllerClient.NewListByVmwareSitePager +// method. +func (client *HypervJobsControllerClient) NewListByVmwareSitePager(resourceGroupName string, siteName string, options *HypervJobsControllerClientListByVmwareSiteOptions) *runtime.Pager[HypervJobsControllerClientListByVmwareSiteResponse] { + return runtime.NewPager(runtime.PagingHandler[HypervJobsControllerClientListByVmwareSiteResponse]{ + More: func(page HypervJobsControllerClientListByVmwareSiteResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *HypervJobsControllerClientListByVmwareSiteResponse) (HypervJobsControllerClientListByVmwareSiteResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "HypervJobsControllerClient.NewListByVmwareSitePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByVmwareSiteCreateRequest(ctx, resourceGroupName, siteName, options) + }, nil) + if err != nil { + return HypervJobsControllerClientListByVmwareSiteResponse{}, err + } + return client.listByVmwareSiteHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByVmwareSiteCreateRequest creates the ListByVmwareSite request. +func (client *HypervJobsControllerClient) listByVmwareSiteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *HypervJobsControllerClientListByVmwareSiteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/vmwareSites/{siteName}/jobs" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByVmwareSiteHandleResponse handles the ListByVmwareSite response. +func (client *HypervJobsControllerClient) listByVmwareSiteHandleResponse(resp *http.Response) (HypervJobsControllerClientListByVmwareSiteResponse, error) { + result := HypervJobsControllerClientListByVmwareSiteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VmwareJobListResult); err != nil { + return HypervJobsControllerClientListByVmwareSiteResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/hypervmachinescontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/hypervmachinescontroller_client.go new file mode 100644 index 000000000000..7605b1a149bc --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/hypervmachinescontroller_client.go @@ -0,0 +1,347 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// HypervMachinesControllerClient contains the methods for the HypervMachinesController group. +// Don't use this type directly, use NewHypervMachinesControllerClient() instead. +type HypervMachinesControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewHypervMachinesControllerClient creates a new instance of HypervMachinesControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewHypervMachinesControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*HypervMachinesControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &HypervMachinesControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get a HypervMachine +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - machineName - HypervMachine name +// - options - HypervMachinesControllerClientGetOptions contains the optional parameters for the HypervMachinesControllerClient.Get +// method. +func (client *HypervMachinesControllerClient) Get(ctx context.Context, resourceGroupName string, siteName string, machineName string, options *HypervMachinesControllerClientGetOptions) (HypervMachinesControllerClientGetResponse, error) { + var err error + const operationName = "HypervMachinesControllerClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, siteName, machineName, options) + if err != nil { + return HypervMachinesControllerClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return HypervMachinesControllerClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return HypervMachinesControllerClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *HypervMachinesControllerClient) getCreateRequest(ctx context.Context, resourceGroupName string, siteName string, machineName string, options *HypervMachinesControllerClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/hypervSites/{siteName}/machines/{machineName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if machineName == "" { + return nil, errors.New("parameter machineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{machineName}", url.PathEscape(machineName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *HypervMachinesControllerClient) getHandleResponse(resp *http.Response) (HypervMachinesControllerClientGetResponse, error) { + result := HypervMachinesControllerClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.HypervMachine); err != nil { + return HypervMachinesControllerClientGetResponse{}, err + } + return result, nil +} + +// NewListByHypervSitePager - List HypervMachine resources by HypervSite +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - options - HypervMachinesControllerClientListByHypervSiteOptions contains the optional parameters for the HypervMachinesControllerClient.NewListByHypervSitePager +// method. +func (client *HypervMachinesControllerClient) NewListByHypervSitePager(resourceGroupName string, siteName string, options *HypervMachinesControllerClientListByHypervSiteOptions) *runtime.Pager[HypervMachinesControllerClientListByHypervSiteResponse] { + return runtime.NewPager(runtime.PagingHandler[HypervMachinesControllerClientListByHypervSiteResponse]{ + More: func(page HypervMachinesControllerClientListByHypervSiteResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *HypervMachinesControllerClientListByHypervSiteResponse) (HypervMachinesControllerClientListByHypervSiteResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "HypervMachinesControllerClient.NewListByHypervSitePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByHypervSiteCreateRequest(ctx, resourceGroupName, siteName, options) + }, nil) + if err != nil { + return HypervMachinesControllerClientListByHypervSiteResponse{}, err + } + return client.listByHypervSiteHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByHypervSiteCreateRequest creates the ListByHypervSite request. +func (client *HypervMachinesControllerClient) listByHypervSiteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *HypervMachinesControllerClientListByHypervSiteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/hypervSites/{siteName}/machines" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + if options != nil && options.Filter != nil { + reqQP.Set("filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.ContinuationToken != nil { + reqQP.Set("continuationToken", *options.ContinuationToken) + } + if options != nil && options.TotalRecordCount != nil { + reqQP.Set("totalRecordCount", strconv.FormatInt(int64(*options.TotalRecordCount), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByHypervSiteHandleResponse handles the ListByHypervSite response. +func (client *HypervMachinesControllerClient) listByHypervSiteHandleResponse(resp *http.Response) (HypervMachinesControllerClientListByHypervSiteResponse, error) { + result := HypervMachinesControllerClientListByHypervSiteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.HypervMachineListResult); err != nil { + return HypervMachinesControllerClientListByHypervSiteResponse{}, err + } + return result, nil +} + +// Update - Update a HypervMachine +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - machineName - HypervMachine name +// - body - The resource properties to be updated. +// - options - HypervMachinesControllerClientUpdateOptions contains the optional parameters for the HypervMachinesControllerClient.Update +// method. +func (client *HypervMachinesControllerClient) Update(ctx context.Context, resourceGroupName string, siteName string, machineName string, body HypervMachineUpdate, options *HypervMachinesControllerClientUpdateOptions) (HypervMachinesControllerClientUpdateResponse, error) { + var err error + const operationName = "HypervMachinesControllerClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, siteName, machineName, body, options) + if err != nil { + return HypervMachinesControllerClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return HypervMachinesControllerClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return HypervMachinesControllerClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *HypervMachinesControllerClient) updateCreateRequest(ctx context.Context, resourceGroupName string, siteName string, machineName string, body HypervMachineUpdate, options *HypervMachinesControllerClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/hypervSites/{siteName}/machines/{machineName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if machineName == "" { + return nil, errors.New("parameter machineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{machineName}", url.PathEscape(machineName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *HypervMachinesControllerClient) updateHandleResponse(resp *http.Response) (HypervMachinesControllerClientUpdateResponse, error) { + result := HypervMachinesControllerClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.HypervMachine); err != nil { + return HypervMachinesControllerClientUpdateResponse{}, err + } + return result, nil +} + +// BeginUpdateProperties - Method to update custom properties for HYPERV machines in a site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - metaData - The content of the action request +// - options - HypervMachinesControllerClientBeginUpdatePropertiesOptions contains the optional parameters for the HypervMachinesControllerClient.BeginUpdateProperties +// method. +func (client *HypervMachinesControllerClient) BeginUpdateProperties(ctx context.Context, resourceGroupName string, siteName string, metaData MachineMetadataCollection, options *HypervMachinesControllerClientBeginUpdatePropertiesOptions) (*runtime.Poller[HypervMachinesControllerClientUpdatePropertiesResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.updateProperties(ctx, resourceGroupName, siteName, metaData, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[HypervMachinesControllerClientUpdatePropertiesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[HypervMachinesControllerClientUpdatePropertiesResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// UpdateProperties - Method to update custom properties for HYPERV machines in a site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *HypervMachinesControllerClient) updateProperties(ctx context.Context, resourceGroupName string, siteName string, metaData MachineMetadataCollection, options *HypervMachinesControllerClientBeginUpdatePropertiesOptions) (*http.Response, error) { + var err error + const operationName = "HypervMachinesControllerClient.BeginUpdateProperties" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updatePropertiesCreateRequest(ctx, resourceGroupName, siteName, metaData, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updatePropertiesCreateRequest creates the UpdateProperties request. +func (client *HypervMachinesControllerClient) updatePropertiesCreateRequest(ctx context.Context, resourceGroupName string, siteName string, metaData MachineMetadataCollection, options *HypervMachinesControllerClientBeginUpdatePropertiesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/hypervSites/{siteName}/updateProperties" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, metaData); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/hypervoperationsstatuscontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/hypervoperationsstatuscontroller_client.go new file mode 100644 index 000000000000..c9eba9f3cb2c --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/hypervoperationsstatuscontroller_client.go @@ -0,0 +1,114 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// HypervOperationsStatusControllerClient contains the methods for the HypervOperationsStatusController group. +// Don't use this type directly, use NewHypervOperationsStatusControllerClient() instead. +type HypervOperationsStatusControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewHypervOperationsStatusControllerClient creates a new instance of HypervOperationsStatusControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewHypervOperationsStatusControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*HypervOperationsStatusControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &HypervOperationsStatusControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// GetHypervOperationsStatus - Method to get operation status. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - operationStatusName - Operation status Arm Name. +// - options - HypervOperationsStatusControllerClientGetHypervOperationsStatusOptions contains the optional parameters for the +// HypervOperationsStatusControllerClient.GetHypervOperationsStatus method. +func (client *HypervOperationsStatusControllerClient) GetHypervOperationsStatus(ctx context.Context, resourceGroupName string, siteName string, operationStatusName string, options *HypervOperationsStatusControllerClientGetHypervOperationsStatusOptions) (HypervOperationsStatusControllerClientGetHypervOperationsStatusResponse, error) { + var err error + const operationName = "HypervOperationsStatusControllerClient.GetHypervOperationsStatus" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getHypervOperationsStatusCreateRequest(ctx, resourceGroupName, siteName, operationStatusName, options) + if err != nil { + return HypervOperationsStatusControllerClientGetHypervOperationsStatusResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return HypervOperationsStatusControllerClientGetHypervOperationsStatusResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return HypervOperationsStatusControllerClientGetHypervOperationsStatusResponse{}, err + } + resp, err := client.getHypervOperationsStatusHandleResponse(httpResp) + return resp, err +} + +// getHypervOperationsStatusCreateRequest creates the GetHypervOperationsStatus request. +func (client *HypervOperationsStatusControllerClient) getHypervOperationsStatusCreateRequest(ctx context.Context, resourceGroupName string, siteName string, operationStatusName string, options *HypervOperationsStatusControllerClientGetHypervOperationsStatusOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/hypervSites/{siteName}/operationsStatus/{operationStatusName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if operationStatusName == "" { + return nil, errors.New("parameter operationStatusName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{operationStatusName}", url.PathEscape(operationStatusName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHypervOperationsStatusHandleResponse handles the GetHypervOperationsStatus response. +func (client *HypervOperationsStatusControllerClient) getHypervOperationsStatusHandleResponse(resp *http.Response) (HypervOperationsStatusControllerClientGetHypervOperationsStatusResponse, error) { + result := HypervOperationsStatusControllerClientGetHypervOperationsStatusResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { + return HypervOperationsStatusControllerClientGetHypervOperationsStatusResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/hypervrunasaccountscontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/hypervrunasaccountscontroller_client.go new file mode 100644 index 000000000000..e386e60e1285 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/hypervrunasaccountscontroller_client.go @@ -0,0 +1,179 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// HypervRunAsAccountsControllerClient contains the methods for the HypervRunAsAccountsController group. +// Don't use this type directly, use NewHypervRunAsAccountsControllerClient() instead. +type HypervRunAsAccountsControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewHypervRunAsAccountsControllerClient creates a new instance of HypervRunAsAccountsControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewHypervRunAsAccountsControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*HypervRunAsAccountsControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &HypervRunAsAccountsControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get a HypervRunAsAccountResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - accountName - RunAsAccounts name +// - options - HypervRunAsAccountsControllerClientGetOptions contains the optional parameters for the HypervRunAsAccountsControllerClient.Get +// method. +func (client *HypervRunAsAccountsControllerClient) Get(ctx context.Context, resourceGroupName string, siteName string, accountName string, options *HypervRunAsAccountsControllerClientGetOptions) (HypervRunAsAccountsControllerClientGetResponse, error) { + var err error + const operationName = "HypervRunAsAccountsControllerClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, siteName, accountName, options) + if err != nil { + return HypervRunAsAccountsControllerClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return HypervRunAsAccountsControllerClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return HypervRunAsAccountsControllerClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *HypervRunAsAccountsControllerClient) getCreateRequest(ctx context.Context, resourceGroupName string, siteName string, accountName string, options *HypervRunAsAccountsControllerClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/hypervSites/{siteName}/runAsAccounts/{accountName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *HypervRunAsAccountsControllerClient) getHandleResponse(resp *http.Response) (HypervRunAsAccountsControllerClientGetResponse, error) { + result := HypervRunAsAccountsControllerClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.HypervRunAsAccountResource); err != nil { + return HypervRunAsAccountsControllerClientGetResponse{}, err + } + return result, nil +} + +// NewListByHypervSitePager - List HypervRunAsAccountResource resources by HypervSite +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - options - HypervRunAsAccountsControllerClientListByHypervSiteOptions contains the optional parameters for the HypervRunAsAccountsControllerClient.NewListByHypervSitePager +// method. +func (client *HypervRunAsAccountsControllerClient) NewListByHypervSitePager(resourceGroupName string, siteName string, options *HypervRunAsAccountsControllerClientListByHypervSiteOptions) *runtime.Pager[HypervRunAsAccountsControllerClientListByHypervSiteResponse] { + return runtime.NewPager(runtime.PagingHandler[HypervRunAsAccountsControllerClientListByHypervSiteResponse]{ + More: func(page HypervRunAsAccountsControllerClientListByHypervSiteResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *HypervRunAsAccountsControllerClientListByHypervSiteResponse) (HypervRunAsAccountsControllerClientListByHypervSiteResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "HypervRunAsAccountsControllerClient.NewListByHypervSitePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByHypervSiteCreateRequest(ctx, resourceGroupName, siteName, options) + }, nil) + if err != nil { + return HypervRunAsAccountsControllerClientListByHypervSiteResponse{}, err + } + return client.listByHypervSiteHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByHypervSiteCreateRequest creates the ListByHypervSite request. +func (client *HypervRunAsAccountsControllerClient) listByHypervSiteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *HypervRunAsAccountsControllerClientListByHypervSiteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/hypervSites/{siteName}/runAsAccounts" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByHypervSiteHandleResponse handles the ListByHypervSite response. +func (client *HypervRunAsAccountsControllerClient) listByHypervSiteHandleResponse(resp *http.Response) (HypervRunAsAccountsControllerClientListByHypervSiteResponse, error) { + result := HypervRunAsAccountsControllerClientListByHypervSiteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.HypervRunAsAccountResourceListResult); err != nil { + return HypervRunAsAccountsControllerClientListByHypervSiteResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/hypervsites_client.go b/sdk/resourcemanager/migrate/armmigrate/hypervsites_client.go new file mode 100644 index 000000000000..939439875d09 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/hypervsites_client.go @@ -0,0 +1,159 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// HypervSitesClient contains the methods for the HypervSites group. +// Don't use this type directly, use NewHypervSitesClient() instead. +type HypervSitesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewHypervSitesClient creates a new instance of HypervSitesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewHypervSitesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*HypervSitesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &HypervSitesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListByResourceGroupPager - Get all the hyperv sites in the subscription. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - HypervSitesClientListByResourceGroupOptions contains the optional parameters for the HypervSitesClient.NewListByResourceGroupPager +// method. +func (client *HypervSitesClient) NewListByResourceGroupPager(resourceGroupName string, options *HypervSitesClientListByResourceGroupOptions) *runtime.Pager[HypervSitesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[HypervSitesClientListByResourceGroupResponse]{ + More: func(page HypervSitesClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *HypervSitesClientListByResourceGroupResponse) (HypervSitesClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "HypervSitesClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return HypervSitesClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *HypervSitesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *HypervSitesClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/hypervSites" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *HypervSitesClient) listByResourceGroupHandleResponse(resp *http.Response) (HypervSitesClientListByResourceGroupResponse, error) { + result := HypervSitesClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.HypervSiteListResult); err != nil { + return HypervSitesClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - Get all the hyperv sites in the subscription. +// +// Generated from API version 2023-10-01-preview +// - options - HypervSitesClientListBySubscriptionOptions contains the optional parameters for the HypervSitesClient.NewListBySubscriptionPager +// method. +func (client *HypervSitesClient) NewListBySubscriptionPager(options *HypervSitesClientListBySubscriptionOptions) *runtime.Pager[HypervSitesClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[HypervSitesClientListBySubscriptionResponse]{ + More: func(page HypervSitesClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *HypervSitesClientListBySubscriptionResponse) (HypervSitesClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "HypervSitesClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return HypervSitesClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *HypervSitesClient) listBySubscriptionCreateRequest(ctx context.Context, options *HypervSitesClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.OffAzure/hypervSites" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *HypervSitesClient) listBySubscriptionHandleResponse(resp *http.Response) (HypervSitesClientListBySubscriptionResponse, error) { + result := HypervSitesClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.HypervSiteListResult); err != nil { + return HypervSitesClientListBySubscriptionResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/hypervsitescontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/hypervsitescontroller_client.go new file mode 100644 index 000000000000..1c0bca6472cc --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/hypervsitescontroller_client.go @@ -0,0 +1,745 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// HypervSitesControllerClient contains the methods for the HypervSitesController group. +// Don't use this type directly, use NewHypervSitesControllerClient() instead. +type HypervSitesControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewHypervSitesControllerClient creates a new instance of HypervSitesControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewHypervSitesControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*HypervSitesControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &HypervSitesControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// ComputeErrorSummary - Method to get site error summary. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - body - The content of the action request +// - options - HypervSitesControllerClientComputeErrorSummaryOptions contains the optional parameters for the HypervSitesControllerClient.ComputeErrorSummary +// method. +func (client *HypervSitesControllerClient) ComputeErrorSummary(ctx context.Context, resourceGroupName string, siteName string, body any, options *HypervSitesControllerClientComputeErrorSummaryOptions) (HypervSitesControllerClientComputeErrorSummaryResponse, error) { + var err error + const operationName = "HypervSitesControllerClient.ComputeErrorSummary" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.computeErrorSummaryCreateRequest(ctx, resourceGroupName, siteName, body, options) + if err != nil { + return HypervSitesControllerClientComputeErrorSummaryResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return HypervSitesControllerClientComputeErrorSummaryResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return HypervSitesControllerClientComputeErrorSummaryResponse{}, err + } + resp, err := client.computeErrorSummaryHandleResponse(httpResp) + return resp, err +} + +// computeErrorSummaryCreateRequest creates the ComputeErrorSummary request. +func (client *HypervSitesControllerClient) computeErrorSummaryCreateRequest(ctx context.Context, resourceGroupName string, siteName string, body any, options *HypervSitesControllerClientComputeErrorSummaryOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/hypervSites/{siteName}/computeErrorSummary" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// computeErrorSummaryHandleResponse handles the ComputeErrorSummary response. +func (client *HypervSitesControllerClient) computeErrorSummaryHandleResponse(resp *http.Response) (HypervSitesControllerClientComputeErrorSummaryResponse, error) { + result := HypervSitesControllerClientComputeErrorSummaryResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SiteErrorSummary); err != nil { + return HypervSitesControllerClientComputeErrorSummaryResponse{}, err + } + return result, nil +} + +// Computeusage - Get a hyperv site usage. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - body - The content of the action request +// - options - HypervSitesControllerClientComputeusageOptions contains the optional parameters for the HypervSitesControllerClient.Computeusage +// method. +func (client *HypervSitesControllerClient) Computeusage(ctx context.Context, resourceGroupName string, siteName string, body any, options *HypervSitesControllerClientComputeusageOptions) (HypervSitesControllerClientComputeusageResponse, error) { + var err error + const operationName = "HypervSitesControllerClient.Computeusage" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.computeusageCreateRequest(ctx, resourceGroupName, siteName, body, options) + if err != nil { + return HypervSitesControllerClientComputeusageResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return HypervSitesControllerClientComputeusageResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return HypervSitesControllerClientComputeusageResponse{}, err + } + resp, err := client.computeusageHandleResponse(httpResp) + return resp, err +} + +// computeusageCreateRequest creates the Computeusage request. +func (client *HypervSitesControllerClient) computeusageCreateRequest(ctx context.Context, resourceGroupName string, siteName string, body any, options *HypervSitesControllerClientComputeusageOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/hypervSites/{siteName}/computeusage" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// computeusageHandleResponse handles the Computeusage response. +func (client *HypervSitesControllerClient) computeusageHandleResponse(resp *http.Response) (HypervSitesControllerClientComputeusageResponse, error) { + result := HypervSitesControllerClientComputeusageResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.HypervSiteUsage); err != nil { + return HypervSitesControllerClientComputeusageResponse{}, err + } + return result, nil +} + +// Create - Create a HypervSite +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - body - Resource create parameters. +// - options - HypervSitesControllerClientCreateOptions contains the optional parameters for the HypervSitesControllerClient.Create +// method. +func (client *HypervSitesControllerClient) Create(ctx context.Context, resourceGroupName string, siteName string, body HypervSite, options *HypervSitesControllerClientCreateOptions) (HypervSitesControllerClientCreateResponse, error) { + var err error + const operationName = "HypervSitesControllerClient.Create" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, siteName, body, options) + if err != nil { + return HypervSitesControllerClientCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return HypervSitesControllerClientCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return HypervSitesControllerClientCreateResponse{}, err + } + resp, err := client.createHandleResponse(httpResp) + return resp, err +} + +// createCreateRequest creates the Create request. +func (client *HypervSitesControllerClient) createCreateRequest(ctx context.Context, resourceGroupName string, siteName string, body HypervSite, options *HypervSitesControllerClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/hypervSites/{siteName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *HypervSitesControllerClient) createHandleResponse(resp *http.Response) (HypervSitesControllerClientCreateResponse, error) { + result := HypervSitesControllerClientCreateResponse{} + if val := resp.Header.Get("Retry-After"); val != "" { + retryAfter32, err := strconv.ParseInt(val, 10, 32) + retryAfter := int32(retryAfter32) + if err != nil { + return HypervSitesControllerClientCreateResponse{}, err + } + result.RetryAfter = &retryAfter + } + if err := runtime.UnmarshalAsJSON(resp, &result.HypervSite); err != nil { + return HypervSitesControllerClientCreateResponse{}, err + } + return result, nil +} + +// Delete - Delete a HypervSite +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - options - HypervSitesControllerClientDeleteOptions contains the optional parameters for the HypervSitesControllerClient.Delete +// method. +func (client *HypervSitesControllerClient) Delete(ctx context.Context, resourceGroupName string, siteName string, options *HypervSitesControllerClientDeleteOptions) (HypervSitesControllerClientDeleteResponse, error) { + var err error + const operationName = "HypervSitesControllerClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, siteName, options) + if err != nil { + return HypervSitesControllerClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return HypervSitesControllerClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return HypervSitesControllerClientDeleteResponse{}, err + } + return HypervSitesControllerClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *HypervSitesControllerClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *HypervSitesControllerClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/hypervSites/{siteName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginExportApplications - Method to generate report containing machine and the deep discovery of the application installed +// in the machine. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - body - The content of the action request +// - options - HypervSitesControllerClientBeginExportApplicationsOptions contains the optional parameters for the HypervSitesControllerClient.BeginExportApplications +// method. +func (client *HypervSitesControllerClient) BeginExportApplications(ctx context.Context, resourceGroupName string, siteName string, body any, options *HypervSitesControllerClientBeginExportApplicationsOptions) (*runtime.Poller[HypervSitesControllerClientExportApplicationsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.exportApplications(ctx, resourceGroupName, siteName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[HypervSitesControllerClientExportApplicationsResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[HypervSitesControllerClientExportApplicationsResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ExportApplications - Method to generate report containing machine and the deep discovery of the application installed in +// the machine. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *HypervSitesControllerClient) exportApplications(ctx context.Context, resourceGroupName string, siteName string, body any, options *HypervSitesControllerClientBeginExportApplicationsOptions) (*http.Response, error) { + var err error + const operationName = "HypervSitesControllerClient.BeginExportApplications" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.exportApplicationsCreateRequest(ctx, resourceGroupName, siteName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// exportApplicationsCreateRequest creates the ExportApplications request. +func (client *HypervSitesControllerClient) exportApplicationsCreateRequest(ctx context.Context, resourceGroupName string, siteName string, body any, options *HypervSitesControllerClientBeginExportApplicationsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/hypervSites/{siteName}/exportApplications" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// BeginExportMachineErrors - Method to generate report containing machine and the errors encountered during guest discovery +// of the machine. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - body - The content of the action request +// - options - HypervSitesControllerClientBeginExportMachineErrorsOptions contains the optional parameters for the HypervSitesControllerClient.BeginExportMachineErrors +// method. +func (client *HypervSitesControllerClient) BeginExportMachineErrors(ctx context.Context, resourceGroupName string, siteName string, body ExportMachineErrorsRequest, options *HypervSitesControllerClientBeginExportMachineErrorsOptions) (*runtime.Poller[HypervSitesControllerClientExportMachineErrorsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.exportMachineErrors(ctx, resourceGroupName, siteName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[HypervSitesControllerClientExportMachineErrorsResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[HypervSitesControllerClientExportMachineErrorsResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ExportMachineErrors - Method to generate report containing machine and the errors encountered during guest discovery of +// the machine. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *HypervSitesControllerClient) exportMachineErrors(ctx context.Context, resourceGroupName string, siteName string, body ExportMachineErrorsRequest, options *HypervSitesControllerClientBeginExportMachineErrorsOptions) (*http.Response, error) { + var err error + const operationName = "HypervSitesControllerClient.BeginExportMachineErrors" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.exportMachineErrorsCreateRequest(ctx, resourceGroupName, siteName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// exportMachineErrorsCreateRequest creates the ExportMachineErrors request. +func (client *HypervSitesControllerClient) exportMachineErrorsCreateRequest(ctx context.Context, resourceGroupName string, siteName string, body ExportMachineErrorsRequest, options *HypervSitesControllerClientBeginExportMachineErrorsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/hypervSites/{siteName}/exportMachineErrors" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// Get - Get a HypervSite +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - options - HypervSitesControllerClientGetOptions contains the optional parameters for the HypervSitesControllerClient.Get +// method. +func (client *HypervSitesControllerClient) Get(ctx context.Context, resourceGroupName string, siteName string, options *HypervSitesControllerClientGetOptions) (HypervSitesControllerClientGetResponse, error) { + var err error + const operationName = "HypervSitesControllerClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, siteName, options) + if err != nil { + return HypervSitesControllerClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return HypervSitesControllerClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return HypervSitesControllerClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *HypervSitesControllerClient) getCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *HypervSitesControllerClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/hypervSites/{siteName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *HypervSitesControllerClient) getHandleResponse(resp *http.Response) (HypervSitesControllerClientGetResponse, error) { + result := HypervSitesControllerClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.HypervSite); err != nil { + return HypervSitesControllerClientGetResponse{}, err + } + return result, nil +} + +// ListHealthSummary - Method to get site health summary. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - options - HypervSitesControllerClientListHealthSummaryOptions contains the optional parameters for the HypervSitesControllerClient.ListHealthSummary +// method. +func (client *HypervSitesControllerClient) ListHealthSummary(ctx context.Context, resourceGroupName string, siteName string, options *HypervSitesControllerClientListHealthSummaryOptions) (HypervSitesControllerClientListHealthSummaryResponse, error) { + var err error + const operationName = "HypervSitesControllerClient.ListHealthSummary" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listHealthSummaryCreateRequest(ctx, resourceGroupName, siteName, options) + if err != nil { + return HypervSitesControllerClientListHealthSummaryResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return HypervSitesControllerClientListHealthSummaryResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return HypervSitesControllerClientListHealthSummaryResponse{}, err + } + resp, err := client.listHealthSummaryHandleResponse(httpResp) + return resp, err +} + +// listHealthSummaryCreateRequest creates the ListHealthSummary request. +func (client *HypervSitesControllerClient) listHealthSummaryCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *HypervSitesControllerClientListHealthSummaryOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/hypervSites/{siteName}/listHealthSummary" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHealthSummaryHandleResponse handles the ListHealthSummary response. +func (client *HypervSitesControllerClient) listHealthSummaryHandleResponse(resp *http.Response) (HypervSitesControllerClientListHealthSummaryResponse, error) { + result := HypervSitesControllerClientListHealthSummaryResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SiteHealthSummaryCollection); err != nil { + return HypervSitesControllerClientListHealthSummaryResponse{}, err + } + return result, nil +} + +// Summary - Method to get site usage. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - options - HypervSitesControllerClientSummaryOptions contains the optional parameters for the HypervSitesControllerClient.Summary +// method. +func (client *HypervSitesControllerClient) Summary(ctx context.Context, resourceGroupName string, siteName string, options *HypervSitesControllerClientSummaryOptions) (HypervSitesControllerClientSummaryResponse, error) { + var err error + const operationName = "HypervSitesControllerClient.Summary" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.summaryCreateRequest(ctx, resourceGroupName, siteName, options) + if err != nil { + return HypervSitesControllerClientSummaryResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return HypervSitesControllerClientSummaryResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return HypervSitesControllerClientSummaryResponse{}, err + } + resp, err := client.summaryHandleResponse(httpResp) + return resp, err +} + +// summaryCreateRequest creates the Summary request. +func (client *HypervSitesControllerClient) summaryCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *HypervSitesControllerClientSummaryOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/hypervSites/{siteName}/summary" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// summaryHandleResponse handles the Summary response. +func (client *HypervSitesControllerClient) summaryHandleResponse(resp *http.Response) (HypervSitesControllerClientSummaryResponse, error) { + result := HypervSitesControllerClientSummaryResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.HypervSiteUsage); err != nil { + return HypervSitesControllerClientSummaryResponse{}, err + } + return result, nil +} + +// Update - Update a HypervSite +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - body - The resource properties to be updated. +// - options - HypervSitesControllerClientUpdateOptions contains the optional parameters for the HypervSitesControllerClient.Update +// method. +func (client *HypervSitesControllerClient) Update(ctx context.Context, resourceGroupName string, siteName string, body HypervSiteUpdate, options *HypervSitesControllerClientUpdateOptions) (HypervSitesControllerClientUpdateResponse, error) { + var err error + const operationName = "HypervSitesControllerClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, siteName, body, options) + if err != nil { + return HypervSitesControllerClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return HypervSitesControllerClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return HypervSitesControllerClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *HypervSitesControllerClient) updateCreateRequest(ctx context.Context, resourceGroupName string, siteName string, body HypervSiteUpdate, options *HypervSitesControllerClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/hypervSites/{siteName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *HypervSitesControllerClient) updateHandleResponse(resp *http.Response) (HypervSitesControllerClientUpdateResponse, error) { + result := HypervSitesControllerClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.HypervSite); err != nil { + return HypervSitesControllerClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/hypervsoftwareinventoriescontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/hypervsoftwareinventoriescontroller_client.go new file mode 100644 index 000000000000..21119aa772dd --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/hypervsoftwareinventoriescontroller_client.go @@ -0,0 +1,189 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// HypervSoftwareInventoriesControllerClient contains the methods for the HypervSoftwareInventoriesController group. +// Don't use this type directly, use NewHypervSoftwareInventoriesControllerClient() instead. +type HypervSoftwareInventoriesControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewHypervSoftwareInventoriesControllerClient creates a new instance of HypervSoftwareInventoriesControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewHypervSoftwareInventoriesControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*HypervSoftwareInventoriesControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &HypervSoftwareInventoriesControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// GetMachineSoftwareInventory - Method to get a machines software inventory like applications and roles. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - machineName - HypervMachine name +// - defaultParam - Default value. +// - options - HypervSoftwareInventoriesControllerClientGetMachineSoftwareInventoryOptions contains the optional parameters +// for the HypervSoftwareInventoriesControllerClient.GetMachineSoftwareInventory method. +func (client *HypervSoftwareInventoriesControllerClient) GetMachineSoftwareInventory(ctx context.Context, resourceGroupName string, siteName string, machineName string, defaultParam Default, options *HypervSoftwareInventoriesControllerClientGetMachineSoftwareInventoryOptions) (HypervSoftwareInventoriesControllerClientGetMachineSoftwareInventoryResponse, error) { + var err error + const operationName = "HypervSoftwareInventoriesControllerClient.GetMachineSoftwareInventory" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getMachineSoftwareInventoryCreateRequest(ctx, resourceGroupName, siteName, machineName, defaultParam, options) + if err != nil { + return HypervSoftwareInventoriesControllerClientGetMachineSoftwareInventoryResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return HypervSoftwareInventoriesControllerClientGetMachineSoftwareInventoryResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return HypervSoftwareInventoriesControllerClientGetMachineSoftwareInventoryResponse{}, err + } + resp, err := client.getMachineSoftwareInventoryHandleResponse(httpResp) + return resp, err +} + +// getMachineSoftwareInventoryCreateRequest creates the GetMachineSoftwareInventory request. +func (client *HypervSoftwareInventoriesControllerClient) getMachineSoftwareInventoryCreateRequest(ctx context.Context, resourceGroupName string, siteName string, machineName string, defaultParam Default, options *HypervSoftwareInventoriesControllerClientGetMachineSoftwareInventoryOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/hypervSites/{siteName}/machines/{machineName}/softwareInventories/{default}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if machineName == "" { + return nil, errors.New("parameter machineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{machineName}", url.PathEscape(machineName)) + if defaultParam == "" { + return nil, errors.New("parameter defaultParam cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{default}", url.PathEscape(string(defaultParam))) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getMachineSoftwareInventoryHandleResponse handles the GetMachineSoftwareInventory response. +func (client *HypervSoftwareInventoriesControllerClient) getMachineSoftwareInventoryHandleResponse(resp *http.Response) (HypervSoftwareInventoriesControllerClientGetMachineSoftwareInventoryResponse, error) { + result := HypervSoftwareInventoriesControllerClientGetMachineSoftwareInventoryResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.HypervVMSoftwareInventory); err != nil { + return HypervSoftwareInventoriesControllerClientGetMachineSoftwareInventoryResponse{}, err + } + return result, nil +} + +// NewListByHypervMachinePager - List HypervVmSoftwareInventory resources by HypervMachine +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - machineName - HypervMachine name +// - options - HypervSoftwareInventoriesControllerClientListByHypervMachineOptions contains the optional parameters for the +// HypervSoftwareInventoriesControllerClient.NewListByHypervMachinePager method. +func (client *HypervSoftwareInventoriesControllerClient) NewListByHypervMachinePager(resourceGroupName string, siteName string, machineName string, options *HypervSoftwareInventoriesControllerClientListByHypervMachineOptions) *runtime.Pager[HypervSoftwareInventoriesControllerClientListByHypervMachineResponse] { + return runtime.NewPager(runtime.PagingHandler[HypervSoftwareInventoriesControllerClientListByHypervMachineResponse]{ + More: func(page HypervSoftwareInventoriesControllerClientListByHypervMachineResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *HypervSoftwareInventoriesControllerClientListByHypervMachineResponse) (HypervSoftwareInventoriesControllerClientListByHypervMachineResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "HypervSoftwareInventoriesControllerClient.NewListByHypervMachinePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByHypervMachineCreateRequest(ctx, resourceGroupName, siteName, machineName, options) + }, nil) + if err != nil { + return HypervSoftwareInventoriesControllerClientListByHypervMachineResponse{}, err + } + return client.listByHypervMachineHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByHypervMachineCreateRequest creates the ListByHypervMachine request. +func (client *HypervSoftwareInventoriesControllerClient) listByHypervMachineCreateRequest(ctx context.Context, resourceGroupName string, siteName string, machineName string, options *HypervSoftwareInventoriesControllerClientListByHypervMachineOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/hypervSites/{siteName}/machines/{machineName}/softwareinventories" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if machineName == "" { + return nil, errors.New("parameter machineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{machineName}", url.PathEscape(machineName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByHypervMachineHandleResponse handles the ListByHypervMachine response. +func (client *HypervSoftwareInventoriesControllerClient) listByHypervMachineHandleResponse(resp *http.Response) (HypervSoftwareInventoriesControllerClientListByHypervMachineResponse, error) { + result := HypervSoftwareInventoriesControllerClientListByHypervMachineResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.HypervVMSoftwareInventoryListResult); err != nil { + return HypervSoftwareInventoriesControllerClientListByHypervMachineResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/iiswebapplicationscontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/iiswebapplicationscontroller_client.go new file mode 100644 index 000000000000..0e9bab839de2 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/iiswebapplicationscontroller_client.go @@ -0,0 +1,281 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// IisWebApplicationsControllerClient contains the methods for the IisWebApplicationsController group. +// Don't use this type directly, use NewIisWebApplicationsControllerClient() instead. +type IisWebApplicationsControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewIisWebApplicationsControllerClient creates a new instance of IisWebApplicationsControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewIisWebApplicationsControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*IisWebApplicationsControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &IisWebApplicationsControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Method to get an IIS web application. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - webAppSiteName - Web app site name. +// - webApplicationName - Web application name. +// - options - IisWebApplicationsControllerClientGetOptions contains the optional parameters for the IisWebApplicationsControllerClient.Get +// method. +func (client *IisWebApplicationsControllerClient) Get(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, webApplicationName string, options *IisWebApplicationsControllerClientGetOptions) (IisWebApplicationsControllerClientGetResponse, error) { + var err error + const operationName = "IisWebApplicationsControllerClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, siteName, webAppSiteName, webApplicationName, options) + if err != nil { + return IisWebApplicationsControllerClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return IisWebApplicationsControllerClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return IisWebApplicationsControllerClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *IisWebApplicationsControllerClient) getCreateRequest(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, webApplicationName string, options *IisWebApplicationsControllerClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/webAppSites/{webAppSiteName}/iisWebApplications/{webApplicationName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if webAppSiteName == "" { + return nil, errors.New("parameter webAppSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{webAppSiteName}", url.PathEscape(webAppSiteName)) + if webApplicationName == "" { + return nil, errors.New("parameter webApplicationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{webApplicationName}", url.PathEscape(webApplicationName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *IisWebApplicationsControllerClient) getHandleResponse(resp *http.Response) (IisWebApplicationsControllerClientGetResponse, error) { + result := IisWebApplicationsControllerClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.IisWebApplications); err != nil { + return IisWebApplicationsControllerClientGetResponse{}, err + } + return result, nil +} + +// NewListByWebAppSitePager - Method to get all IIS web application. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - webAppSiteName - Web app site name. +// - options - IisWebApplicationsControllerClientListByWebAppSiteOptions contains the optional parameters for the IisWebApplicationsControllerClient.NewListByWebAppSitePager +// method. +func (client *IisWebApplicationsControllerClient) NewListByWebAppSitePager(resourceGroupName string, siteName string, webAppSiteName string, options *IisWebApplicationsControllerClientListByWebAppSiteOptions) *runtime.Pager[IisWebApplicationsControllerClientListByWebAppSiteResponse] { + return runtime.NewPager(runtime.PagingHandler[IisWebApplicationsControllerClientListByWebAppSiteResponse]{ + More: func(page IisWebApplicationsControllerClientListByWebAppSiteResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *IisWebApplicationsControllerClientListByWebAppSiteResponse) (IisWebApplicationsControllerClientListByWebAppSiteResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "IisWebApplicationsControllerClient.NewListByWebAppSitePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByWebAppSiteCreateRequest(ctx, resourceGroupName, siteName, webAppSiteName, options) + }, nil) + if err != nil { + return IisWebApplicationsControllerClientListByWebAppSiteResponse{}, err + } + return client.listByWebAppSiteHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByWebAppSiteCreateRequest creates the ListByWebAppSite request. +func (client *IisWebApplicationsControllerClient) listByWebAppSiteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, options *IisWebApplicationsControllerClientListByWebAppSiteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/webAppSites/{webAppSiteName}/iisWebApplications" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if webAppSiteName == "" { + return nil, errors.New("parameter webAppSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{webAppSiteName}", url.PathEscape(webAppSiteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + if options != nil && options.Filter != nil { + reqQP.Set("filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("top", *options.Top) + } + if options != nil && options.ContinuationToken != nil { + reqQP.Set("continuationToken", *options.ContinuationToken) + } + if options != nil && options.TotalRecordCount != nil { + reqQP.Set("totalRecordCount", strconv.FormatInt(int64(*options.TotalRecordCount), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByWebAppSiteHandleResponse handles the ListByWebAppSite response. +func (client *IisWebApplicationsControllerClient) listByWebAppSiteHandleResponse(resp *http.Response) (IisWebApplicationsControllerClientListByWebAppSiteResponse, error) { + result := IisWebApplicationsControllerClientListByWebAppSiteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.IisWebApplicationsListResult); err != nil { + return IisWebApplicationsControllerClientListByWebAppSiteResponse{}, err + } + return result, nil +} + +// Update - Method to update tags on IIS web application. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - webAppSiteName - Web app site name. +// - webApplicationName - Web application name. +// - body - The resource properties to be updated. +// - options - IisWebApplicationsControllerClientUpdateOptions contains the optional parameters for the IisWebApplicationsControllerClient.Update +// method. +func (client *IisWebApplicationsControllerClient) Update(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, webApplicationName string, body IisWebApplicationsUpdate, options *IisWebApplicationsControllerClientUpdateOptions) (IisWebApplicationsControllerClientUpdateResponse, error) { + var err error + const operationName = "IisWebApplicationsControllerClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, siteName, webAppSiteName, webApplicationName, body, options) + if err != nil { + return IisWebApplicationsControllerClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return IisWebApplicationsControllerClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return IisWebApplicationsControllerClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *IisWebApplicationsControllerClient) updateCreateRequest(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, webApplicationName string, body IisWebApplicationsUpdate, options *IisWebApplicationsControllerClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/webAppSites/{webAppSiteName}/iisWebApplications/{webApplicationName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if webAppSiteName == "" { + return nil, errors.New("parameter webAppSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{webAppSiteName}", url.PathEscape(webAppSiteName)) + if webApplicationName == "" { + return nil, errors.New("parameter webApplicationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{webApplicationName}", url.PathEscape(webApplicationName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *IisWebApplicationsControllerClient) updateHandleResponse(resp *http.Response) (IisWebApplicationsControllerClientUpdateResponse, error) { + result := IisWebApplicationsControllerClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.IisWebApplications); err != nil { + return IisWebApplicationsControllerClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/iiswebserverscontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/iiswebserverscontroller_client.go new file mode 100644 index 000000000000..d9406e5ac2a9 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/iiswebserverscontroller_client.go @@ -0,0 +1,202 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// IisWebServersControllerClient contains the methods for the IisWebServersController group. +// Don't use this type directly, use NewIisWebServersControllerClient() instead. +type IisWebServersControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewIisWebServersControllerClient creates a new instance of IisWebServersControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewIisWebServersControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*IisWebServersControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &IisWebServersControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Method to get an IIS web server. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - webAppSiteName - Web app site name. +// - webServerName - Web server name. +// - options - IisWebServersControllerClientGetOptions contains the optional parameters for the IisWebServersControllerClient.Get +// method. +func (client *IisWebServersControllerClient) Get(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, webServerName string, options *IisWebServersControllerClientGetOptions) (IisWebServersControllerClientGetResponse, error) { + var err error + const operationName = "IisWebServersControllerClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, siteName, webAppSiteName, webServerName, options) + if err != nil { + return IisWebServersControllerClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return IisWebServersControllerClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return IisWebServersControllerClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *IisWebServersControllerClient) getCreateRequest(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, webServerName string, options *IisWebServersControllerClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/webAppSites/{webAppSiteName}/iisWebServers/{webServerName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if webAppSiteName == "" { + return nil, errors.New("parameter webAppSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{webAppSiteName}", url.PathEscape(webAppSiteName)) + if webServerName == "" { + return nil, errors.New("parameter webServerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{webServerName}", url.PathEscape(webServerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *IisWebServersControllerClient) getHandleResponse(resp *http.Response) (IisWebServersControllerClientGetResponse, error) { + result := IisWebServersControllerClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.IisWebServers); err != nil { + return IisWebServersControllerClientGetResponse{}, err + } + return result, nil +} + +// NewListByWebAppSitePager - Method to get all IIS web servers. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - webAppSiteName - Web app site name. +// - options - IisWebServersControllerClientListByWebAppSiteOptions contains the optional parameters for the IisWebServersControllerClient.NewListByWebAppSitePager +// method. +func (client *IisWebServersControllerClient) NewListByWebAppSitePager(resourceGroupName string, siteName string, webAppSiteName string, options *IisWebServersControllerClientListByWebAppSiteOptions) *runtime.Pager[IisWebServersControllerClientListByWebAppSiteResponse] { + return runtime.NewPager(runtime.PagingHandler[IisWebServersControllerClientListByWebAppSiteResponse]{ + More: func(page IisWebServersControllerClientListByWebAppSiteResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *IisWebServersControllerClientListByWebAppSiteResponse) (IisWebServersControllerClientListByWebAppSiteResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "IisWebServersControllerClient.NewListByWebAppSitePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByWebAppSiteCreateRequest(ctx, resourceGroupName, siteName, webAppSiteName, options) + }, nil) + if err != nil { + return IisWebServersControllerClientListByWebAppSiteResponse{}, err + } + return client.listByWebAppSiteHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByWebAppSiteCreateRequest creates the ListByWebAppSite request. +func (client *IisWebServersControllerClient) listByWebAppSiteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, options *IisWebServersControllerClientListByWebAppSiteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/webAppSites/{webAppSiteName}/iisWebServers" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if webAppSiteName == "" { + return nil, errors.New("parameter webAppSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{webAppSiteName}", url.PathEscape(webAppSiteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + if options != nil && options.Filter != nil { + reqQP.Set("filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("top", *options.Top) + } + if options != nil && options.ContinuationToken != nil { + reqQP.Set("continuationToken", *options.ContinuationToken) + } + if options != nil && options.TotalRecordCount != nil { + reqQP.Set("totalRecordCount", strconv.FormatInt(int64(*options.TotalRecordCount), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByWebAppSiteHandleResponse handles the ListByWebAppSite response. +func (client *IisWebServersControllerClient) listByWebAppSiteHandleResponse(resp *http.Response) (IisWebServersControllerClientListByWebAppSiteResponse, error) { + result := IisWebServersControllerClientListByWebAppSiteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.IisWebServersListResult); err != nil { + return IisWebServersControllerClientListByWebAppSiteResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/importcollectors_client.go b/sdk/resourcemanager/migrate/armmigrate/importcollectors_client.go deleted file mode 100644 index 24dced0ce8df..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/importcollectors_client.go +++ /dev/null @@ -1,332 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmigrate - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// ImportCollectorsClient contains the methods for the ImportCollectors group. -// Don't use this type directly, use NewImportCollectorsClient() instead. -type ImportCollectorsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewImportCollectorsClient creates a new instance of ImportCollectorsClient with the specified values. -// - subscriptionID - Azure Subscription Id in which project was created. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewImportCollectorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ImportCollectorsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ImportCollectorsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Create - Create or Update Import collector -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - importCollectorName - Unique name of a Import collector within a project. -// - options - ImportCollectorsClientCreateOptions contains the optional parameters for the ImportCollectorsClient.Create method. -func (client *ImportCollectorsClient) Create(ctx context.Context, resourceGroupName string, projectName string, importCollectorName string, options *ImportCollectorsClientCreateOptions) (ImportCollectorsClientCreateResponse, error) { - var err error - const operationName = "ImportCollectorsClient.Create" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createCreateRequest(ctx, resourceGroupName, projectName, importCollectorName, options) - if err != nil { - return ImportCollectorsClientCreateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ImportCollectorsClientCreateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return ImportCollectorsClientCreateResponse{}, err - } - resp, err := client.createHandleResponse(httpResp) - return resp, err -} - -// createCreateRequest creates the Create request. -func (client *ImportCollectorsClient) createCreateRequest(ctx context.Context, resourceGroupName string, projectName string, importCollectorName string, options *ImportCollectorsClientCreateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/importcollectors/{importCollectorName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if importCollectorName == "" { - return nil, errors.New("parameter importCollectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{importCollectorName}", url.PathEscape(importCollectorName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.CollectorBody != nil { - if err := runtime.MarshalAsJSON(req, *options.CollectorBody); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// createHandleResponse handles the Create response. -func (client *ImportCollectorsClient) createHandleResponse(resp *http.Response) (ImportCollectorsClientCreateResponse, error) { - result := ImportCollectorsClientCreateResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.ImportCollector); err != nil { - return ImportCollectorsClientCreateResponse{}, err - } - return result, nil -} - -// Delete - Delete a Import collector from the project. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - importCollectorName - Unique name of a Import collector within a project. -// - options - ImportCollectorsClientDeleteOptions contains the optional parameters for the ImportCollectorsClient.Delete method. -func (client *ImportCollectorsClient) Delete(ctx context.Context, resourceGroupName string, projectName string, importCollectorName string, options *ImportCollectorsClientDeleteOptions) (ImportCollectorsClientDeleteResponse, error) { - var err error - const operationName = "ImportCollectorsClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, projectName, importCollectorName, options) - if err != nil { - return ImportCollectorsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ImportCollectorsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return ImportCollectorsClientDeleteResponse{}, err - } - resp, err := client.deleteHandleResponse(httpResp) - return resp, err -} - -// deleteCreateRequest creates the Delete request. -func (client *ImportCollectorsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, projectName string, importCollectorName string, options *ImportCollectorsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/importcollectors/{importCollectorName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if importCollectorName == "" { - return nil, errors.New("parameter importCollectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{importCollectorName}", url.PathEscape(importCollectorName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// deleteHandleResponse handles the Delete response. -func (client *ImportCollectorsClient) deleteHandleResponse(resp *http.Response) (ImportCollectorsClientDeleteResponse, error) { - result := ImportCollectorsClientDeleteResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - return result, nil -} - -// Get - Get a Import collector. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - importCollectorName - Unique name of a Import collector within a project. -// - options - ImportCollectorsClientGetOptions contains the optional parameters for the ImportCollectorsClient.Get method. -func (client *ImportCollectorsClient) Get(ctx context.Context, resourceGroupName string, projectName string, importCollectorName string, options *ImportCollectorsClientGetOptions) (ImportCollectorsClientGetResponse, error) { - var err error - const operationName = "ImportCollectorsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, importCollectorName, options) - if err != nil { - return ImportCollectorsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ImportCollectorsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ImportCollectorsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ImportCollectorsClient) getCreateRequest(ctx context.Context, resourceGroupName string, projectName string, importCollectorName string, options *ImportCollectorsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/importcollectors/{importCollectorName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if importCollectorName == "" { - return nil, errors.New("parameter importCollectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{importCollectorName}", url.PathEscape(importCollectorName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ImportCollectorsClient) getHandleResponse(resp *http.Response) (ImportCollectorsClientGetResponse, error) { - result := ImportCollectorsClientGetResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.ImportCollector); err != nil { - return ImportCollectorsClientGetResponse{}, err - } - return result, nil -} - -// NewListByProjectPager - Get a list of Import collector. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - options - ImportCollectorsClientListByProjectOptions contains the optional parameters for the ImportCollectorsClient.NewListByProjectPager -// method. -func (client *ImportCollectorsClient) NewListByProjectPager(resourceGroupName string, projectName string, options *ImportCollectorsClientListByProjectOptions) *runtime.Pager[ImportCollectorsClientListByProjectResponse] { - return runtime.NewPager(runtime.PagingHandler[ImportCollectorsClientListByProjectResponse]{ - More: func(page ImportCollectorsClientListByProjectResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *ImportCollectorsClientListByProjectResponse) (ImportCollectorsClientListByProjectResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ImportCollectorsClient.NewListByProjectPager") - req, err := client.listByProjectCreateRequest(ctx, resourceGroupName, projectName, options) - if err != nil { - return ImportCollectorsClientListByProjectResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ImportCollectorsClientListByProjectResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ImportCollectorsClientListByProjectResponse{}, runtime.NewResponseError(resp) - } - return client.listByProjectHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByProjectCreateRequest creates the ListByProject request. -func (client *ImportCollectorsClient) listByProjectCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *ImportCollectorsClientListByProjectOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/importcollectors" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByProjectHandleResponse handles the ListByProject response. -func (client *ImportCollectorsClient) listByProjectHandleResponse(resp *http.Response) (ImportCollectorsClientListByProjectResponse, error) { - result := ImportCollectorsClientListByProjectResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.ImportCollectorList); err != nil { - return ImportCollectorsClientListByProjectResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/importcollectors_client_example_test.go b/sdk/resourcemanager/migrate/armmigrate/importcollectors_client_example_test.go deleted file mode 100644 index d73f1848e233..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/importcollectors_client_example_test.go +++ /dev/null @@ -1,146 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmigrate_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/ImportCollectors_ListByProject.json -func ExampleImportCollectorsClient_NewListByProjectPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewImportCollectorsClient().NewListByProjectPager("markusavstestrg", "rajoshCCY9671project", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ImportCollectorList = armmigrate.ImportCollectorList{ - // Value: []*armmigrate.ImportCollector{ - // { - // Name: to.Ptr("importCollector2951"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/importcollectors"), - // ETag: to.Ptr("\"000098a2-0000-3300-0000-605995620000\""), - // ID: to.Ptr("/subscriptions/31be0ff4-c932-4cb3-8efc-efa411d79280/resourceGroups/markusavstestrg/providers/Microsoft.Migrate/assessmentprojects/rajoshCCY9671project/importcollectors/importCollector2951"), - // Properties: &armmigrate.ImportCollectorProperties{ - // CreatedTimestamp: to.Ptr("2021-02-11T04:46:54.9582099Z"), - // DiscoverySiteID: to.Ptr("/subscriptions/31be0ff4-c932-4cb3-8efc-efa411d79280/resourcegroups/MarkusAVStestRG/providers/microsoft.offazure/importsites/rajoshCCY54cbimportSite"), - // UpdatedTimestamp: to.Ptr("2021-03-23T07:14:42.9238657Z"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/ImportCollectors_Get.json -func ExampleImportCollectorsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewImportCollectorsClient().Get(ctx, "markusavstestrg", "rajoshCCY9671project", "importCollector2951", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ImportCollector = armmigrate.ImportCollector{ - // Name: to.Ptr("importCollector2951"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/importcollectors"), - // ETag: to.Ptr("\"000064a2-0000-3300-0000-605994800000\""), - // ID: to.Ptr("/subscriptions/31be0ff4-c932-4cb3-8efc-efa411d79280/resourceGroups/markusavstestrg/providers/Microsoft.Migrate/assessmentprojects/rajoshCCY9671project/importcollectors/importCollector2951"), - // Properties: &armmigrate.ImportCollectorProperties{ - // CreatedTimestamp: to.Ptr("2021-02-11T04:46:54.9582099Z"), - // DiscoverySiteID: to.Ptr("/subscriptions/31be0ff4-c932-4cb3-8efc-efa411d79280/resourcegroups/MarkusAVStestRG/providers/microsoft.offazure/importsites/rajoshCCY54cbimportSite"), - // UpdatedTimestamp: to.Ptr("2021-03-23T07:10:56.3588497Z"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/ImportCollectors_Create.json -func ExampleImportCollectorsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewImportCollectorsClient().Create(ctx, "markusavstestrg", "rajoshCCY9671project", "importCollector2952", &armmigrate.ImportCollectorsClientCreateOptions{CollectorBody: &armmigrate.ImportCollector{ - Name: to.Ptr("importCollector2951"), - Type: to.Ptr("Microsoft.Migrate/assessmentprojects/importcollectors"), - ETag: to.Ptr("\"000064a2-0000-3300-0000-605994800000\""), - ID: to.Ptr("/subscriptions/31be0ff4-c932-4cb3-8efc-efa411d79280/resourceGroups/markusavstestrg/providers/Microsoft.Migrate/assessmentprojects/rajoshCCY9671project/importcollectors/importCollector2951"), - Properties: &armmigrate.ImportCollectorProperties{ - DiscoverySiteID: to.Ptr("/subscriptions/31be0ff4-c932-4cb3-8efc-efa411d79280/resourcegroups/MarkusAVStestRG/providers/microsoft.offazure/importsites/rajoshCCY54cbimportSite"), - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ImportCollector = armmigrate.ImportCollector{ - // Name: to.Ptr("importCollector2952"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/importcollectors"), - // ETag: to.Ptr("\"0000a7a2-0000-3300-0000-6059964d0000\""), - // ID: to.Ptr("/subscriptions/31be0ff4-c932-4cb3-8efc-efa411d79280/resourceGroups/markusavstestrg/providers/Microsoft.Migrate/assessmentprojects/rajoshCCY9671project/importcollectors/importCollector2952"), - // Properties: &armmigrate.ImportCollectorProperties{ - // CreatedTimestamp: to.Ptr("2021-03-23T07:18:37.2247735Z"), - // DiscoverySiteID: to.Ptr("/subscriptions/31be0ff4-c932-4cb3-8efc-efa411d79280/resourcegroups/MarkusAVStestRG/providers/microsoft.offazure/importsites/rajoshCCY54cbimportSite"), - // UpdatedTimestamp: to.Ptr("2021-03-23T07:18:37.2247735Z"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/ImportCollectors_Delete.json -func ExampleImportCollectorsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewImportCollectorsClient().Delete(ctx, "markusavstestrg", "rajoshCCY9671project", "importCollector2952", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/migrate/armmigrate/importjobscontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/importjobscontroller_client.go new file mode 100644 index 000000000000..232634c44949 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/importjobscontroller_client.go @@ -0,0 +1,584 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ImportJobsControllerClient contains the methods for the ImportJobsController group. +// Don't use this type directly, use NewImportJobsControllerClient() instead. +type ImportJobsControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewImportJobsControllerClient creates a new instance of ImportJobsControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewImportJobsControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ImportJobsControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ImportJobsControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get a ImportJob +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - jobName - Jobs name +// - options - ImportJobsControllerClientGetOptions contains the optional parameters for the ImportJobsControllerClient.Get +// method. +func (client *ImportJobsControllerClient) Get(ctx context.Context, resourceGroupName string, siteName string, jobName string, options *ImportJobsControllerClientGetOptions) (ImportJobsControllerClientGetResponse, error) { + var err error + const operationName = "ImportJobsControllerClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, siteName, jobName, options) + if err != nil { + return ImportJobsControllerClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ImportJobsControllerClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ImportJobsControllerClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ImportJobsControllerClient) getCreateRequest(ctx context.Context, resourceGroupName string, siteName string, jobName string, options *ImportJobsControllerClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/importSites/{siteName}/jobs/{jobName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ImportJobsControllerClient) getHandleResponse(resp *http.Response) (ImportJobsControllerClientGetResponse, error) { + result := ImportJobsControllerClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ImportJob); err != nil { + return ImportJobsControllerClientGetResponse{}, err + } + return result, nil +} + +// GetDeletejob - Gets the delete imported machines job with the given job name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - jobName - Job Arm Name. +// - options - ImportJobsControllerClientGetDeletejobOptions contains the optional parameters for the ImportJobsControllerClient.GetDeletejob +// method. +func (client *ImportJobsControllerClient) GetDeletejob(ctx context.Context, resourceGroupName string, siteName string, jobName string, options *ImportJobsControllerClientGetDeletejobOptions) (ImportJobsControllerClientGetDeletejobResponse, error) { + var err error + const operationName = "ImportJobsControllerClient.GetDeletejob" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getDeletejobCreateRequest(ctx, resourceGroupName, siteName, jobName, options) + if err != nil { + return ImportJobsControllerClientGetDeletejobResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ImportJobsControllerClientGetDeletejobResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ImportJobsControllerClientGetDeletejobResponse{}, err + } + resp, err := client.getDeletejobHandleResponse(httpResp) + return resp, err +} + +// getDeletejobCreateRequest creates the GetDeletejob request. +func (client *ImportJobsControllerClient) getDeletejobCreateRequest(ctx context.Context, resourceGroupName string, siteName string, jobName string, options *ImportJobsControllerClientGetDeletejobOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/importSites/{siteName}/deleteJobs/{jobName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getDeletejobHandleResponse handles the GetDeletejob response. +func (client *ImportJobsControllerClient) getDeletejobHandleResponse(resp *http.Response) (ImportJobsControllerClientGetDeletejobResponse, error) { + result := ImportJobsControllerClientGetDeletejobResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeleteImportMachinesJob); err != nil { + return ImportJobsControllerClientGetDeletejobResponse{}, err + } + return result, nil +} + +// GetExportjob - Gets the export imported machines job with the given job name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - jobName - Job Arm Name. +// - options - ImportJobsControllerClientGetExportjobOptions contains the optional parameters for the ImportJobsControllerClient.GetExportjob +// method. +func (client *ImportJobsControllerClient) GetExportjob(ctx context.Context, resourceGroupName string, siteName string, jobName string, options *ImportJobsControllerClientGetExportjobOptions) (ImportJobsControllerClientGetExportjobResponse, error) { + var err error + const operationName = "ImportJobsControllerClient.GetExportjob" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getExportjobCreateRequest(ctx, resourceGroupName, siteName, jobName, options) + if err != nil { + return ImportJobsControllerClientGetExportjobResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ImportJobsControllerClientGetExportjobResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ImportJobsControllerClientGetExportjobResponse{}, err + } + resp, err := client.getExportjobHandleResponse(httpResp) + return resp, err +} + +// getExportjobCreateRequest creates the GetExportjob request. +func (client *ImportJobsControllerClient) getExportjobCreateRequest(ctx context.Context, resourceGroupName string, siteName string, jobName string, options *ImportJobsControllerClientGetExportjobOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/importSites/{siteName}/exportJobs/{jobName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getExportjobHandleResponse handles the GetExportjob response. +func (client *ImportJobsControllerClient) getExportjobHandleResponse(resp *http.Response) (ImportJobsControllerClientGetExportjobResponse, error) { + result := ImportJobsControllerClientGetExportjobResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExportImportedMachinesJob); err != nil { + return ImportJobsControllerClientGetExportjobResponse{}, err + } + return result, nil +} + +// GetImportjob - Gets the import job with the given job name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - jobName - Job Arm Name. +// - options - ImportJobsControllerClientGetImportjobOptions contains the optional parameters for the ImportJobsControllerClient.GetImportjob +// method. +func (client *ImportJobsControllerClient) GetImportjob(ctx context.Context, resourceGroupName string, siteName string, jobName string, options *ImportJobsControllerClientGetImportjobOptions) (ImportJobsControllerClientGetImportjobResponse, error) { + var err error + const operationName = "ImportJobsControllerClient.GetImportjob" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getImportjobCreateRequest(ctx, resourceGroupName, siteName, jobName, options) + if err != nil { + return ImportJobsControllerClientGetImportjobResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ImportJobsControllerClientGetImportjobResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ImportJobsControllerClientGetImportjobResponse{}, err + } + resp, err := client.getImportjobHandleResponse(httpResp) + return resp, err +} + +// getImportjobCreateRequest creates the GetImportjob request. +func (client *ImportJobsControllerClient) getImportjobCreateRequest(ctx context.Context, resourceGroupName string, siteName string, jobName string, options *ImportJobsControllerClientGetImportjobOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/importSites/{siteName}/importJobs/{jobName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getImportjobHandleResponse handles the GetImportjob response. +func (client *ImportJobsControllerClient) getImportjobHandleResponse(resp *http.Response) (ImportJobsControllerClientGetImportjobResponse, error) { + result := ImportJobsControllerClientGetImportjobResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ImportMachinesJob); err != nil { + return ImportJobsControllerClientGetImportjobResponse{}, err + } + return result, nil +} + +// NewListByImportSitePager - List ImportJob resources by ImportSite +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - options - ImportJobsControllerClientListByImportSiteOptions contains the optional parameters for the ImportJobsControllerClient.NewListByImportSitePager +// method. +func (client *ImportJobsControllerClient) NewListByImportSitePager(resourceGroupName string, siteName string, options *ImportJobsControllerClientListByImportSiteOptions) *runtime.Pager[ImportJobsControllerClientListByImportSiteResponse] { + return runtime.NewPager(runtime.PagingHandler[ImportJobsControllerClientListByImportSiteResponse]{ + More: func(page ImportJobsControllerClientListByImportSiteResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ImportJobsControllerClientListByImportSiteResponse) (ImportJobsControllerClientListByImportSiteResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ImportJobsControllerClient.NewListByImportSitePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByImportSiteCreateRequest(ctx, resourceGroupName, siteName, options) + }, nil) + if err != nil { + return ImportJobsControllerClientListByImportSiteResponse{}, err + } + return client.listByImportSiteHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByImportSiteCreateRequest creates the ListByImportSite request. +func (client *ImportJobsControllerClient) listByImportSiteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *ImportJobsControllerClientListByImportSiteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/importSites/{siteName}/jobs" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByImportSiteHandleResponse handles the ListByImportSite response. +func (client *ImportJobsControllerClient) listByImportSiteHandleResponse(resp *http.Response) (ImportJobsControllerClientListByImportSiteResponse, error) { + result := ImportJobsControllerClientListByImportSiteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ImportJobListResult); err != nil { + return ImportJobsControllerClientListByImportSiteResponse{}, err + } + return result, nil +} + +// NewListDeletejobsPager - Method to get all delete import machines job for the given site. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - options - ImportJobsControllerClientListDeletejobsOptions contains the optional parameters for the ImportJobsControllerClient.NewListDeletejobsPager +// method. +func (client *ImportJobsControllerClient) NewListDeletejobsPager(resourceGroupName string, siteName string, options *ImportJobsControllerClientListDeletejobsOptions) *runtime.Pager[ImportJobsControllerClientListDeletejobsResponse] { + return runtime.NewPager(runtime.PagingHandler[ImportJobsControllerClientListDeletejobsResponse]{ + More: func(page ImportJobsControllerClientListDeletejobsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ImportJobsControllerClientListDeletejobsResponse) (ImportJobsControllerClientListDeletejobsResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ImportJobsControllerClient.NewListDeletejobsPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listDeletejobsCreateRequest(ctx, resourceGroupName, siteName, options) + }, nil) + if err != nil { + return ImportJobsControllerClientListDeletejobsResponse{}, err + } + return client.listDeletejobsHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listDeletejobsCreateRequest creates the ListDeletejobs request. +func (client *ImportJobsControllerClient) listDeletejobsCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *ImportJobsControllerClientListDeletejobsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/importSites/{siteName}/deleteJobs" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listDeletejobsHandleResponse handles the ListDeletejobs response. +func (client *ImportJobsControllerClient) listDeletejobsHandleResponse(resp *http.Response) (ImportJobsControllerClientListDeletejobsResponse, error) { + result := ImportJobsControllerClientListDeletejobsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PagedDeleteImportMachinesJob); err != nil { + return ImportJobsControllerClientListDeletejobsResponse{}, err + } + return result, nil +} + +// NewListExportjobsPager - Method to get all export import machines job for the given site. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - options - ImportJobsControllerClientListExportjobsOptions contains the optional parameters for the ImportJobsControllerClient.NewListExportjobsPager +// method. +func (client *ImportJobsControllerClient) NewListExportjobsPager(resourceGroupName string, siteName string, options *ImportJobsControllerClientListExportjobsOptions) *runtime.Pager[ImportJobsControllerClientListExportjobsResponse] { + return runtime.NewPager(runtime.PagingHandler[ImportJobsControllerClientListExportjobsResponse]{ + More: func(page ImportJobsControllerClientListExportjobsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ImportJobsControllerClientListExportjobsResponse) (ImportJobsControllerClientListExportjobsResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ImportJobsControllerClient.NewListExportjobsPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listExportjobsCreateRequest(ctx, resourceGroupName, siteName, options) + }, nil) + if err != nil { + return ImportJobsControllerClientListExportjobsResponse{}, err + } + return client.listExportjobsHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listExportjobsCreateRequest creates the ListExportjobs request. +func (client *ImportJobsControllerClient) listExportjobsCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *ImportJobsControllerClientListExportjobsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/importSites/{siteName}/exportJobs" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listExportjobsHandleResponse handles the ListExportjobs response. +func (client *ImportJobsControllerClient) listExportjobsHandleResponse(resp *http.Response) (ImportJobsControllerClientListExportjobsResponse, error) { + result := ImportJobsControllerClientListExportjobsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PagedExportImportedMachinesJob); err != nil { + return ImportJobsControllerClientListExportjobsResponse{}, err + } + return result, nil +} + +// NewListImportjobsPager - Method to get all import machines job for the given site. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - options - ImportJobsControllerClientListImportjobsOptions contains the optional parameters for the ImportJobsControllerClient.NewListImportjobsPager +// method. +func (client *ImportJobsControllerClient) NewListImportjobsPager(resourceGroupName string, siteName string, options *ImportJobsControllerClientListImportjobsOptions) *runtime.Pager[ImportJobsControllerClientListImportjobsResponse] { + return runtime.NewPager(runtime.PagingHandler[ImportJobsControllerClientListImportjobsResponse]{ + More: func(page ImportJobsControllerClientListImportjobsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ImportJobsControllerClientListImportjobsResponse) (ImportJobsControllerClientListImportjobsResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ImportJobsControllerClient.NewListImportjobsPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listImportjobsCreateRequest(ctx, resourceGroupName, siteName, options) + }, nil) + if err != nil { + return ImportJobsControllerClientListImportjobsResponse{}, err + } + return client.listImportjobsHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listImportjobsCreateRequest creates the ListImportjobs request. +func (client *ImportJobsControllerClient) listImportjobsCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *ImportJobsControllerClientListImportjobsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/importSites/{siteName}/importJobs" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listImportjobsHandleResponse handles the ListImportjobs response. +func (client *ImportJobsControllerClient) listImportjobsHandleResponse(resp *http.Response) (ImportJobsControllerClientListImportjobsResponse, error) { + result := ImportJobsControllerClientListImportjobsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PagedImportMachinesJob); err != nil { + return ImportJobsControllerClientListImportjobsResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/importmachinescontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/importmachinescontroller_client.go new file mode 100644 index 000000000000..2662766c8220 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/importmachinescontroller_client.go @@ -0,0 +1,252 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// ImportMachinesControllerClient contains the methods for the ImportMachinesController group. +// Don't use this type directly, use NewImportMachinesControllerClient() instead. +type ImportMachinesControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewImportMachinesControllerClient creates a new instance of ImportMachinesControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewImportMachinesControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ImportMachinesControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ImportMachinesControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Delete - Delete a ImportMachine +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - machineName - Machine name +// - options - ImportMachinesControllerClientDeleteOptions contains the optional parameters for the ImportMachinesControllerClient.Delete +// method. +func (client *ImportMachinesControllerClient) Delete(ctx context.Context, resourceGroupName string, siteName string, machineName string, options *ImportMachinesControllerClientDeleteOptions) (ImportMachinesControllerClientDeleteResponse, error) { + var err error + const operationName = "ImportMachinesControllerClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, siteName, machineName, options) + if err != nil { + return ImportMachinesControllerClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ImportMachinesControllerClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return ImportMachinesControllerClientDeleteResponse{}, err + } + return ImportMachinesControllerClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ImportMachinesControllerClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, machineName string, options *ImportMachinesControllerClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/importSites/{siteName}/machines/{machineName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if machineName == "" { + return nil, errors.New("parameter machineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{machineName}", url.PathEscape(machineName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a ImportMachine +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - machineName - Machine name +// - options - ImportMachinesControllerClientGetOptions contains the optional parameters for the ImportMachinesControllerClient.Get +// method. +func (client *ImportMachinesControllerClient) Get(ctx context.Context, resourceGroupName string, siteName string, machineName string, options *ImportMachinesControllerClientGetOptions) (ImportMachinesControllerClientGetResponse, error) { + var err error + const operationName = "ImportMachinesControllerClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, siteName, machineName, options) + if err != nil { + return ImportMachinesControllerClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ImportMachinesControllerClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ImportMachinesControllerClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ImportMachinesControllerClient) getCreateRequest(ctx context.Context, resourceGroupName string, siteName string, machineName string, options *ImportMachinesControllerClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/importSites/{siteName}/machines/{machineName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if machineName == "" { + return nil, errors.New("parameter machineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{machineName}", url.PathEscape(machineName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ImportMachinesControllerClient) getHandleResponse(resp *http.Response) (ImportMachinesControllerClientGetResponse, error) { + result := ImportMachinesControllerClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ImportMachine); err != nil { + return ImportMachinesControllerClientGetResponse{}, err + } + return result, nil +} + +// NewListByImportSitePager - List ImportMachine resources by ImportSite +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - options - ImportMachinesControllerClientListByImportSiteOptions contains the optional parameters for the ImportMachinesControllerClient.NewListByImportSitePager +// method. +func (client *ImportMachinesControllerClient) NewListByImportSitePager(resourceGroupName string, siteName string, options *ImportMachinesControllerClientListByImportSiteOptions) *runtime.Pager[ImportMachinesControllerClientListByImportSiteResponse] { + return runtime.NewPager(runtime.PagingHandler[ImportMachinesControllerClientListByImportSiteResponse]{ + More: func(page ImportMachinesControllerClientListByImportSiteResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ImportMachinesControllerClientListByImportSiteResponse) (ImportMachinesControllerClientListByImportSiteResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ImportMachinesControllerClient.NewListByImportSitePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByImportSiteCreateRequest(ctx, resourceGroupName, siteName, options) + }, nil) + if err != nil { + return ImportMachinesControllerClientListByImportSiteResponse{}, err + } + return client.listByImportSiteHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByImportSiteCreateRequest creates the ListByImportSite request. +func (client *ImportMachinesControllerClient) listByImportSiteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *ImportMachinesControllerClientListByImportSiteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/importSites/{siteName}/machines" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + if options != nil && options.Filter != nil { + reqQP.Set("filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("top", *options.Top) + } + if options != nil && options.ContinuationToken != nil { + reqQP.Set("continuationToken", *options.ContinuationToken) + } + if options != nil && options.TotalRecordCount != nil { + reqQP.Set("totalRecordCount", strconv.FormatInt(int64(*options.TotalRecordCount), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByImportSiteHandleResponse handles the ListByImportSite response. +func (client *ImportMachinesControllerClient) listByImportSiteHandleResponse(resp *http.Response) (ImportMachinesControllerClientListByImportSiteResponse, error) { + result := ImportMachinesControllerClientListByImportSiteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ImportMachineListResult); err != nil { + return ImportMachinesControllerClientListByImportSiteResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/importsitescontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/importsitescontroller_client.go new file mode 100644 index 000000000000..f5468331bc93 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/importsitescontroller_client.go @@ -0,0 +1,633 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// ImportSitesControllerClient contains the methods for the ImportSitesController group. +// Don't use this type directly, use NewImportSitesControllerClient() instead. +type ImportSitesControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewImportSitesControllerClient creates a new instance of ImportSitesControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewImportSitesControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ImportSitesControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ImportSitesControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Create - Create a ImportSite +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - body - Resource create parameters. +// - options - ImportSitesControllerClientCreateOptions contains the optional parameters for the ImportSitesControllerClient.Create +// method. +func (client *ImportSitesControllerClient) Create(ctx context.Context, resourceGroupName string, siteName string, body ImportSite, options *ImportSitesControllerClientCreateOptions) (ImportSitesControllerClientCreateResponse, error) { + var err error + const operationName = "ImportSitesControllerClient.Create" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, siteName, body, options) + if err != nil { + return ImportSitesControllerClientCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ImportSitesControllerClientCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return ImportSitesControllerClientCreateResponse{}, err + } + resp, err := client.createHandleResponse(httpResp) + return resp, err +} + +// createCreateRequest creates the Create request. +func (client *ImportSitesControllerClient) createCreateRequest(ctx context.Context, resourceGroupName string, siteName string, body ImportSite, options *ImportSitesControllerClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/importSites/{siteName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *ImportSitesControllerClient) createHandleResponse(resp *http.Response) (ImportSitesControllerClientCreateResponse, error) { + result := ImportSitesControllerClientCreateResponse{} + if val := resp.Header.Get("Retry-After"); val != "" { + retryAfter32, err := strconv.ParseInt(val, 10, 32) + retryAfter := int32(retryAfter32) + if err != nil { + return ImportSitesControllerClientCreateResponse{}, err + } + result.RetryAfter = &retryAfter + } + if err := runtime.UnmarshalAsJSON(resp, &result.ImportSite); err != nil { + return ImportSitesControllerClientCreateResponse{}, err + } + return result, nil +} + +// Delete - Delete a ImportSite +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - options - ImportSitesControllerClientDeleteOptions contains the optional parameters for the ImportSitesControllerClient.Delete +// method. +func (client *ImportSitesControllerClient) Delete(ctx context.Context, resourceGroupName string, siteName string, options *ImportSitesControllerClientDeleteOptions) (ImportSitesControllerClientDeleteResponse, error) { + var err error + const operationName = "ImportSitesControllerClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, siteName, options) + if err != nil { + return ImportSitesControllerClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ImportSitesControllerClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return ImportSitesControllerClientDeleteResponse{}, err + } + return ImportSitesControllerClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ImportSitesControllerClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *ImportSitesControllerClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/importSites/{siteName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// DeleteImportedMachines - Deletes the imported machines for site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - body - The content of the action request +// - options - ImportSitesControllerClientDeleteImportedMachinesOptions contains the optional parameters for the ImportSitesControllerClient.DeleteImportedMachines +// method. +func (client *ImportSitesControllerClient) DeleteImportedMachines(ctx context.Context, resourceGroupName string, siteName string, body any, options *ImportSitesControllerClientDeleteImportedMachinesOptions) (ImportSitesControllerClientDeleteImportedMachinesResponse, error) { + var err error + const operationName = "ImportSitesControllerClient.DeleteImportedMachines" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteImportedMachinesCreateRequest(ctx, resourceGroupName, siteName, body, options) + if err != nil { + return ImportSitesControllerClientDeleteImportedMachinesResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ImportSitesControllerClientDeleteImportedMachinesResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ImportSitesControllerClientDeleteImportedMachinesResponse{}, err + } + resp, err := client.deleteImportedMachinesHandleResponse(httpResp) + return resp, err +} + +// deleteImportedMachinesCreateRequest creates the DeleteImportedMachines request. +func (client *ImportSitesControllerClient) deleteImportedMachinesCreateRequest(ctx context.Context, resourceGroupName string, siteName string, body any, options *ImportSitesControllerClientDeleteImportedMachinesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/importSites/{siteName}/deleteImportedMachines" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// deleteImportedMachinesHandleResponse handles the DeleteImportedMachines response. +func (client *ImportSitesControllerClient) deleteImportedMachinesHandleResponse(resp *http.Response) (ImportSitesControllerClientDeleteImportedMachinesResponse, error) { + result := ImportSitesControllerClientDeleteImportedMachinesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SasURIResponse); err != nil { + return ImportSitesControllerClientDeleteImportedMachinesResponse{}, err + } + return result, nil +} + +// ExportURI - Method to export a site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - body - The content of the action request +// - options - ImportSitesControllerClientExportURIOptions contains the optional parameters for the ImportSitesControllerClient.ExportURI +// method. +func (client *ImportSitesControllerClient) ExportURI(ctx context.Context, resourceGroupName string, siteName string, body SasURIResponse, options *ImportSitesControllerClientExportURIOptions) (ImportSitesControllerClientExportURIResponse, error) { + var err error + const operationName = "ImportSitesControllerClient.ExportURI" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.exportURICreateRequest(ctx, resourceGroupName, siteName, body, options) + if err != nil { + return ImportSitesControllerClientExportURIResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ImportSitesControllerClientExportURIResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ImportSitesControllerClientExportURIResponse{}, err + } + resp, err := client.exportURIHandleResponse(httpResp) + return resp, err +} + +// exportURICreateRequest creates the ExportURI request. +func (client *ImportSitesControllerClient) exportURICreateRequest(ctx context.Context, resourceGroupName string, siteName string, body SasURIResponse, options *ImportSitesControllerClientExportURIOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/importSites/{siteName}/exportUri" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// exportURIHandleResponse handles the ExportURI response. +func (client *ImportSitesControllerClient) exportURIHandleResponse(resp *http.Response) (ImportSitesControllerClientExportURIResponse, error) { + result := ImportSitesControllerClientExportURIResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SasURIResponse); err != nil { + return ImportSitesControllerClientExportURIResponse{}, err + } + return result, nil +} + +// Get - Get a ImportSite +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - options - ImportSitesControllerClientGetOptions contains the optional parameters for the ImportSitesControllerClient.Get +// method. +func (client *ImportSitesControllerClient) Get(ctx context.Context, resourceGroupName string, siteName string, options *ImportSitesControllerClientGetOptions) (ImportSitesControllerClientGetResponse, error) { + var err error + const operationName = "ImportSitesControllerClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, siteName, options) + if err != nil { + return ImportSitesControllerClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ImportSitesControllerClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ImportSitesControllerClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ImportSitesControllerClient) getCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *ImportSitesControllerClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/importSites/{siteName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ImportSitesControllerClient) getHandleResponse(resp *http.Response) (ImportSitesControllerClientGetResponse, error) { + result := ImportSitesControllerClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ImportSite); err != nil { + return ImportSitesControllerClientGetResponse{}, err + } + return result, nil +} + +// ImportURI - Method to import a site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - body - The content of the action request +// - options - ImportSitesControllerClientImportURIOptions contains the optional parameters for the ImportSitesControllerClient.ImportURI +// method. +func (client *ImportSitesControllerClient) ImportURI(ctx context.Context, resourceGroupName string, siteName string, body SasURIResponse, options *ImportSitesControllerClientImportURIOptions) (ImportSitesControllerClientImportURIResponse, error) { + var err error + const operationName = "ImportSitesControllerClient.ImportURI" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.importURICreateRequest(ctx, resourceGroupName, siteName, body, options) + if err != nil { + return ImportSitesControllerClientImportURIResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ImportSitesControllerClientImportURIResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ImportSitesControllerClientImportURIResponse{}, err + } + resp, err := client.importURIHandleResponse(httpResp) + return resp, err +} + +// importURICreateRequest creates the ImportURI request. +func (client *ImportSitesControllerClient) importURICreateRequest(ctx context.Context, resourceGroupName string, siteName string, body SasURIResponse, options *ImportSitesControllerClientImportURIOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/importSites/{siteName}/importUri" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// importURIHandleResponse handles the ImportURI response. +func (client *ImportSitesControllerClient) importURIHandleResponse(resp *http.Response) (ImportSitesControllerClientImportURIResponse, error) { + result := ImportSitesControllerClientImportURIResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SasURIResponse); err != nil { + return ImportSitesControllerClientImportURIResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Get all import sites. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - ImportSitesControllerClientListByResourceGroupOptions contains the optional parameters for the ImportSitesControllerClient.NewListByResourceGroupPager +// method. +func (client *ImportSitesControllerClient) NewListByResourceGroupPager(resourceGroupName string, options *ImportSitesControllerClientListByResourceGroupOptions) *runtime.Pager[ImportSitesControllerClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[ImportSitesControllerClientListByResourceGroupResponse]{ + More: func(page ImportSitesControllerClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ImportSitesControllerClientListByResourceGroupResponse) (ImportSitesControllerClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ImportSitesControllerClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return ImportSitesControllerClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *ImportSitesControllerClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ImportSitesControllerClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/importSites" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *ImportSitesControllerClient) listByResourceGroupHandleResponse(resp *http.Response) (ImportSitesControllerClientListByResourceGroupResponse, error) { + result := ImportSitesControllerClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ImportSiteListResult); err != nil { + return ImportSitesControllerClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List ImportSite resources by subscription ID +// +// Generated from API version 2023-10-01-preview +// - options - ImportSitesControllerClientListBySubscriptionOptions contains the optional parameters for the ImportSitesControllerClient.NewListBySubscriptionPager +// method. +func (client *ImportSitesControllerClient) NewListBySubscriptionPager(options *ImportSitesControllerClientListBySubscriptionOptions) *runtime.Pager[ImportSitesControllerClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[ImportSitesControllerClientListBySubscriptionResponse]{ + More: func(page ImportSitesControllerClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ImportSitesControllerClientListBySubscriptionResponse) (ImportSitesControllerClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ImportSitesControllerClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return ImportSitesControllerClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *ImportSitesControllerClient) listBySubscriptionCreateRequest(ctx context.Context, options *ImportSitesControllerClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.OffAzure/importSites" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *ImportSitesControllerClient) listBySubscriptionHandleResponse(resp *http.Response) (ImportSitesControllerClientListBySubscriptionResponse, error) { + result := ImportSitesControllerClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ImportSiteListResult); err != nil { + return ImportSitesControllerClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// Update - Update a ImportSite +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - body - The resource properties to be updated. +// - options - ImportSitesControllerClientUpdateOptions contains the optional parameters for the ImportSitesControllerClient.Update +// method. +func (client *ImportSitesControllerClient) Update(ctx context.Context, resourceGroupName string, siteName string, body ImportSiteUpdate, options *ImportSitesControllerClientUpdateOptions) (ImportSitesControllerClientUpdateResponse, error) { + var err error + const operationName = "ImportSitesControllerClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, siteName, body, options) + if err != nil { + return ImportSitesControllerClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ImportSitesControllerClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ImportSitesControllerClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *ImportSitesControllerClient) updateCreateRequest(ctx context.Context, resourceGroupName string, siteName string, body ImportSiteUpdate, options *ImportSitesControllerClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/importSites/{siteName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *ImportSitesControllerClient) updateHandleResponse(resp *http.Response) (ImportSitesControllerClientUpdateResponse, error) { + result := ImportSitesControllerClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ImportSite); err != nil { + return ImportSitesControllerClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/machines_client.go b/sdk/resourcemanager/migrate/armmigrate/machines_client.go deleted file mode 100644 index 5008bd92f197..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/machines_client.go +++ /dev/null @@ -1,185 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmigrate - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// MachinesClient contains the methods for the Machines group. -// Don't use this type directly, use NewMachinesClient() instead. -type MachinesClient struct { - internal *arm.Client - subscriptionID string -} - -// NewMachinesClient creates a new instance of MachinesClient with the specified values. -// - subscriptionID - Azure Subscription Id in which project was created. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewMachinesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MachinesClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &MachinesClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Get the machine with the specified name. Returns a json object of type 'machine' defined in Models section. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - machineName - Unique name of a machine in private datacenter. -// - options - MachinesClientGetOptions contains the optional parameters for the MachinesClient.Get method. -func (client *MachinesClient) Get(ctx context.Context, resourceGroupName string, projectName string, machineName string, options *MachinesClientGetOptions) (MachinesClientGetResponse, error) { - var err error - const operationName = "MachinesClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, machineName, options) - if err != nil { - return MachinesClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MachinesClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return MachinesClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *MachinesClient) getCreateRequest(ctx context.Context, resourceGroupName string, projectName string, machineName string, options *MachinesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/machines/{machineName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if machineName == "" { - return nil, errors.New("parameter machineName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{machineName}", url.PathEscape(machineName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *MachinesClient) getHandleResponse(resp *http.Response) (MachinesClientGetResponse, error) { - result := MachinesClientGetResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.Machine); err != nil { - return MachinesClientGetResponse{}, err - } - return result, nil -} - -// NewListByProjectPager - Get data of all the machines available in the project. Returns a json array of objects of type -// 'machine' defined in Models section. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - options - MachinesClientListByProjectOptions contains the optional parameters for the MachinesClient.NewListByProjectPager -// method. -func (client *MachinesClient) NewListByProjectPager(resourceGroupName string, projectName string, options *MachinesClientListByProjectOptions) *runtime.Pager[MachinesClientListByProjectResponse] { - return runtime.NewPager(runtime.PagingHandler[MachinesClientListByProjectResponse]{ - More: func(page MachinesClientListByProjectResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *MachinesClientListByProjectResponse) (MachinesClientListByProjectResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "MachinesClient.NewListByProjectPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listByProjectCreateRequest(ctx, resourceGroupName, projectName, options) - }, nil) - if err != nil { - return MachinesClientListByProjectResponse{}, err - } - return client.listByProjectHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByProjectCreateRequest creates the ListByProject request. -func (client *MachinesClient) listByProjectCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *MachinesClientListByProjectOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/machines" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByProjectHandleResponse handles the ListByProject response. -func (client *MachinesClient) listByProjectHandleResponse(resp *http.Response) (MachinesClientListByProjectResponse, error) { - result := MachinesClientListByProjectResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.MachineResultList); err != nil { - return MachinesClientListByProjectResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/machines_client_example_test.go b/sdk/resourcemanager/migrate/armmigrate/machines_client_example_test.go deleted file mode 100644 index 64549afab5ce..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/machines_client_example_test.go +++ /dev/null @@ -1,174 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmigrate_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Machines_ListByProject.json -func ExampleMachinesClient_NewListByProjectPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMachinesClient().NewListByProjectPager("abgoyal-westEurope", "abgoyalWEselfhostb72bproject", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MachineResultList = armmigrate.MachineResultList{ - // Value: []*armmigrate.Machine{ - // { - // Name: to.Ptr("269ef295-a38d-4f8f-9779-77ce79088311"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/machines"), - // ETag: to.Ptr("\"04006052-0000-0d00-0000-5cd4065a0000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/machines/269ef295-a38d-4f8f-9779-77ce79088311"), - // Properties: &armmigrate.MachineProperties{ - // Description: to.Ptr("Microsoft Azure Migration Image on Windows Server 2016"), - // BootType: to.Ptr(armmigrate.MachineBootTypeBIOS), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T09:58:22.173Z"); return t}()), - // DatacenterManagementServerArmID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westEurope/providers/Microsoft.OffAzure/VMwareSites/PortalvCenterbc2fsite/vcenters/idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3"), - // DatacenterManagementServerName: to.Ptr("IDCLAB-A360.fareast.corp.microsoft.com"), - // DiscoveryMachineArmID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourcegroups/abgoyal-westeurope/providers/microsoft.offazure/vmwaresites/portalvcenterbc2fsite/machines/idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_52bd4eeb-faf4-7d95-4dd5-5524350ce2bb"), - // Disks: map[string]*armmigrate.Disk{ - // "6000C29f-9065-8fe0-ab83-7e58ff6ba442": &armmigrate.Disk{ - // DisplayName: to.Ptr("scsi0:0"), - // GigabytesAllocated: to.Ptr[float64](80), - // }, - // }, - // DisplayName: to.Ptr("ShubhamFirstAndThird"), - // Groups: []*string{ - // to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/test1")}, - // MegabytesOfMemory: to.Ptr[float32](16384), - // NetworkAdapters: map[string]*armmigrate.NetworkAdapter{ - // "4000": &armmigrate.NetworkAdapter{ - // DisplayName: to.Ptr("VM Network"), - // IPAddresses: []*string{ - // }, - // MacAddress: to.Ptr("00:0c:29:ac:e3:6d"), - // }, - // }, - // NumberOfCores: to.Ptr[int32](8), - // OperatingSystemName: to.Ptr("Microsoft Windows Server 2016 (64-bit)"), - // OperatingSystemType: to.Ptr("windowsGuest"), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T09:58:22.299Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("3ad6c8b7-08d6-45dc-87f5-cd533501f553"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/machines"), - // ETag: to.Ptr("\"04005652-0000-0d00-0000-5cd4065a0000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/machines/3ad6c8b7-08d6-45dc-87f5-cd533501f553"), - // Properties: &armmigrate.MachineProperties{ - // Description: to.Ptr("Microsoft Azure Migration Image on Windows Server 2016"), - // BootType: to.Ptr(armmigrate.MachineBootTypeBIOS), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T09:58:22.173Z"); return t}()), - // DatacenterManagementServerArmID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westEurope/providers/Microsoft.OffAzure/VMwareSites/PortalvCenterbc2fsite/vcenters/idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3"), - // DatacenterManagementServerName: to.Ptr("IDCLAB-A360.fareast.corp.microsoft.com"), - // DiscoveryMachineArmID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourcegroups/abgoyal-westeurope/providers/microsoft.offazure/vmwaresites/portalvcenterbc2fsite/machines/idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_52e5be9c-2758-a483-c252-eeef7919095c"), - // Disks: map[string]*armmigrate.Disk{ - // "6000C296-54c9-e29c-51be-125e76850958": &armmigrate.Disk{ - // DisplayName: to.Ptr("scsi0:0"), - // GigabytesAllocated: to.Ptr[float64](80), - // }, - // }, - // DisplayName: to.Ptr("shsinglaVM5"), - // Groups: []*string{ - // to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/test1")}, - // MegabytesOfMemory: to.Ptr[float32](16384), - // NetworkAdapters: map[string]*armmigrate.NetworkAdapter{ - // "4000": &armmigrate.NetworkAdapter{ - // DisplayName: to.Ptr("VM Network"), - // IPAddresses: []*string{ - // }, - // MacAddress: to.Ptr("00:0c:29:1f:ac:0a"), - // }, - // }, - // NumberOfCores: to.Ptr[int32](8), - // OperatingSystemName: to.Ptr("Microsoft Windows Server 2016 (64-bit)"), - // OperatingSystemType: to.Ptr("windowsGuest"), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T09:58:22.314Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Machines_Get.json -func ExampleMachinesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMachinesClient().Get(ctx, "abgoyal-westEurope", "abgoyalWEselfhostb72bproject", "269ef295-a38d-4f8f-9779-77ce79088311", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Machine = armmigrate.Machine{ - // Name: to.Ptr("269ef295-a38d-4f8f-9779-77ce79088311"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/machines"), - // ETag: to.Ptr("\"04006052-0000-0d00-0000-5cd4065a0000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/machines/269ef295-a38d-4f8f-9779-77ce79088311"), - // Properties: &armmigrate.MachineProperties{ - // Description: to.Ptr("Microsoft Azure Migration Image on Windows Server 2016"), - // BootType: to.Ptr(armmigrate.MachineBootTypeBIOS), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T09:58:22.173Z"); return t}()), - // DatacenterManagementServerArmID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westEurope/providers/Microsoft.OffAzure/VMwareSites/PortalvCenterbc2fsite/vcenters/idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3"), - // DatacenterManagementServerName: to.Ptr("IDCLAB-A360.fareast.corp.microsoft.com"), - // DiscoveryMachineArmID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourcegroups/abgoyal-westeurope/providers/microsoft.offazure/vmwaresites/portalvcenterbc2fsite/machines/idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_52bd4eeb-faf4-7d95-4dd5-5524350ce2bb"), - // Disks: map[string]*armmigrate.Disk{ - // "6000C29f-9065-8fe0-ab83-7e58ff6ba442": &armmigrate.Disk{ - // DisplayName: to.Ptr("scsi0:0"), - // GigabytesAllocated: to.Ptr[float64](80), - // }, - // }, - // DisplayName: to.Ptr("ShubhamFirstAndThird"), - // Groups: []*string{ - // to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/groups/test1")}, - // MegabytesOfMemory: to.Ptr[float32](16384), - // NetworkAdapters: map[string]*armmigrate.NetworkAdapter{ - // "4000": &armmigrate.NetworkAdapter{ - // DisplayName: to.Ptr("VM Network"), - // IPAddresses: []*string{ - // }, - // MacAddress: to.Ptr("00:0c:29:ac:e3:6d"), - // }, - // }, - // NumberOfCores: to.Ptr[int32](8), - // OperatingSystemName: to.Ptr("Microsoft Windows Server 2016 (64-bit)"), - // OperatingSystemType: to.Ptr("windowsGuest"), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T09:58:22.299Z"); return t}()), - // }, - // } -} diff --git a/sdk/resourcemanager/migrate/armmigrate/machinescontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/machinescontroller_client.go new file mode 100644 index 000000000000..b8a117530d40 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/machinescontroller_client.go @@ -0,0 +1,429 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// MachinesControllerClient contains the methods for the MachinesController group. +// Don't use this type directly, use NewMachinesControllerClient() instead. +type MachinesControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewMachinesControllerClient creates a new instance of MachinesControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewMachinesControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MachinesControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &MachinesControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get a MachineResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - machineName - Machine name +// - options - MachinesControllerClientGetOptions contains the optional parameters for the MachinesControllerClient.Get method. +func (client *MachinesControllerClient) Get(ctx context.Context, resourceGroupName string, siteName string, machineName string, options *MachinesControllerClientGetOptions) (MachinesControllerClientGetResponse, error) { + var err error + const operationName = "MachinesControllerClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, siteName, machineName, options) + if err != nil { + return MachinesControllerClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return MachinesControllerClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MachinesControllerClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *MachinesControllerClient) getCreateRequest(ctx context.Context, resourceGroupName string, siteName string, machineName string, options *MachinesControllerClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/vmwareSites/{siteName}/machines/{machineName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if machineName == "" { + return nil, errors.New("parameter machineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{machineName}", url.PathEscape(machineName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *MachinesControllerClient) getHandleResponse(resp *http.Response) (MachinesControllerClientGetResponse, error) { + result := MachinesControllerClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MachineResource); err != nil { + return MachinesControllerClientGetResponse{}, err + } + return result, nil +} + +// NewListByVmwareSitePager - List MachineResource resources by VmwareSite +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - options - MachinesControllerClientListByVmwareSiteOptions contains the optional parameters for the MachinesControllerClient.NewListByVmwareSitePager +// method. +func (client *MachinesControllerClient) NewListByVmwareSitePager(resourceGroupName string, siteName string, options *MachinesControllerClientListByVmwareSiteOptions) *runtime.Pager[MachinesControllerClientListByVmwareSiteResponse] { + return runtime.NewPager(runtime.PagingHandler[MachinesControllerClientListByVmwareSiteResponse]{ + More: func(page MachinesControllerClientListByVmwareSiteResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *MachinesControllerClientListByVmwareSiteResponse) (MachinesControllerClientListByVmwareSiteResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "MachinesControllerClient.NewListByVmwareSitePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByVmwareSiteCreateRequest(ctx, resourceGroupName, siteName, options) + }, nil) + if err != nil { + return MachinesControllerClientListByVmwareSiteResponse{}, err + } + return client.listByVmwareSiteHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByVmwareSiteCreateRequest creates the ListByVmwareSite request. +func (client *MachinesControllerClient) listByVmwareSiteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *MachinesControllerClientListByVmwareSiteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/vmwareSites/{siteName}/machines" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + if options != nil && options.Filter != nil { + reqQP.Set("filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.ContinuationToken != nil { + reqQP.Set("continuationToken", *options.ContinuationToken) + } + if options != nil && options.TotalRecordCount != nil { + reqQP.Set("totalRecordCount", strconv.FormatInt(int64(*options.TotalRecordCount), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByVmwareSiteHandleResponse handles the ListByVmwareSite response. +func (client *MachinesControllerClient) listByVmwareSiteHandleResponse(resp *http.Response) (MachinesControllerClientListByVmwareSiteResponse, error) { + result := MachinesControllerClientListByVmwareSiteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MachineResourceListResult); err != nil { + return MachinesControllerClientListByVmwareSiteResponse{}, err + } + return result, nil +} + +// BeginStart - Method to start a machine. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - machineName - Machine name +// - options - MachinesControllerClientBeginStartOptions contains the optional parameters for the MachinesControllerClient.BeginStart +// method. +func (client *MachinesControllerClient) BeginStart(ctx context.Context, resourceGroupName string, siteName string, machineName string, options *MachinesControllerClientBeginStartOptions) (*runtime.Poller[MachinesControllerClientStartResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.start(ctx, resourceGroupName, siteName, machineName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MachinesControllerClientStartResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[MachinesControllerClientStartResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Start - Method to start a machine. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *MachinesControllerClient) start(ctx context.Context, resourceGroupName string, siteName string, machineName string, options *MachinesControllerClientBeginStartOptions) (*http.Response, error) { + var err error + const operationName = "MachinesControllerClient.BeginStart" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.startCreateRequest(ctx, resourceGroupName, siteName, machineName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// startCreateRequest creates the Start request. +func (client *MachinesControllerClient) startCreateRequest(ctx context.Context, resourceGroupName string, siteName string, machineName string, options *MachinesControllerClientBeginStartOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/vmwareSites/{siteName}/machines/{machineName}/start" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if machineName == "" { + return nil, errors.New("parameter machineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{machineName}", url.PathEscape(machineName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginStop - Method to stop a machine. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - machineName - Machine name +// - options - MachinesControllerClientBeginStopOptions contains the optional parameters for the MachinesControllerClient.BeginStop +// method. +func (client *MachinesControllerClient) BeginStop(ctx context.Context, resourceGroupName string, siteName string, machineName string, options *MachinesControllerClientBeginStopOptions) (*runtime.Poller[MachinesControllerClientStopResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.stop(ctx, resourceGroupName, siteName, machineName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MachinesControllerClientStopResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[MachinesControllerClientStopResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Stop - Method to stop a machine. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *MachinesControllerClient) stop(ctx context.Context, resourceGroupName string, siteName string, machineName string, options *MachinesControllerClientBeginStopOptions) (*http.Response, error) { + var err error + const operationName = "MachinesControllerClient.BeginStop" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.stopCreateRequest(ctx, resourceGroupName, siteName, machineName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// stopCreateRequest creates the Stop request. +func (client *MachinesControllerClient) stopCreateRequest(ctx context.Context, resourceGroupName string, siteName string, machineName string, options *MachinesControllerClientBeginStopOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/vmwareSites/{siteName}/machines/{machineName}/stop" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if machineName == "" { + return nil, errors.New("parameter machineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{machineName}", url.PathEscape(machineName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Update - Update a MachineResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - machineName - Machine name +// - body - The resource properties to be updated. +// - options - MachinesControllerClientUpdateOptions contains the optional parameters for the MachinesControllerClient.Update +// method. +func (client *MachinesControllerClient) Update(ctx context.Context, resourceGroupName string, siteName string, machineName string, body MachineResourceUpdate, options *MachinesControllerClientUpdateOptions) (MachinesControllerClientUpdateResponse, error) { + var err error + const operationName = "MachinesControllerClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, siteName, machineName, body, options) + if err != nil { + return MachinesControllerClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return MachinesControllerClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MachinesControllerClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *MachinesControllerClient) updateCreateRequest(ctx context.Context, resourceGroupName string, siteName string, machineName string, body MachineResourceUpdate, options *MachinesControllerClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/vmwareSites/{siteName}/machines/{machineName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if machineName == "" { + return nil, errors.New("parameter machineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{machineName}", url.PathEscape(machineName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *MachinesControllerClient) updateHandleResponse(resp *http.Response) (MachinesControllerClientUpdateResponse, error) { + result := MachinesControllerClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MachineResource); err != nil { + return MachinesControllerClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/mastersitescontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/mastersitescontroller_client.go new file mode 100644 index 000000000000..d04787d3d63e --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/mastersitescontroller_client.go @@ -0,0 +1,510 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// MasterSitesControllerClient contains the methods for the MasterSitesController group. +// Don't use this type directly, use NewMasterSitesControllerClient() instead. +type MasterSitesControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewMasterSitesControllerClient creates a new instance of MasterSitesControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewMasterSitesControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MasterSitesControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &MasterSitesControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreate - Method to create or update a site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - body - Resource create parameters. +// - options - MasterSitesControllerClientBeginCreateOptions contains the optional parameters for the MasterSitesControllerClient.BeginCreate +// method. +func (client *MasterSitesControllerClient) BeginCreate(ctx context.Context, resourceGroupName string, siteName string, body MasterSite, options *MasterSitesControllerClientBeginCreateOptions) (*runtime.Poller[MasterSitesControllerClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, siteName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MasterSitesControllerClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[MasterSitesControllerClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Method to create or update a site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *MasterSitesControllerClient) create(ctx context.Context, resourceGroupName string, siteName string, body MasterSite, options *MasterSitesControllerClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "MasterSitesControllerClient.BeginCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, siteName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createCreateRequest creates the Create request. +func (client *MasterSitesControllerClient) createCreateRequest(ctx context.Context, resourceGroupName string, siteName string, body MasterSite, options *MasterSitesControllerClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// Delete - Method to delete a site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - options - MasterSitesControllerClientDeleteOptions contains the optional parameters for the MasterSitesControllerClient.Delete +// method. +func (client *MasterSitesControllerClient) Delete(ctx context.Context, resourceGroupName string, siteName string, options *MasterSitesControllerClientDeleteOptions) (MasterSitesControllerClientDeleteResponse, error) { + var err error + const operationName = "MasterSitesControllerClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, siteName, options) + if err != nil { + return MasterSitesControllerClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return MasterSitesControllerClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return MasterSitesControllerClientDeleteResponse{}, err + } + return MasterSitesControllerClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *MasterSitesControllerClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *MasterSitesControllerClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// ErrorSummary - Method to get error summary from master site for an appliance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - body - The content of the action request +// - options - MasterSitesControllerClientErrorSummaryOptions contains the optional parameters for the MasterSitesControllerClient.ErrorSummary +// method. +func (client *MasterSitesControllerClient) ErrorSummary(ctx context.Context, resourceGroupName string, siteName string, body ErrorSummaryRequest, options *MasterSitesControllerClientErrorSummaryOptions) (MasterSitesControllerClientErrorSummaryResponse, error) { + var err error + const operationName = "MasterSitesControllerClient.ErrorSummary" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.errorSummaryCreateRequest(ctx, resourceGroupName, siteName, body, options) + if err != nil { + return MasterSitesControllerClientErrorSummaryResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return MasterSitesControllerClientErrorSummaryResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MasterSitesControllerClientErrorSummaryResponse{}, err + } + resp, err := client.errorSummaryHandleResponse(httpResp) + return resp, err +} + +// errorSummaryCreateRequest creates the ErrorSummary request. +func (client *MasterSitesControllerClient) errorSummaryCreateRequest(ctx context.Context, resourceGroupName string, siteName string, body ErrorSummaryRequest, options *MasterSitesControllerClientErrorSummaryOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/errorSummary" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// errorSummaryHandleResponse handles the ErrorSummary response. +func (client *MasterSitesControllerClient) errorSummaryHandleResponse(resp *http.Response) (MasterSitesControllerClientErrorSummaryResponse, error) { + result := MasterSitesControllerClientErrorSummaryResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SiteErrorSummary); err != nil { + return MasterSitesControllerClientErrorSummaryResponse{}, err + } + return result, nil +} + +// Get - Get a MasterSite +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - options - MasterSitesControllerClientGetOptions contains the optional parameters for the MasterSitesControllerClient.Get +// method. +func (client *MasterSitesControllerClient) Get(ctx context.Context, resourceGroupName string, siteName string, options *MasterSitesControllerClientGetOptions) (MasterSitesControllerClientGetResponse, error) { + var err error + const operationName = "MasterSitesControllerClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, siteName, options) + if err != nil { + return MasterSitesControllerClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return MasterSitesControllerClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MasterSitesControllerClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *MasterSitesControllerClient) getCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *MasterSitesControllerClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *MasterSitesControllerClient) getHandleResponse(resp *http.Response) (MasterSitesControllerClientGetResponse, error) { + result := MasterSitesControllerClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MasterSite); err != nil { + return MasterSitesControllerClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Get all the sites in the resource group. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - MasterSitesControllerClientListByResourceGroupOptions contains the optional parameters for the MasterSitesControllerClient.NewListByResourceGroupPager +// method. +func (client *MasterSitesControllerClient) NewListByResourceGroupPager(resourceGroupName string, options *MasterSitesControllerClientListByResourceGroupOptions) *runtime.Pager[MasterSitesControllerClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[MasterSitesControllerClientListByResourceGroupResponse]{ + More: func(page MasterSitesControllerClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *MasterSitesControllerClientListByResourceGroupResponse) (MasterSitesControllerClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "MasterSitesControllerClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return MasterSitesControllerClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *MasterSitesControllerClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *MasterSitesControllerClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *MasterSitesControllerClient) listByResourceGroupHandleResponse(resp *http.Response) (MasterSitesControllerClientListByResourceGroupResponse, error) { + result := MasterSitesControllerClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MasterSiteListResult); err != nil { + return MasterSitesControllerClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List MasterSite resources by subscription ID +// +// Generated from API version 2023-10-01-preview +// - options - MasterSitesControllerClientListBySubscriptionOptions contains the optional parameters for the MasterSitesControllerClient.NewListBySubscriptionPager +// method. +func (client *MasterSitesControllerClient) NewListBySubscriptionPager(options *MasterSitesControllerClientListBySubscriptionOptions) *runtime.Pager[MasterSitesControllerClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[MasterSitesControllerClientListBySubscriptionResponse]{ + More: func(page MasterSitesControllerClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *MasterSitesControllerClientListBySubscriptionResponse) (MasterSitesControllerClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "MasterSitesControllerClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return MasterSitesControllerClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *MasterSitesControllerClient) listBySubscriptionCreateRequest(ctx context.Context, options *MasterSitesControllerClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.OffAzure/masterSites" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *MasterSitesControllerClient) listBySubscriptionHandleResponse(resp *http.Response) (MasterSitesControllerClientListBySubscriptionResponse, error) { + result := MasterSitesControllerClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MasterSiteListResult); err != nil { + return MasterSitesControllerClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// BeginUpdate - Method to update an existing site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - properties - The resource properties to be updated. +// - options - MasterSitesControllerClientBeginUpdateOptions contains the optional parameters for the MasterSitesControllerClient.BeginUpdate +// method. +func (client *MasterSitesControllerClient) BeginUpdate(ctx context.Context, resourceGroupName string, siteName string, properties MasterSiteUpdate, options *MasterSitesControllerClientBeginUpdateOptions) (*runtime.Poller[MasterSitesControllerClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, siteName, properties, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MasterSitesControllerClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[MasterSitesControllerClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Method to update an existing site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *MasterSitesControllerClient) update(ctx context.Context, resourceGroupName string, siteName string, properties MasterSiteUpdate, options *MasterSitesControllerClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "MasterSitesControllerClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, siteName, properties, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *MasterSitesControllerClient) updateCreateRequest(ctx context.Context, resourceGroupName string, siteName string, properties MasterSiteUpdate, options *MasterSitesControllerClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/mastersitesoperationsstatuscontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/mastersitesoperationsstatuscontroller_client.go new file mode 100644 index 000000000000..044f89ea6083 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/mastersitesoperationsstatuscontroller_client.go @@ -0,0 +1,114 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// MasterSitesOperationsStatusControllerClient contains the methods for the MasterSitesOperationsStatusController group. +// Don't use this type directly, use NewMasterSitesOperationsStatusControllerClient() instead. +type MasterSitesOperationsStatusControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewMasterSitesOperationsStatusControllerClient creates a new instance of MasterSitesOperationsStatusControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewMasterSitesOperationsStatusControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MasterSitesOperationsStatusControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &MasterSitesOperationsStatusControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// GetVmwareOperationStatus - A operation status resource belonging to a master site resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - operationStatusName - Operation status Arm Name. +// - options - MasterSitesOperationsStatusControllerClientGetVmwareOperationStatusOptions contains the optional parameters for +// the MasterSitesOperationsStatusControllerClient.GetVmwareOperationStatus method. +func (client *MasterSitesOperationsStatusControllerClient) GetVmwareOperationStatus(ctx context.Context, resourceGroupName string, siteName string, operationStatusName string, options *MasterSitesOperationsStatusControllerClientGetVmwareOperationStatusOptions) (MasterSitesOperationsStatusControllerClientGetVmwareOperationStatusResponse, error) { + var err error + const operationName = "MasterSitesOperationsStatusControllerClient.GetVmwareOperationStatus" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getVmwareOperationStatusCreateRequest(ctx, resourceGroupName, siteName, operationStatusName, options) + if err != nil { + return MasterSitesOperationsStatusControllerClientGetVmwareOperationStatusResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return MasterSitesOperationsStatusControllerClientGetVmwareOperationStatusResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MasterSitesOperationsStatusControllerClientGetVmwareOperationStatusResponse{}, err + } + resp, err := client.getVmwareOperationStatusHandleResponse(httpResp) + return resp, err +} + +// getVmwareOperationStatusCreateRequest creates the GetVmwareOperationStatus request. +func (client *MasterSitesOperationsStatusControllerClient) getVmwareOperationStatusCreateRequest(ctx context.Context, resourceGroupName string, siteName string, operationStatusName string, options *MasterSitesOperationsStatusControllerClientGetVmwareOperationStatusOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/operationsStatus/{operationStatusName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if operationStatusName == "" { + return nil, errors.New("parameter operationStatusName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{operationStatusName}", url.PathEscape(operationStatusName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getVmwareOperationStatusHandleResponse handles the GetVmwareOperationStatus response. +func (client *MasterSitesOperationsStatusControllerClient) getVmwareOperationStatusHandleResponse(resp *http.Response) (MasterSitesOperationsStatusControllerClientGetVmwareOperationStatusResponse, error) { + result := MasterSitesOperationsStatusControllerClientGetVmwareOperationStatusResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { + return MasterSitesOperationsStatusControllerClientGetVmwareOperationStatusResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/models.go b/sdk/resourcemanager/migrate/armmigrate/models.go index 8b49a68aebd1..8afa3fa6eca8 100644 --- a/sdk/resourcemanager/migrate/armmigrate/models.go +++ b/sdk/resourcemanager/migrate/armmigrate/models.go @@ -10,907 +10,4894 @@ package armmigrate import "time" -// AssessedDisk - A disk assessed for an assessment. -type AssessedDisk struct { - // READ-ONLY; User friendly name of the assessed disk. +// Application in the guest virtual machine. +type Application struct { + // READ-ONLY; Gets or sets Name of the Application. + Name *string + + // READ-ONLY; Gets or sets Provider of the Application. + Provider *string + + // READ-ONLY; Gets or sets Version of the Application. + Version *string +} + +// ApplicationDiscovery - Contains data related application and roles discovery scope. +type ApplicationDiscovery struct { + // READ-ONLY; Gets discovery scope status. + DiscoveryScopeStatus *ApplicationDiscoveryScopeStatus + + // READ-ONLY; Gets errors for discovery scope. + Errors []*HealthErrorDetails + + // READ-ONLY; Gets the run as account ID with which feature worked successfully. + // It is discovered by the agent from the list of credentials. + HydratedRunAsAccountID *string +} + +// AppsAndRoles in the guest virtual machine. +type AppsAndRoles struct { + // READ-ONLY; Gets or sets Applications of the AppsAndRoles. + Applications []*Application + + // READ-ONLY; Gets or sets BizTalkServers of the AppsAndRoles. + BizTalkServers []*BizTalkServer + + // READ-ONLY; Gets or sets ExchangeServers of the AppsAndRoles. + ExchangeServers []*ExchangeServer + + // READ-ONLY; Gets or sets Features of the AppsAndRoles. + Features []*Feature + + // READ-ONLY; Gets or sets OtherDatabaseServers of the AppsAndRoles. + OtherDatabases []*OtherDatabase + + // READ-ONLY; Gets or sets SQLServers of the AppsAndRoles. + SQLServers []*SQLServerApplication + + // READ-ONLY; Gets or sets SharePointServers of the AppsAndRoles. + SharePointServers []*SharePointServer + + // READ-ONLY; Gets or sets SystemCenters of the AppsAndRoles. + SystemCenters []*SystemCenter + + // READ-ONLY; Gets or sets WebApplications of the AppsAndRoles. + WebApplications []*WebApplicationAppsAndRolesModel +} + +// BizTalkServer in the guest virtual machine. +type BizTalkServer struct { + // READ-ONLY; Gets or sets ProductName of the BizTalkServer. + ProductName *string + + // READ-ONLY; Gets or sets Status of the BizTalkServer. + Status *string +} + +// ConnectorUnit - The connectors of the web server. +type ConnectorUnit struct { + // Gets or sets the bindings for the connector. + Bindings []*FrontEndBinding +} + +// DeleteImportMachinesJob - A host resource belonging to a site resource. +type DeleteImportMachinesJob struct { + // The resource-specific properties for this resource. + Properties *DeleteImportedMachinesJobProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// DeleteImportMachinesJobCollection - Delete import machines job collection. +type DeleteImportMachinesJobCollection struct { + // REQUIRED; Gets the list of jobs. + Value []*DeleteImportMachinesJob + + // READ-ONLY; Gets the value of next link. + NextLink *string +} + +// DeleteImportedMachinesJobProperties - Delete Imported Machines Job Properties +type DeleteImportedMachinesJobProperties struct { + // blob name + BlobName *string + + // deletion Confirmation + DeletionConfirmation *bool + + // Gets or sets the Display name. + DisplayName *string + + // Gets or sets the Job end time. + EndTime *string + + // error Sas Uri + ErrorSasURI *string + + // job State + JobState *DeleteImportedMachinesJobPropertiesJobState + + // number Of Machines Deleted + NumberOfMachinesDeleted *int32 + + // The status of the last operation. + ProvisioningState *ProvisioningState + + // Gets or sets the Job start time. + StartTime *string + + // Gets or sets the Job status. + Status *string + + // READ-ONLY; errors list + Errors []*string +} + +// DependencyMapDiscovery - Contains data related dependency map discovery scope. +type DependencyMapDiscovery struct { + // READ-ONLY; Gets discovery scope status. + DiscoveryScopeStatus *DependencyMapDiscoveryScopeStatus + + // READ-ONLY; Gets errors for discovery scope. + Errors []*HealthErrorDetails + + // READ-ONLY; Gets the run as account ID with which feature worked successfully. + // It is discovered by the agent from the list of credentials. + HydratedRunAsAccountID *string +} + +// DependencyMapMachineInput - Machine class. +type DependencyMapMachineInput struct { + // Gets or sets a value indicating whether dependency mapping is to be enabled or not. + IsDependencyMapToBeEnabled *bool + + // Gets or sets the ARM id of the machine. + MachineID *string +} + +// DependencyMapServiceMapextensionsClientGroupMembersRequest - DependencyMap ServiceMap extensions Client GroupMembers Request +type DependencyMapServiceMapextensionsClientGroupMembersRequest struct { + // end time + EndTime *time.Time + + // optional filters + Filters *DependencyMapServiceMapextensionsDependencyMapRequestFilters + + // id of machine + MachineID *string + + // process group name + ProcessGroupName *string + + // name of process + ProcessName *string + + // start time + StartTime *time.Time +} + +// DependencyMapServiceMapextensionsDependencyMapRequestFilters - DependencyMap Service Map extensions Dependency Map Request +// Filters +type DependencyMapServiceMapextensionsDependencyMapRequestFilters struct { + // array of machine ids + MachineIDs []*string + + // array of process Ids + ProcessIDs []*string +} + +// DependencyMapServiceMapextensionsExportDependenciesRequest - DependencyMap ServiceMap extensions ExportDependencies Request +type DependencyMapServiceMapextensionsExportDependenciesRequest struct { + // end time + EndTime *time.Time + + // start time + StartTime *time.Time +} + +// DependencyMapServiceMapextensionsScopeMapRequest - DependencyMap ServiceMapextensions Scope MapRequest +type DependencyMapServiceMapextensionsScopeMapRequest struct { + // end time + EndTime *time.Time + + // optional filters + Filters *DependencyMapServiceMapextensionsDependencyMapRequestFilters + + // start time + StartTime *time.Time +} + +// DependencyMapServiceMapextensionsServerGroupMembersRequest - DependencyMap ServiceMap extensions ServerGroup Members Request +type DependencyMapServiceMapextensionsServerGroupMembersRequest struct { + // end time + EndTime *time.Time + + // optional filters + Filters *DependencyMapServiceMapextensionsDependencyMapRequestFilters + + // port of server + ServerPort *int32 + + // start time + StartTime *time.Time +} + +// DependencyMapServiceMapextensionsSingleMachineDetailedMapRequest - DependencyMap ServiceMap extensions SingleMachine DetailedMap +// Request +type DependencyMapServiceMapextensionsSingleMachineDetailedMapRequest struct { + // end time + EndTime *time.Time + + // optional filters + Filters *DependencyMapServiceMapextensionsDependencyMapRequestFilters + + // id of machine + MachineID *string + + // start time + StartTime *time.Time +} + +// DirectoryPath - Second level entity for virtual directories. +type DirectoryPath struct { + // Gets or sets the physical path of the directory on the web server. + Physical *string + + // Gets or sets the virtual path for the directory. + Virtual *string +} + +// DiscoveryScopeErrorSummary - The site error summary model. +type DiscoveryScopeErrorSummary struct { + // REQUIRED; Count of affected objects. + AffectedObjectsCount *int64 + + // REQUIRED; Gets or sets the affected resource type. + AffectedResourceType *string + + // REQUIRED; Gets or sets the count of affected objects. + DiscoveryScope *DiscoveryScopes +} + +// DiscoverySiteDataSource - Web app data source web model. +type DiscoverySiteDataSource struct { + // The resource-specific properties for this resource. + Properties *DiscoverySiteDataSourceProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// DiscoverySiteDataSourceListResult - The response of a DiscoverySiteDataSource list operation. +type DiscoverySiteDataSourceListResult struct { + // REQUIRED; The DiscoverySiteDataSource items on this page + Value []*DiscoverySiteDataSource + + // The link to the next page of items + NextLink *string +} + +// DiscoverySiteDataSourceProperties - Discovery site data source properties class. +type DiscoverySiteDataSourceProperties struct { + // Gets or sets the discovery site Id. + DiscoverySiteID *string + + // READ-ONLY; provisioning state enum + ProvisioningState *ProvisioningState +} + +// ErrorAdditionalInfo - The resource management error additional info. +type ErrorAdditionalInfo struct { + // READ-ONLY; The additional info. + Info any + + // READ-ONLY; The additional info type. + Type *string +} + +// ErrorDetail - The error detail. +type ErrorDetail struct { + // READ-ONLY; The error additional info. + AdditionalInfo []*ErrorAdditionalInfo + + // READ-ONLY; The error code. + Code *string + + // READ-ONLY; The error details. + Details []*ErrorDetail + + // READ-ONLY; The error message. + Message *string + + // READ-ONLY; The error target. + Target *string +} + +// ErrorDetails - Error contract returned when some exception occurs in Rest API. +type ErrorDetails struct { + // READ-ONLY; Gets the agent error code. + AgentErrorCode *string + + // READ-ONLY; Gets the error message from the agent. + AgentErrorMessage *string + + // READ-ONLY; Gets possible causes for the agent error. + AgentErrorPossibleCauses *string + + // READ-ONLY; Gets the recommended action for the agent error. + AgentErrorRecommendedAction *string + + // READ-ONLY; Gets the error code. + Code *string + + // READ-ONLY; Gets a value indicating whether the error originated from a agent or not. + IsAgentReportedError *bool + + // READ-ONLY; Gets the error message. + Message *string + + // READ-ONLY; Gets the possible causes of error. + PossibleCauses *string + + // READ-ONLY; Gets the recommended action to resolve error. + RecommendedAction *string + + // READ-ONLY; Gets the error severity. + Severity *string +} + +// ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. +// (This also follows the OData error response format.). +type ErrorResponse struct { + // The error object. + Error *ErrorDetail +} + +// ErrorSummaryRequest body +type ErrorSummaryRequest struct { + // Gets or sets the Appliance Name. + ApplianceName *string +} + +// Errors - The properties of a server machine tracked resource +type Errors struct { + // READ-ONLY; Gets the appliance name. + ApplianceName *string + + // READ-ONLY; Gets the error name. + Code *string + + // READ-ONLY; Gets discovery scope for which error is encountered. + DiscoveryScope *HealthErrorDetailsDiscoveryScope + + // READ-ONLY; Gets the error ID. + ID *int32 + + // READ-ONLY; Gets the error message. + Message *string + + // READ-ONLY; Gets the message parameters. + MessageParameters map[string]*string + + // READ-ONLY; Gets the possible causes of error. + PossibleCauses *string + + // READ-ONLY; Gets the recommended action to resolve error. + RecommendedAction *string + + // READ-ONLY; Gets run as account id used while performing discovery of entity. + RunAsAccountID *string + + // READ-ONLY; Gets the error severity. + Severity *string + + // READ-ONLY; Gets the error source. + Source *MicrosoftAzureFDSWebRoleHealthErrorDetailsSource + + // READ-ONLY; Gets the error summary message. + SummaryMessage *string + + // READ-ONLY; Gets the time stamp when the error was updated. + UpdatedTimeStamp *time.Time +} + +// ExchangeServer in the guest virtual machine. +type ExchangeServer struct { + // READ-ONLY; Gets or sets Edition of the ExchangeServer. + Edition *string + + // READ-ONLY; Gets or sets ProductName of the ExchangeServer. + ProductName *string + + // READ-ONLY; Gets or sets Roles of the ExchangeServer. + Roles *string + + // READ-ONLY; Gets or sets ServicePack of the ExchangeServer. + ServicePack *string + + // READ-ONLY; Gets or sets Version of the ExchangeServer. + Version *string +} + +// ExportImportedMachinesJob - Export machines job REST resource. +type ExportImportedMachinesJob struct { + // Gets or sets the Display name. + DisplayName *string + + // Gets or sets the Job end time. + EndTime *string + + // Gets or sets the relative ARM name to get job. + ID *string + + // Gets or sets the Job ID. + Name *string + + // Gets or sets the export machines job properties. + Properties *ExportImportedMachinesJobEntityProperties + + // Gets or sets the Job start time. + StartTime *string + + // Gets or sets the Job status. + Status *string + + // READ-ONLY; Type name for export job. + Type *string +} + +// ExportImportedMachinesJobEntityProperties - Export Imported Machines JobEntity Properties +type ExportImportedMachinesJobEntityProperties struct { + // blob name + BlobName *string + + // sas uri + SasURI *string +} + +// ExportMachineErrorsRequest - The body of export machine errors request. +type ExportMachineErrorsRequest struct { + // Gets or sets the properties. + Properties *RequestExportMachineErrorsProperties +} + +// ExportMachinesRequest body +type ExportMachinesRequest struct { + // filter options. + Filter *string +} + +// ExportSQLServersRequest - ExportSqlServerRequest body +type ExportSQLServersRequest struct { + // Gets or sets the Appliance Name. + ApplianceName *string + + // filter options. + Filter *string +} + +// ExportWebAppsRequest body +type ExportWebAppsRequest struct { + // filter options. + Filter *string +} + +// Feature in the guest virtual machine. +type Feature struct { + // READ-ONLY; Gets or sets FeatureType of the Feature. + FeatureType *string + + // READ-ONLY; Gets or sets Name of the Feature. + Name *string + + // READ-ONLY; Gets or sets Parent of the Feature. + Parent *string + + // READ-ONLY; Gets or sets Status of the Feature. + Status *string +} + +// FileMetaData - File Metadata web model. +type FileMetaData struct { + // Gets or sets the database file type. + FileType *FileType + + // Gets or sets a value indicating whether memory optimized data option is enabled. + IsMemoryOptimizedDataOptionEnabled *bool + + // Gets or sets the logical name of the file. + LogicalName *string + + // Gets or sets the operating-system full path of the file. + PhysicalFullName *string + + // Gets or sets the size of the file in MB. + SizeInMb *float32 +} + +// FrontEndBinding - Frontend bindings for a web application. +type FrontEndBinding struct { + // Gets or sets the Host name. + HostName *string + + // Gets or sets the IP Address. + IPAddress *string + + // Gets or sets the Port number. + Port *string + + // Gets or sets the Binding protocol. + Protocol *string +} + +// GuestOsDetails - Second level object. Data related to a machine's operating system. Serialized and stored as part of Machine +// Rest object. +type GuestOsDetails struct { + // Gets or sets the Architecture of the operating system. + OSArchitecture *string + + // Gets or sets the Name of the operating system. + OSName *string + + // Gets or sets the type of the operating system. + OSType *string + + // Gets or sets the Version of the operating system. + OSVersion *string +} + +// HealthErrorDetails - Error contract returned when some exception occurs in Rest API. +type HealthErrorDetails struct { + // READ-ONLY; Gets the appliance name. + ApplianceName *string + + // READ-ONLY; Gets the error name. + Code *string + + // READ-ONLY; Gets discovery scope for which error is encountered. + DiscoveryScope *HealthErrorDetailsDiscoveryScope + + // READ-ONLY; Gets the error ID. + ID *int64 + + // READ-ONLY; Gets the error message. + Message *string + + // READ-ONLY; Gets the message parameters. + MessageParameters map[string]*string + + // READ-ONLY; Gets the possible causes of error. + PossibleCauses *string + + // READ-ONLY; Gets the recommended action to resolve error. + RecommendedAction *string + + // READ-ONLY; Gets run as account id used while performing discovery of entity. + RunAsAccountID *string + + // READ-ONLY; Gets the error severity. + Severity *string + + // READ-ONLY; Gets the error source. + Source *HealthErrorDetailsSource + + // READ-ONLY; Gets the error summary message. + SummaryMessage *string + + // READ-ONLY; Gets the time stamp when the error was updated. + UpdatedTimeStamp *time.Time +} + +// HypervCluster - A cluster resource belonging to a site resource. +type HypervCluster struct { + // The resource-specific properties for this resource. + Properties *HypervClusterProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// HypervClusterListResult - The response of a HypervCluster list operation. +type HypervClusterListResult struct { + // REQUIRED; The HypervCluster items on this page + Value []*HypervCluster + + // The link to the next page of items + NextLink *string +} + +// HypervClusterProperties - The properties of Hyperv Cluster +type HypervClusterProperties struct { + // Gets or sets the FQDN/IPAddress of the Hyper-V cluster. + Fqdn *string + + // Gets or sets list of hosts (FQDN) currently being tracked by the cluster. + HostFqdnList []*string + + // The status of the last operation. + ProvisioningState *ProvisioningState + + // Gets or sets Run as account ID of the Hyper-V cluster. + RunAsAccountID *string + + // READ-ONLY; Gets the timestamp marking Hyper-V cluster creation. + CreatedTimestamp *string + + // READ-ONLY; Gets the errors. + Errors []*HealthErrorDetails + + // READ-ONLY; Gets the functional level of the Hyper-V cluster. + FunctionalLevel *int32 + + // READ-ONLY; Gets the status of the Hyper-V cluster. + Status *string + + // READ-ONLY; Gets the timestamp marking last updated on the Hyper-V cluster. + UpdatedTimestamp *string +} + +// HypervDisk - Second level object returned as part of Machine REST resource. +type HypervDisk struct { + // Gets or sets Type of the disk. + DiskType *string + + // Gets or sets LUN of the disk. + Lun *int32 + + // Gets or sets Bytes allocated for the disk. + MaxSizeInBytes *int64 + + // Gets or sets Name of the disk. + Name *string + + // Gets or sets Path of the disk. + Path *string + + // READ-ONLY; Id of the disk. + InstanceID *string + + // READ-ONLY; VHD Id of the disk. + VhdID *string +} + +// HypervHost - A host resource belonging to a site resource. +type HypervHost struct { + // The resource-specific properties for this resource. + Properties *HypervHostProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// HypervHostListResult - The response of a HypervHost list operation. +type HypervHostListResult struct { + // REQUIRED; The HypervHost items on this page + Value []*HypervHost + + // The link to the next page of items + NextLink *string +} + +// HypervHostProperties - The properties of Hyperv Host +type HypervHostProperties struct { + // Gets or sets the FQDN/IPAddress of the Hyper-V host. + Fqdn *string + + // The status of the last operation. + ProvisioningState *ProvisioningState + + // Gets or sets the run as account ID of the Hyper-V host. + RunAsAccountID *string + + // READ-ONLY; Gets the timestamp marking Hyper-V host creation. + CreatedTimestamp *string + + // READ-ONLY; Gets the errors. + Errors []*HealthErrorDetails + + // READ-ONLY; Gets the timestamp marking last updated on the Hyper-V host. + UpdatedTimestamp *string + + // READ-ONLY; Gets the version of the Hyper-V host. + Version *string +} + +// HypervJob - A job resource belonging to a site resource. +type HypervJob struct { + // The resource-specific properties for this resource. + Properties *JobProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// HypervJobListResult - The response of a HypervJob list operation. +type HypervJobListResult struct { + // REQUIRED; The HypervJob items on this page + Value []*HypervJob + + // The link to the next page of items + NextLink *string +} + +// HypervMachine - A machine resource belonging to a site resource. +type HypervMachine struct { + // The resource-specific properties for this resource. + Properties *HypervMachineProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// HypervMachineListResult - The response of a HypervMachine list operation. +type HypervMachineListResult struct { + // REQUIRED; The HypervMachine items on this page + Value []*HypervMachine + + // The link to the next page of items + NextLink *string +} + +// HypervMachineProperties - The properties of AddressResource +type HypervMachineProperties struct { + // Gets or sets the allocated Memory in MB. + AllocatedMemoryInMb *float64 + + // Gets or sets the BIOS GUID. + BiosGUID *string + + // Gets or sets the Machine BIOS serial number. + BiosSerialNumber *string + + // Gets or sets the firmware. + Firmware *string + + // Gets or sets the Number of Processor Cores allocated for the machine. + NumberOfProcessorCore *int32 + + // Gets or sets the Operating System Details installed on the machine. + OperatingSystemDetails *OperatingSystem + + // product support status. + ProductSupportStatus *ProductSupportStatus + + // Gets or sets the run as account ID of the machine. + RunAsAccountID *string + + // Gets or sets tags on the resource. + Tags map[string]*string + + // READ-ONLY; Gets the appliance names. + ApplianceNames []*string + + // READ-ONLY; Gets the data related to application discovery. + ApplicationDiscovery *ApplicationDiscovery + + // READ-ONLY; Apps And Roles of the Server. + AppsAndRoles *AppsAndRoles + + // READ-ONLY; Cluster FQDN/IPAddress. + ClusterFqdn *string + + // READ-ONLY; Cluster ARM ID. + ClusterID *string + + // READ-ONLY; Gets the marking machine creation. + CreatedTimestamp *string + + // READ-ONLY; Gets or sets a value indicating whether data protection is requested for a VM. + DataProtectionRequested *bool + + // READ-ONLY; Gets the data related to dependency map discovery. + DependencyMapDiscovery *DependencyMapDiscovery + + // READ-ONLY; Gets or sets if dependency mapping feature is enabled or not for the VM. + DependencyMapping *string + + // READ-ONLY; Gets or sets when dependency mapping collection was last disabled. + DependencyMappingEndTime *string + + // READ-ONLY; Gets or sets when dependency mapping collection is last started. + DependencyMappingStartTime *time.Time + + // READ-ONLY; Disks attached to the machine. + Disks []*HypervDisk + + // READ-ONLY; Gets the Display name of the machine. + DisplayName *string + + // READ-ONLY; Gets or sets a value indicating whether encryption of state and migration traffic is enabled for the VM. + EncryptStateAndVMMigrationTraffic *bool + + // READ-ONLY; Errors for machine. + Errors []*HealthErrorDetails + + // READ-ONLY; Generation of the virtual machine. + Generation *int32 + + // READ-ONLY; The last time at which the Guest Details was discovered or the error while discovering guest details based discovery + // of the machine. + GuestDetailsDiscoveryTimestamp *time.Time + + // READ-ONLY; Operating System Details extracted from the guest bu executing script inside the guest VM. + GuestOsDetails *GuestOsDetails + + // READ-ONLY; Value indicating whether the VM is highly available. + HighAvailability *HighAvailability + + // READ-ONLY; Host FQDN/IPAddress. + HostFqdn *string + + // READ-ONLY; Host ARM ID. + HostID *string + + // READ-ONLY; Gets the data related to iis discovery. + IisDiscovery *WebAppDiscovery + + // READ-ONLY; On-premise Instance UUID of the machine. + InstanceUUID *string + + // READ-ONLY; Value indicating whether VM is deleted. + IsDeleted *bool + + // READ-ONLY; Value indicating whether dynamic memory is enabled for the VM. + IsDynamicMemoryEnabled *bool + + // READ-ONLY; Whether Refresh Fabric Layout Guest Details has been completed once. + // Portal will show discovery in progress, if this value is true. + IsGuestDetailsDiscoveryInProgress *bool + + // READ-ONLY; Gets or sets a value indicating whether key storage device is enabled on the VM. + KsdEnabled *bool + + // READ-ONLY; Management server type captured as a string representation of the + // {Microsoft.Azure.FDS.WebRole.HyperVMachineBase.HyperVMachineBaseProperties.ManagementServerType} enumeration. + ManagementServerType *string + + // READ-ONLY; Max memory of the virtual machine in MB. + MaxMemoryMb *int32 + + // READ-ONLY; Network adapters attached to the machine. + NetworkAdapters []*HypervNetworkAdapter + + // READ-ONLY; Number of applications installed in the guest VM. + NumberOfApplications *int32 + + // READ-ONLY; Gets the data related to Oracle discovery. + OracleDiscovery *OracleDiscovery + + // READ-ONLY; Gets the Machine power status. + PowerStatus *string + + // READ-ONLY; The status of the last operation. + ProvisioningState *ProvisioningState + + // READ-ONLY; Gets the data related to SQL discovery. + SQLDiscovery *SQLDiscovery + + // READ-ONLY; Gets or sets a value indicating whether Secure boot is enabled for the VM. + SecureBootEnabled *bool + + // READ-ONLY; Gets or sets the SecureBootTemplateId setting of the VM. + SecureBootTemplate *string + + // READ-ONLY; Gets or sets the SecureBootTemplateId setting of the VM. + SecureBootTemplateID *string + + // READ-ONLY; Gets or sets a value indicating whether shielding is enabled for the VM. + ShieldingRequested *bool + + // READ-ONLY; Gets the data related to SpringBoot discovery. + SpringBootDiscovery *SpringBootDiscovery + + // READ-ONLY; Gets the data related to static discovery. + StaticDiscovery *StaticDiscovery + + // READ-ONLY; Gets the data related to tomcat discovery. + TomcatDiscovery *WebAppDiscovery + + // READ-ONLY; Gets or sets a value indicating whether trusted platform module is enabled on the VM. + TpmEnabled *bool + + // READ-ONLY; Gets the timestamp marking last updated on the machine. + UpdatedTimestamp *string + + // READ-ONLY; Gets the Root location of the VM configuration file. + VMConfigurationFileLocation *string + + // READ-ONLY; Gets the VM FQDN. + VMFqdn *string + + // READ-ONLY; VM version. + Version *string + + // READ-ONLY; Gets or sets a value indicating whether VM virtualization based security is enabled for the VM. + VirtualizationBasedSecurityOptOut *bool + + // READ-ONLY; Gets the data related to Web application discovery. + WebAppDiscovery *WebAppDiscovery +} + +// HypervMachineUpdate - The type used for update operations of the HypervMachine. +type HypervMachineUpdate struct { + // The updatable properties of the HypervMachine. + Properties *HypervMachineUpdateProperties +} + +// HypervMachineUpdateProperties - The updatable properties of the HypervMachine. +type HypervMachineUpdateProperties struct { + // Gets or sets the allocated Memory in MB. + AllocatedMemoryInMb *float64 + + // Gets or sets the BIOS GUID. + BiosGUID *string + + // Gets or sets the Machine BIOS serial number. + BiosSerialNumber *string + + // Gets or sets the firmware. + Firmware *string + + // Gets or sets the Number of Processor Cores allocated for the machine. + NumberOfProcessorCore *int32 + + // Gets or sets the Operating System Details installed on the machine. + OperatingSystemDetails *OperatingSystem + + // product support status. + ProductSupportStatus *ProductSupportStatus + + // Gets or sets the run as account ID of the machine. + RunAsAccountID *string + + // Gets or sets tags on the resource. + Tags map[string]*string +} + +// HypervNetworkAdapter - Second level object represented in responses as part of Machine REST resource. +type HypervNetworkAdapter struct { + // Gets or sets Type of the IP address. + IPAddressType *string + + // Gets or sets Mac address of the NIC. + MacAddress *string + + // Gets or sets Network Name. + NetworkName *string + + // Gets or sets the NIC Id. + NicID *string + + // READ-ONLY; Gets IP addresses for the machine. + IPAddressList []*string + + // READ-ONLY; Network Id. + NetworkID *string + + // READ-ONLY; Mac address of the NIC. + NicType *string + + // READ-ONLY; Static IP address. + StaticIPAddress *string + + // READ-ONLY; Name of the VM subnet within the virtual network the NIC is attached to. + SubnetName *string +} + +// HypervOperationsStatusResource - A cluster resource belonging to a site resource. +type HypervOperationsStatusResource struct { + // The resource-specific properties for this resource. + Properties *HypervClusterProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// HypervRunAsAccountResource - A machine resource belonging to a site resource. +type HypervRunAsAccountResource struct { + // The resource-specific properties for this resource. + Properties *RunAsAccountProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// HypervRunAsAccountResourceListResult - The response of a HypervRunAsAccountResource list operation. +type HypervRunAsAccountResourceListResult struct { + // REQUIRED; The HypervRunAsAccountResource items on this page + Value []*HypervRunAsAccountResource + + // The link to the next page of items + NextLink *string +} + +// HypervSite - A HyperV SiteResource +type HypervSite struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *SiteProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// HypervSiteListResult - The response of a HypervSite list operation. +type HypervSiteListResult struct { + // REQUIRED; The HypervSite items on this page + Value []*HypervSite + + // The link to the next page of items + NextLink *string +} + +// HypervSiteUpdate - The type used for update operations of the HypervSite. +type HypervSiteUpdate struct { + // The updatable properties of the HypervSite. + Properties *HypervSiteUpdateProperties + + // Resource tags. + Tags map[string]*string +} + +// HypervSiteUpdateProperties - The updatable properties of the HypervSite. +type HypervSiteUpdateProperties struct { + // Gets or sets the on-premises agent details. + AgentDetails *SiteAgentProperties + + // Gets or sets the Appliance Name. + ApplianceName *string + + // Gets or sets the ARM ID of migration hub solution for SDS. + DiscoverySolutionID *string + + // The status of the last operation. + ProvisioningState *ProvisioningState + + // Gets or sets the service principal identity details used by agent for communication to the service. + ServicePrincipalIdentityDetails *SiteSpnProperties +} + +// HypervSiteUsage - Hyper-V site usage. +type HypervSiteUsage struct { + // Gets or sets the number of clusters part of the site. + ClusterCount *int32 + + // Gets or sets the number of hosts part of the site. + HostCount *int32 + + // Gets or sets the number of machines discovered in the site. + MachineCount *int32 + + // Gets or sets the number of run as accounts in the site. + RunAsAccountCount *int32 +} + +// HypervVMSoftwareInventory - HyperV VM software inventory REST resource. +type HypervVMSoftwareInventory struct { + // The resource-specific properties for this resource. + Properties *MachineSoftwareInventoryProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// HypervVMSoftwareInventoryListResult - The response of a HypervVmSoftwareInventory list operation. +type HypervVMSoftwareInventoryListResult struct { + // REQUIRED; The HypervVmSoftwareInventory items on this page + Value []*HypervVMSoftwareInventory + + // The link to the next page of items + NextLink *string +} + +// IisApplicationUnit - Second-level object for identification of application units in a web site hosted on IIS. +type IisApplicationUnit struct { + // Gets or sets the path of the directory. + ApplicationPoolName *string + + // Gets or sets the list of directories. + Directories []*DirectoryPath + + // Gets or sets a value indicating whether 32 bit applications are allowed to run on 64 bit. + Enable32BitAPIOnWin64 *bool + + // Gets or sets the managed pipeline mode. + ManagedPipelineMode *string + + // Gets or sets the path of the directory. + Path *DirectoryPath + + // Gets or sets the runtime version. + RuntimeVersion *string +} + +// IisVirtualApplicationUnit - Second-level object for identification of virtual applications in a web site hosted on IIS. +type IisVirtualApplicationUnit struct { + // Gets or sets the list of directories. + Directories []*DirectoryPath + + // Gets or sets the path of the directory. + Path *DirectoryPath + + // READ-ONLY; Gets a value indicating whether the application corresponds to a directory. + IsVirtualDirectory *bool +} + +// IisWebApplicationProperties - Class for web application properties. +type IisWebApplicationProperties struct { + // Gets or sets tags on the resource. + Tags map[string]*string + + // READ-ONLY; Gets the appliance names. + ApplianceNames []*string + + // READ-ONLY; Gets the list of application units for the web site. + Applications []*IisApplicationUnit + + // READ-ONLY; Gets the front end bindings for the application. + Bindings []*FrontEndBinding + + // READ-ONLY; Gets the configuration. + Configurations []*WebApplicationConfigurationUnit + + // READ-ONLY; Gets the timestamp marking creation of the entity. + CreatedTimestamp *string + + // READ-ONLY; Gets the directories. + Directories []*WebApplicationDirectoryUnit + + // READ-ONLY; Gets the display name. + DisplayName *string + + // READ-ONLY; Gets the Error details. + Errors []*HealthErrorDetails + + // READ-ONLY; Gets the Error details. + Frameworks []*WebApplicationFramework + + // READ-ONLY; Gets a value indicating whether the WebApp has errors or not. + HasErrors *bool + + // READ-ONLY; Gets a value indicating whether application is deleted. + IsDeleted *bool + + // READ-ONLY; Gets the list of machine ARM Ids on which the SQL server is deployed. + MachineArmIDs []*string + + // READ-ONLY; Machine display name + MachineDisplayName *string + + // READ-ONLY; Gets the physical path of the application. + PhysicalPath *string + + // READ-ONLY; provisioning state enum + ProvisioningState *ProvisioningState + + // READ-ONLY; Gets the server type. + ServerType *string + + // READ-ONLY; Static folders. + StaticFolders []*string + + // READ-ONLY; Gets the timestamp marking last update operation. + UpdatedTimestamp *string + + // READ-ONLY; Gets the list of application units for the web site. + VirtualApplications []*IisVirtualApplicationUnit + + // READ-ONLY; Gets the virtual path of the application. + VirtualPath *string + + // READ-ONLY; Gets the web server id. + WebServerID *string + + // READ-ONLY; Gets the web server name. + WebServerName *string +} + +// IisWebApplications - Web application REST Resource. +type IisWebApplications struct { + // The resource-specific properties for this resource. + Properties *IisWebApplicationProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// IisWebApplicationsListResult - The response of a IisWebApplications list operation. +type IisWebApplicationsListResult struct { + // REQUIRED; The IisWebApplications items on this page + Value []*IisWebApplications + + // The link to the next page of items + NextLink *string +} + +// IisWebApplicationsUpdate - The type used for update operations of the IisWebApplications. +type IisWebApplicationsUpdate struct { + // The updatable properties of the IisWebApplications. + Properties *IisWebApplicationsUpdateProperties +} + +// IisWebApplicationsUpdateProperties - The updatable properties of the IisWebApplications. +type IisWebApplicationsUpdateProperties struct { + // Gets or sets tags on the resource. + Tags map[string]*string +} + +// IisWebServerProperties - Class for web server properties. +type IisWebServerProperties struct { + // READ-ONLY; Gets the appliance names. + ApplianceNames []*string + + // READ-ONLY; Gets the configuration location. + ConfigurationLocation *string + + // READ-ONLY; Gets the timestamp marking creation of the entity. + CreatedTimestamp *string + + // READ-ONLY; Gets the display name. + DisplayName *string + + // READ-ONLY; Gets the Error details. + Errors []*HealthErrorDetails + + // READ-ONLY; Gets a value indicating whether the WebApp has errors or not. + HasErrors *bool + + // READ-ONLY; Gets a value indicating whether application is deleted. + IsDeleted *bool + + // READ-ONLY; Gets the list of machines. + MachineIDs []*string + + // READ-ONLY; provisioning state enum + ProvisioningState *ProvisioningState + + // READ-ONLY; Gets the run as account id. + RunAsAccountID *string + + // READ-ONLY; Gets the server FQDN. + ServerFqdn *string + + // READ-ONLY; Gets the server type. + ServerType *string + + // READ-ONLY; Gets the timestamp marking last update operation. + UpdatedTimestamp *string + + // READ-ONLY; Gets the configuration location. + Version *string + + // READ-ONLY; Gets the list of web applications. + WebApplications []*string +} + +// IisWebServers - Web server REST Resource. +type IisWebServers struct { + // The resource-specific properties for this resource. + Properties *IisWebServerProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// IisWebServersListResult - The response of a IisWebServers list operation. +type IisWebServersListResult struct { + // REQUIRED; The IisWebServers items on this page + Value []*IisWebServers + + // The link to the next page of items + NextLink *string +} + +// ImportJob - A host resource belonging to a site resource. +type ImportJob struct { + // The resource-specific properties for this resource. + Properties *JobProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ImportJobListResult - The response of a ImportJob list operation. +type ImportJobListResult struct { + // REQUIRED; The ImportJob items on this page + Value []*ImportJob + + // The link to the next page of items + NextLink *string +} + +// ImportMachine - An machine resource belonging to a site resource. +type ImportMachine struct { + // The resource-specific properties for this resource. + Properties *ImportMachineProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ImportMachineListResult - The response of a ImportMachine list operation. +type ImportMachineListResult struct { + // REQUIRED; The ImportMachine items on this page + Value []*ImportMachine + + // The link to the next page of items + NextLink *string +} + +// ImportMachineProperties - Class for machine properties. +type ImportMachineProperties struct { + // REQUIRED; machine tags + Tags map[string]*string + + // Gets or sets the allocated Memory in MB. + AllocatedMemoryInMb *float64 + + // Gets or sets the BIOS GUID. + BiosGUID *string + + // Gets or sets the Machine BIOS serial number. + BiosSerialNumber *string + + // Gets or sets the Number of Processor Cores allocated for the machine. + NumberOfProcessorCore *int32 + + // Gets or sets the Operating System Details installed on the machine. + OperatingSystemDetails *WebRoleOperatingSystem + + // The status of the last operation. + ProvisioningState *ProvisioningState + + // READ-ONLY; Gets the marking machine creation. + CreatedTimestamp *string + + // READ-ONLY; Disks attached to the machine. + Disks []*WebRoleImportDisk + + // READ-ONLY; Gets the Display name of the machine. + DisplayName *string + + // READ-ONLY; Firmware of the machine. + Firmware *string + + // READ-ONLY; Fabric type. + Hypervisor *string + + // READ-ONLY; Hypervisor version number. + HypervisorVersionNumber *string + + // READ-ONLY; IP Addresses. + IPAddresses []*string + + // READ-ONLY; Value indicating whether VM is deleted. + IsDeleted *bool + + // READ-ONLY; MAC Address. + MacAddress *string + + // READ-ONLY; Machine ID. + MachineID *string + + // READ-ONLY; Machine manager ID. + MachineManagerID *string + + // READ-ONLY; Network in throughput. + NetworkInThroughput *float32 + + // READ-ONLY; Network out throughput. + NetworkOutThroughput *float32 + + // READ-ONLY; Number of disks. + NumberOfDisks *int32 + + // READ-ONLY; Number of network adapters. + NumberOfNetworkAdapters *int32 + + // READ-ONLY; CPU utilization. + PercentageCPUUtilization *float32 + + // READ-ONLY; Memory utilization. + PercentageMemoryUtilization *float32 + + // READ-ONLY; Server type. + ServerType *string + + // READ-ONLY; Total storage in use. + StorageInUseGb *float32 + + // READ-ONLY; Total disk read operations per second. + TotalDiskReadOperationsPerSecond *float32 + + // READ-ONLY; Total disk read throughput. + TotalDiskReadThroughput *float32 + + // READ-ONLY; Total disk write operations per second. + TotalDiskWriteOperationsPerSecond *float32 + + // READ-ONLY; Total disk write throughput. + TotalDiskWriteThroughput *float32 + + // READ-ONLY; Gets the timestamp marking last updated on the machine. + UpdatedTimestamp *string + + // READ-ONLY; Server FQDN. + VMFqdn *string +} + +// ImportMachinesJob - Import machines Job REST Resource. +type ImportMachinesJob struct { + // Gets or sets the Display name. + DisplayName *string + + // Gets or sets the Job end time. + EndTime *string + + // Gets or sets the relative ARM name to get job. + ID *string + + // Gets or sets the Job ID. + Name *string + + // Gets or sets the import job properties. + Properties *ImportMachinesJobProperties + + // Gets or sets the Job start time. + StartTime *string + + // Gets or sets the Job status. + Status *string + + // READ-ONLY; Handled by resource provider. Type = Microsoft.OffAzure/ImportSites/jobs/importJobs. + Type *string +} + +// ImportMachinesJobProperties - ImportMachines JobProperties +type ImportMachinesJobProperties struct { + // blob Creation TimeStamp + BlobCreationTimeStamp *time.Time + + // blob name + BlobName *string + + // blob sasUri + BlobSasURI *string + + // error summary + ErrorSummary *JobErrorSummary + + // job Result + JobResult *JobResult + + // number Of Machines Imported + NumberOfMachinesImported *int32 +} + +// ImportSite - A ImportSite +type ImportSite struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *ImportSiteProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ImportSiteListResult - The response of a ImportSite list operation. +type ImportSiteListResult struct { + // REQUIRED; The ImportSite items on this page + Value []*ImportSite + + // The link to the next page of items + NextLink *string +} + +// ImportSiteProperties - The properties of ImportSiteResource +type ImportSiteProperties struct { + // Gets or sets the ARM ID of migration hub solution for SDS. + DiscoverySolutionID *string + + // The status of the last operation. + ProvisioningState *ProvisioningState + + // READ-ONLY; Gets the Master Site this site is linked to. + MasterSiteID *string + + // READ-ONLY; Gets the service endpoint. + ServiceEndpoint *string +} + +// ImportSiteUpdate - The type used for update operations of the ImportSite. +type ImportSiteUpdate struct { + // The updatable properties of the ImportSite. + Properties *ImportSiteUpdateProperties + + // Resource tags. + Tags map[string]*string +} + +// ImportSiteUpdateProperties - The updatable properties of the ImportSite. +type ImportSiteUpdateProperties struct { + // Gets or sets the ARM ID of migration hub solution for SDS. + DiscoverySolutionID *string + + // The status of the last operation. + ProvisioningState *ProvisioningState +} + +// JobErrorSummary - Job Error Summary +type JobErrorSummary struct { + // error count + ErrorCount *int32 + + // errors list + Errors []*string + + // warning Count + WarningCount *int32 +} + +// JobProperties - Job REST Resource. +type JobProperties struct { + // READ-ONLY; Gets the activity Id used in the operation execution context. + ActivityID *string + + // READ-ONLY; Gets the client request Id used in the operation execution context. + ClientRequestID *string + + // READ-ONLY; Gets or sets the display name of the Job. + DisplayName *string + + // READ-ONLY; Gets operation end time. + EndTime *string + + // READ-ONLY; Gets the errors. + Errors []*ErrorDetails + + // READ-ONLY; The status of the last operation. + ProvisioningState *ProvisioningState + + // READ-ONLY; Gets operation start time. + StartTime *string + + // READ-ONLY; Gets operation status. + Status *string +} + +// MachineMetadata - The properties of Machine MetaData +type MachineMetadata struct { + // REQUIRED; value representing state of dependency mapping (enabled/disabled). + DependencyMapping *string + + // REQUIRED; arm id of the machine. + MachineArmID *string + + // REQUIRED; machine tags + Tags map[string]*string +} + +// MachineMetadataCollection - The list of Machine MetaData. +type MachineMetadataCollection struct { + // REQUIRED; The list of Machine MetaData. + Value []*MachineMetadata +} + +// MachineResource - An machine resource belonging to a site resource. +type MachineResource struct { + // The resource-specific properties for this resource. + Properties *VmwareMachineProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// MachineResourceListResult - The response of a MachineResource list operation. +type MachineResourceListResult struct { + // REQUIRED; The MachineResource items on this page + Value []*MachineResource + + // The link to the next page of items + NextLink *string +} + +// MachineResourceUpdate - The type used for update operations of the MachineResource. +type MachineResourceUpdate struct { + // The updatable properties of the MachineResource. + Properties *MachineResourceUpdateProperties +} + +// MachineResourceUpdateProperties - The updatable properties of the MachineResource. +type MachineResourceUpdateProperties struct { + // Gets or sets the allocated Memory in MB. + AllocatedMemoryInMb *float64 + + // Gets or sets the BIOS GUID. + BiosGUID *string + + // Gets or sets the Machine BIOS serial number. + BiosSerialNumber *string + + // Gets or sets the firmware. + Firmware *string + + // Gets or sets the Number of Processor Cores allocated for the machine. + NumberOfProcessorCore *int32 + + // Gets or sets the Operating System Details installed on the machine. + OperatingSystemDetails *OperatingSystem + + // product support status. + ProductSupportStatus *ProductSupportStatus + + // Gets or sets the run as account ID of the machine. + RunAsAccountID *string + + // Gets or sets tags on the VMware machine. + Tags map[string]*string +} + +// MachineSoftwareInventoryProperties - Class for machine software inventory properties. +type MachineSoftwareInventoryProperties struct { + // READ-ONLY; Apps And Roles of the machine entity. + AppsAndRoles *AppsAndRoles + + // READ-ONLY; provisioning state enum + ProvisioningState *ProvisioningState +} + +// MasterSite - A MasterSite +type MasterSite struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *MasterSiteProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// MasterSiteListResult - The response of a MasterSite list operation. +type MasterSiteListResult struct { + // REQUIRED; The MasterSite items on this page + Value []*MasterSite + + // The link to the next page of items + NextLink *string +} + +// MasterSiteProperties - Class for site properties. +type MasterSiteProperties struct { + // Gets or sets a value indicating whether multiple sites per site type are allowed. + AllowMultipleSites *bool + + // Gets or sets a value for customer storage account ARM id. + CustomerStorageAccountArmID *string + + // Gets or sets the state of public network access. + PublicNetworkAccess *MasterSitePropertiesPublicNetworkAccess + + // Gets or sets the sites that are a part of Master Site. The key should contain the Site ARM name. + Sites []*string + + // READ-ONLY; Gets the nested sites under Master Site. + NestedSites []*string + + // READ-ONLY; Gets the private endpoint connections. + PrivateEndpointConnections []*PrivateEndpointConnection + + // READ-ONLY; provisioning state enum + ProvisioningState *ProvisioningState +} + +// MasterSiteUpdate - The type used for update operations of the MasterSite. +type MasterSiteUpdate struct { + // The updatable properties of the MasterSite. + Properties *MasterSiteUpdateProperties + + // Resource tags. + Tags map[string]*string +} + +// MasterSiteUpdateProperties - The updatable properties of the MasterSite. +type MasterSiteUpdateProperties struct { + // Gets or sets a value indicating whether multiple sites per site type are allowed. + AllowMultipleSites *bool + + // Gets or sets a value for customer storage account ARM id. + CustomerStorageAccountArmID *string + + // Gets or sets the state of public network access. + PublicNetworkAccess *MasterSitePropertiesPublicNetworkAccess + + // Gets or sets the sites that are a part of Master Site. The key should contain the Site ARM name. + Sites []*string +} + +// OperatingSystem - Second level object returned as part of Machine REST resource. +type OperatingSystem struct { + // Gets or sets the Architecture of the operating system. + OSArchitecture *string + + // Gets or sets the Name of the operating system. + OSName *string + + // Gets or sets the type of the operating system. + OSType *string + + // Gets or sets the Version of the operating system. + OSVersion *string +} + +// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +type Operation struct { + // Localized display information for this particular operation. + Display *OperationDisplay + + // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + ActionType *ActionType + + // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane + // operations. + IsDataAction *bool + + // READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", + // "Microsoft.Compute/virtualMachines/capture/action" + Name *string + + // READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + // value is "user,system" + Origin *Origin +} + +// OperationDisplay - Localized display information for this particular operation. +type OperationDisplay struct { + // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. + Description *string + + // READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual + // Machine", "Restart Virtual Machine". + Operation *string + + // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + // Compute". + Provider *string + + // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + // Schedule Collections". + Resource *string +} + +// OperationListResult - A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to +// get the next set of results. +type OperationListResult struct { + // READ-ONLY; URL to get the next set of operation list results (if there are any). + NextLink *string + + // READ-ONLY; List of operations supported by the resource provider + Value []*Operation +} + +// OperationStatus - Operation status REST resource. +type OperationStatus struct { + // READ-ONLY; Gets the start time. + EndTime *string + + // READ-ONLY; Gets the error. + Error *OperationStatusError + + // READ-ONLY; Gets the Id. + ID *string + + // READ-ONLY; Gets the operation name. + Name *string + + // READ-ONLY; Operation status properties + Properties *OperationStatusProperties + + // READ-ONLY; Gets the start time. + StartTime *string + + // READ-ONLY; Gets the status of the operation. ARM expects the terminal status to be one of Succeeded/ Failed/ Canceled. + // All other values imply that the operation is still running. + Status *string +} + +// OperationStatusError - Class for operation status errors. +type OperationStatusError struct { + // READ-ONLY; Gets the error code. + Code *string + + // READ-ONLY; Gets the error message. + Message *string +} + +// OperationStatusProperties - Class for operation result properties. +type OperationStatusProperties struct { + // Gets or sets the result or output of the workflow. + Result *string +} + +// OracleDiscovery - Data related to a machine's Oracle discovery. +type OracleDiscovery struct { + // Gets or sets status of partner discovery. + DiscoveryScopeStatus *DiscoveryScopeStatus + + // Gets or sets status of partner shallow discovery. + ShallowDiscoveryStatus *ShallowDiscoveryStatus + + // Gets or sets number of successfully discovered databases. + TotalDatabaseCount *int64 + + // Gets or sets number of successfully discovered instances. + TotalInstanceCount *int64 +} + +// OtherDatabase in the guest virtual machine. +type OtherDatabase struct { + // READ-ONLY; Gets or sets DatabaseType of the OtherDatabase. + DatabaseType *string + + // READ-ONLY; Gets or sets Instance of the OtherDatabase. + Instance *string + + // READ-ONLY; Gets or sets Version of the OtherDatabase. + Version *string +} + +// PagedDeleteImportMachinesJob - Paged collection of DeleteImportMachinesJob items +type PagedDeleteImportMachinesJob struct { + // READ-ONLY; The link to the next page of items + NextLink *string + + // READ-ONLY; The DeleteImportMachinesJob items on this page + Value []*DeleteImportMachinesJob +} + +// PagedExportImportedMachinesJob - Paged collection of ExportImportedMachinesJob items +type PagedExportImportedMachinesJob struct { + // READ-ONLY; The link to the next page of items + NextLink *string + + // READ-ONLY; The ExportImportedMachinesJob items on this page + Value []*ExportImportedMachinesJob +} + +// PagedImportMachinesJob - Paged collection of ImportMachinesJob items +type PagedImportMachinesJob struct { + // READ-ONLY; The link to the next page of items + NextLink *string + + // READ-ONLY; The ImportMachinesJob items on this page + Value []*ImportMachinesJob +} + +// PrivateEndpointConnection - REST model used to encapsulate Private Link properties for tracked resources. +type PrivateEndpointConnection struct { + // The resource-specific properties for this resource. + Properties *PrivateEndpointConnectionPropertiesV2 + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// PrivateEndpointConnectionListResult - The response of a PrivateEndpointConnection list operation. +type PrivateEndpointConnectionListResult struct { + // REQUIRED; The PrivateEndpointConnection items on this page + Value []*PrivateEndpointConnection + + // The link to the next page of items + NextLink *string +} + +// PrivateEndpointConnectionPropertiesV2 - PrivateEndpointConnectionProperties V2 +type PrivateEndpointConnectionPropertiesV2 struct { + // private endpoints connection state + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState + + // READ-ONLY; array of group ids + GroupIDs []*string + + // READ-ONLY; private endpoints + PrivateEndpoint *ResourceID + + // READ-ONLY; provisioning state enum + ProvisioningState *ProvisioningState +} + +// PrivateLinkResource - REST model used to encapsulate Private Link properties for tracked resources. +type PrivateLinkResource struct { + // The resource-specific properties for this resource. + Properties *PrivateLinkResourceProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// PrivateLinkResourceListResult - The response of a PrivateLinkResource list operation. +type PrivateLinkResourceListResult struct { + // REQUIRED; The PrivateLinkResource items on this page + Value []*PrivateLinkResource + + // The link to the next page of items + NextLink *string +} + +// PrivateLinkResourceProperties - private link resource properties model +type PrivateLinkResourceProperties struct { + // group id + GroupID *string + + // required members + RequiredMembers []*string + + // required zone names + RequiredZoneNames []*string + + // READ-ONLY; provisioning state enum + ProvisioningState *ProvisioningState +} + +// PrivateLinkServiceConnectionState - Service Connection State +type PrivateLinkServiceConnectionState struct { + // actions required + ActionsRequired *string + + // description string + Description *string + + // state status + Status *PrivateLinkServiceConnectionStateStatus +} + +// ProcessorInfo - Processor Information. +type ProcessorInfo struct { + // Gets or sets the name\model of a processor. + Name *string + + // Gets or sets the total number of cores in a socket. + NumberOfCoresPerSocket *int32 + + // Gets or sets the number of sockets. + NumberOfSockets *int32 +} + +// ProductSupportStatus - product support status. +type ProductSupportStatus struct { + // current version. + CurrentVersion *string + + // esu status. + EsuStatus *EsuStatus + + // esu year. + EsuYear *EsuYear + + // support end date. + SupportEndDate *time.Time + + // support status. + SupportStatus *SupportStatus +} + +// ProxyResource - The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a +// location +type ProxyResource struct { + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ProxySiteRefreshBody - Request body for Proxy site refresh action. +type ProxySiteRefreshBody struct { + // Gets or sets the appliance name of the agent in the site. + ApplianceName *string +} + +// RequestExportMachineErrorsProperties - The Properties class for export machine errors request body. +type RequestExportMachineErrorsProperties struct { + // Gets or sets the discovery scope. + DiscoveryScope *ExportMachineErrorsProperties +} + +// Resource - Common fields that are returned in the response for all Azure Resource Manager resources +type Resource struct { + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ResourceID - PrivateEndpointModelsResourceId +type ResourceID struct { + // READ-ONLY; id name + ID *string +} + +// RunAsAccountMachineInput - Machine class. +type RunAsAccountMachineInput struct { + // Gets or sets the ARM id of the machine. + MachineID *string + + // run as AccountId + RunAsAccountID *string +} + +// RunAsAccountProperties - Class for run as account properties. +type RunAsAccountProperties struct { + // READ-ONLY; Gets the appliance name of the run as account. + ApplianceName *string + + // READ-ONLY; Timestamp marking run as account creation. + CreatedTimestamp *string + + // READ-ONLY; Gets the credential type of the run as account. + CredentialType *string + + // READ-ONLY; Display name of the run as account. + DisplayName *string + + // READ-ONLY; provisioning state enum + ProvisioningState *ProvisioningState + + // READ-ONLY; Timestamp marking last updated on the run as account. + UpdatedTimestamp *string +} + +// SQLAvailabilityGroup - Class representing the web model of SQL Availability Group. +type SQLAvailabilityGroup struct { + // The resource-specific properties for this resource. + Properties *SQLAvailabilityGroupProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// SQLAvailabilityGroupListResult - The response of a SqlAvailabilityGroup list operation. +type SQLAvailabilityGroupListResult struct { + // REQUIRED; The SqlAvailabilityGroup items on this page + Value []*SQLAvailabilityGroup + + // The link to the next page of items + NextLink *string +} + +// SQLAvailabilityGroupProperties - Class for SQL Server availability group properties. +type SQLAvailabilityGroupProperties struct { + // Gets or sets the SQL Availability Group Name. + AvailabilityGroupName *string + + // Gets or sets the type of availability group. Currently there are two types of AGs Traditional and Distributed. + AvailabilityGroupType *SQLAvailabilityGroupPropertiesAvailabilityGroupType + + // Gets or sets the Cluster name where AG is hosted. + ClusterName *string + + // Gets or sets the marking machine creation. + CreatedTimestamp *string + + // Gets or sets a value indicating whether the entity is deleted. + IsDeleted *bool + + // Gets or sets a value indicating whether AG is multi subnet or not. + IsMultiSubNet *bool + + // Gets or sets a value indicating whether this Availability group is part of a distributed AG. + IsPartOfDistributedAvailabilityGroup *bool + + // Gets or sets the timestamp marking last updated on the machine. + UpdatedTimestamp *string + + // READ-ONLY; Gets the list of availability replica properties which together forms this availability group. + AvailabilityReplicas []*SQLAvailabilityReplicaProperties + + // READ-ONLY; Gets the parent availability replica overview if any. This would be set with details of parent AG and AR for + // cases where this availability group is a part of a distributed AG. Currently, we do not + // populate this since discovery and linking of DAG(Distributed Availability Group) is not implemented. + ParentReplicaOverviewList []*SQLAvailabilityReplicaOverview + + // READ-ONLY; provisioning state enum + ProvisioningState *ProvisioningState +} + +// SQLAvailabilityGroupReplicaInfo - Class which represents the SQL availability replica properties of type AG. +type SQLAvailabilityGroupReplicaInfo struct { + // Gets or sets the AG ARM ID which are part of this Replica. + AvailabilityGroupArmID *string + + // Gets or sets the name of the availability replica. + AvailabilityGroupName *string + + // Gets or sets the name of the cluster on which this replica is hosted. + ClusterName *string +} + +// SQLAvailabilityReplicaOverview - Web model for SQL replica overview. +type SQLAvailabilityReplicaOverview struct { + // Gets or sets the Availability Group Id in which this database participates if any. It would be set if the database has + // {Microsoft.Azure.FDS.CosmosDB.SqlDatabaseEntity.IsDatabaseHighlyAvailable} has a + // value "true". + AvailabilityGroupArmID *string + + // Gets or sets the SQL Availability group name. + AvailabilityGroupName *string + + // Gets or sets the SQL Availability Replica Id within the Availability Group this database is a part of. + AvailabilityReplicaID *string + + // Gets or sets the state of the availability replica. + ReplicaState *SQLAvailabilityReplicaOverviewReplicaState +} + +// SQLAvailabilityReplicaProperties - Class for SQL Server availability replica properties. +type SQLAvailabilityReplicaProperties struct { + // Gets or sets the SQL Availability Replica Id. + AvailabilityReplicaID *string + + // Gets or sets the SQL Availability Replica Name. + AvailabilityReplicaName *string + + // Gets or sets the commit mode of the replica. + ReplicaCommitMode *SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaCommitMode + + // Gets or sets the read mode of the replica. + ReplicaReadMode *SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaReadMode + + // Gets or sets the seed mode of the replica. + ReplicaSeedMode *SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSeedMode + + // Gets or sets the state of the availability replica. + ReplicaState *SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaState + + // Gets or sets the synchronization status of the replica. + ReplicaSyncStatus *SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaSyncStatus + + // Gets or sets the replica type of the availability group. + ReplicaType *SQLAvailabilityGroupSQLAvailabilityReplicaPropertiesReplicaType + + // Gets or sets the Availability Replica object if Replica is of type AG. This is null in case Replica is of type database. + // This is to be populated in case AG is of type DAG. + SQLAvailabilityGroupReplicaInfo *SQLAvailabilityGroupReplicaInfo + + // Gets or sets the Availability Replica object if Replica is of type database. This is null in case Replica is of type AG. + // This is to be populated in case of normal AG. + SQLDatabaseReplicaInfo *SQLDatabaseReplicaInfo +} + +// SQLDatabasePropertiesV2 - Class for SQL Server database properties. +type SQLDatabasePropertiesV2 struct { + // Gets or sets the database compatibility level. + CompatibilityLevel *string + + // Gets or sets the marking machine creation. + CreatedTimestamp *string + + // Gets or sets the SQL database name. + DatabaseName *string + + // Gets or sets the hostname. + Hostname *string + + // Gets or sets a value indicating whether this database is a part of an HA setup. + IsDatabaseHighlyAvailable *bool + + // Gets or sets a value indicating whether the entity is deleted. + IsDeleted *bool + + // Gets or sets the Replica overview. + ParentReplicaOverview *SQLAvailabilityReplicaOverview + + // The status of the last operation. + ProvisioningState *ProvisioningState + + // Gets or sets the SQL Server ARM Id in which the database resides. + SQLServerArmID *string + + // Gets or sets the SQL Server Id in which the database resides. + SQLServerName *string + + // Gets or sets the size in Mb. + SizeMb *float32 + + // Gets or sets the status. + Status *string + + // Gets or sets the timestamp marking last updated on the machine. + UpdatedTimestamp *string + + // READ-ONLY; Gets the errors. + Errors []*Errors + + // READ-ONLY; Gets the file metadata list. + FileMetadataList []*FileMetaData +} + +// SQLDatabaseReplicaInfo - Class which represents the SQL availability replica properties of type databases. +type SQLDatabaseReplicaInfo struct { + // Gets or sets the host name of the availability replica. + HostName *string + + // Gets or sets the SQL Server name of the availability replica. + SQLServerArmID *string + + // Gets or sets the SQL Server name of the availability replica. + SQLServerName *string +} + +// SQLDatabaseV2 - Class representing the web model of SQL Database. +type SQLDatabaseV2 struct { + // The resource-specific properties for this resource. + Properties *SQLDatabasePropertiesV2 + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// SQLDatabaseV2ListResult - The response of a SqlDatabaseV2 list operation. +type SQLDatabaseV2ListResult struct { + // REQUIRED; The SqlDatabaseV2 items on this page + Value []*SQLDatabaseV2 + + // The link to the next page of items + NextLink *string +} + +// SQLDiscovery - Contains data related SQL discovery. +type SQLDiscovery struct { + // discovery Scope Status + DiscoveryScopeStatus *SQLDiscoveryScopeStatus + + // sql Metadata DiscoveryPipe + SQLMetadataDiscoveryPipe *SQLMetadataDiscoveryPipe + + // sql Metadata Hydrated RunAsAccountId + SQLMetadataHydratedRunAsAccountID *string + + // successfully Discovered ServerCount + SuccessfullyDiscoveredServerCount *int32 + + // total Server Count + TotalServerCount *int32 +} + +// SQLDiscoverySiteDataSource - A SQL discovery site data source resource. +type SQLDiscoverySiteDataSource struct { + // The resource-specific properties for this resource. + Properties *SQLDiscoverySiteDataSourceProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// SQLDiscoverySiteDataSourceListResult - The response of a SqlDiscoverySiteDataSource list operation. +type SQLDiscoverySiteDataSourceListResult struct { + // REQUIRED; The SqlDiscoverySiteDataSource items on this page + Value []*SQLDiscoverySiteDataSource + + // The link to the next page of items + NextLink *string +} + +// SQLDiscoverySiteDataSourceProperties - Discovery site data source properties class. +type SQLDiscoverySiteDataSourceProperties struct { + // Gets or sets the discovery site Id. + DiscoverySiteID *string + + // READ-ONLY; provisioning state enum + ProvisioningState *ProvisioningState +} + +// SQLFciProperties - The class representing the properties for an FCI instance. +type SQLFciProperties struct { + // Gets or sets a value indicating whether the FCI is hosted on possible owners which are in multiple subnets. + IsMultiSubnet *bool + + // Gets or sets the FCI Network Name used to connect to this FCI instance. + NetworkName *string + + // Gets or sets the count of Shared Disks for SQL FCI. + SharedDiskCount *int32 + + // Gets or sets the state of the FCI instance. + State *FCIInstanceState +} + +// SQLJob - Class representing the web model of SQL Database. +type SQLJob struct { + // The resource-specific properties for this resource. + Properties *JobProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// SQLJobListResult - The response of a SqlJob list operation. +type SQLJobListResult struct { + // REQUIRED; The SqlJob items on this page + Value []*SQLJob + + // The link to the next page of items + NextLink *string +} + +// SQLMachineOverview - Gets or sets SQL machine overview data. +type SQLMachineOverview struct { + // Gets or sets SQL machine display name. + DisplayName *string + + // Gets or sets SQL machine FCI role. + FciRole *SQLMachineOverviewFciRole + + // Gets or sets SQL machine ARM ID. + MachineArmID *string +} + +// SQLRunAsAccount - A runasaccount resource belonging to a site resource. +type SQLRunAsAccount struct { + // The resource-specific properties for this resource. + Properties *RunAsAccountProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// SQLRunAsAccountListResult - The response of a SqlRunAsAccount list operation. +type SQLRunAsAccountListResult struct { + // REQUIRED; The SqlRunAsAccount items on this page + Value []*SQLRunAsAccount + + // The link to the next page of items + NextLink *string +} + +// SQLServerApplication - SQLServer in the guest virtual machine. +type SQLServerApplication struct { + // READ-ONLY; Gets or sets ClusterName of the SQLServer. + ClusterName *string + + // READ-ONLY; Gets or sets Clustered of the SQLServer. + Clustered *string + + // READ-ONLY; Gets or sets the comma separated IPs of the SQLServer. + CommaSeparatedIPs *string + + // READ-ONLY; Gets or sets the DNS host name of SQLServer. + DNSHostName *string + + // READ-ONLY; Gets or sets Edition of the SQLServer. + Edition *string + + // READ-ONLY; Gets or sets the value which reflects if Named Pipe is enabled or not. + IsNamedPipeEnabled *bool + + // READ-ONLY; Gets or sets the value which reflects if Named Pipe is enabled or not. + IsTCPIPEnabled *bool + + // READ-ONLY; Gets or sets Name of the SQLServer. + Name *string + + // READ-ONLY; Gets the status. + NamedPipeName *string + + // READ-ONLY; Gets or sets the port of the SQLServer. + Port *string + + // READ-ONLY; Gets or sets ServicePack of the SQLServer. + ServicePack *string + + // READ-ONLY; Gets the status. + Status *string + + // READ-ONLY; Gets or sets Version of the SQLServer. + Version *string +} + +// SQLServerProperties - Class for SQL Server properties. +type SQLServerProperties struct { + // Gets or sets the marking machine creation. + CreatedTimestamp *string + + // Gets or sets the SQL server edition. + Edition *string + + // Gets or sets the SQL server engine edition. + EngineEdition *string + + // Gets or sets hostname. + HostName *string + + // Gets or sets the hydrated run as account ID of the SQL server. + HydratedRunAsAccountID *string + + // Gets or sets the Hyper thread ratio. + HyperthreadRatio *int32 + + // Gets or sets a value indicating whether failover cluster is configured or not. + IsClustered *bool + + // Gets or sets a value indicating whether the entity is deleted. + IsDeleted *bool + + // Gets or sets a value indicating whether High Availability is enabled or not. + IsHighAvailabilityEnabled *bool + + // Gets or sets logical CPU count. + LogicalCPUCount *int32 + + // Gets or sets maximum server memory in use. + MaxServerMemoryInUseInMb *float32 + + // Gets or sets number of logins. + NumOfLogins *int32 + + // Gets or sets the number of databases part of availability group on this SQL instance. + NumberOfAgDatabases *int32 + + // Gets or sets total number of users databases. + NumberOfUserDatabases *int32 + + // Gets or sets physical CPU count. + PhysicalCPUCount *float32 + + // Gets or sets the Preferred Port Number. + PortNumber *int32 + + // product support status. + ProductSupportStatus *ProductSupportStatus + + // The status of the last operation. + ProvisioningState *ProvisioningState + + // Gets or sets the run as account ID of the SQL server. + RunAsAccountID *string + + // Gets or sets the FCI properties if the instance is an FCI instance. This would be populated if IsClustered is true. + SQLFciProperties *SQLFciProperties + + // Gets or sets the SQL server instance name. + SQLServerName *string + + // Gets or sets the SQL start time. + SQLStartTime *time.Time + + // Gets or sets the powered on status. + Status *SQLServerStatus + + // Gets or sets total size of all user databases. + SumOfUserDatabasesSizeInMb *float32 + + // Gets or sets tags on the resource. + Tags map[string]any + + // Gets or sets size of temp database. + TempDbSizeInMb *float32 + + // Gets or sets the timestamp marking last updated on the machine. + UpdatedTimestamp *string + + // Gets or sets the SQL server version. + Version *string + + // Gets or sets the SQL server number of cores that have visible online status. + VisibleOnlineCoreCount *int32 + + // READ-ONLY; Gets the errors. + Errors []*Errors + + // READ-ONLY; Gets the list of machine ARM Ids on which the SQL server is deployed. + MachineArmIDs []*string + + // READ-ONLY; Gets the Machine Overview properties of all machines on which the SQL server is deployed. + MachineOverviewList []*SQLMachineOverview +} + +// SQLServerV2 - Class representing the web model of SQL Server. +type SQLServerV2 struct { + // The resource-specific properties for this resource. + Properties *SQLServerProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// SQLServerV2ListResult - The response of a SqlServerV2 list operation. +type SQLServerV2ListResult struct { + // REQUIRED; The SqlServerV2 items on this page + Value []*SQLServerV2 + + // The link to the next page of items + NextLink *string +} + +// SQLServerV2Update - The type used for update operations of the SqlServerV2. +type SQLServerV2Update struct { + // The updatable properties of the SqlServerV2. + Properties *SQLServerV2UpdateProperties +} + +// SQLServerV2UpdateProperties - The updatable properties of the SqlServerV2. +type SQLServerV2UpdateProperties struct { + // Gets or sets the marking machine creation. + CreatedTimestamp *string + + // Gets or sets the SQL server edition. + Edition *string + + // Gets or sets the SQL server engine edition. + EngineEdition *string + + // Gets or sets hostname. + HostName *string + + // Gets or sets the hydrated run as account ID of the SQL server. + HydratedRunAsAccountID *string + + // Gets or sets the Hyper thread ratio. + HyperthreadRatio *int32 + + // Gets or sets a value indicating whether failover cluster is configured or not. + IsClustered *bool + + // Gets or sets a value indicating whether the entity is deleted. + IsDeleted *bool + + // Gets or sets a value indicating whether High Availability is enabled or not. + IsHighAvailabilityEnabled *bool + + // Gets or sets logical CPU count. + LogicalCPUCount *int32 + + // Gets or sets maximum server memory in use. + MaxServerMemoryInUseInMb *float32 + + // Gets or sets number of logins. + NumOfLogins *int32 + + // Gets or sets the number of databases part of availability group on this SQL instance. + NumberOfAgDatabases *int32 + + // Gets or sets total number of users databases. + NumberOfUserDatabases *int32 + + // Gets or sets physical CPU count. + PhysicalCPUCount *float32 + + // Gets or sets the Preferred Port Number. + PortNumber *int32 + + // product support status. + ProductSupportStatus *ProductSupportStatus + + // The status of the last operation. + ProvisioningState *ProvisioningState + + // Gets or sets the run as account ID of the SQL server. + RunAsAccountID *string + + // Gets or sets the FCI properties if the instance is an FCI instance. This would be populated if IsClustered is true. + SQLFciProperties *SQLFciProperties + + // Gets or sets the SQL server instance name. + SQLServerName *string + + // Gets or sets the SQL start time. + SQLStartTime *time.Time + + // Gets or sets the powered on status. + Status *SQLServerStatus + + // Gets or sets total size of all user databases. + SumOfUserDatabasesSizeInMb *float32 + + // Gets or sets tags on the resource. + Tags map[string]any + + // Gets or sets size of temp database. + TempDbSizeInMb *float32 + + // Gets or sets the timestamp marking last updated on the machine. + UpdatedTimestamp *string + + // Gets or sets the SQL server version. + Version *string + + // Gets or sets the SQL server number of cores that have visible online status. + VisibleOnlineCoreCount *int32 +} + +// SQLSite - SQL site web model. +type SQLSite struct { + // The resource-specific properties for this resource. + Properties *SQLSiteProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// SQLSiteListResult - The response of a SqlSite list operation. +type SQLSiteListResult struct { + // REQUIRED; The SqlSite items on this page + Value []*SQLSite + + // The link to the next page of items + NextLink *string +} + +// SQLSiteProperties - Class for SQL site properties. +type SQLSiteProperties struct { + // Gets or sets the discovery scenario. + DiscoveryScenario *SQLSitePropertiesDiscoveryScenario + + // Gets or sets the appliance details used by service to communicate + // to the appliance. + SiteAppliancePropertiesCollection []*SiteApplianceProperties + + // READ-ONLY; provisioning state enum + ProvisioningState *ProvisioningState + + // READ-ONLY; Gets the service endpoint. + ServiceEndpoint *string +} + +// SQLSiteRefreshBody - SQL site refresh. +type SQLSiteRefreshBody struct { + // Gets or sets the appliance name of the agent in the site. + ApplianceName *string +} + +// SQLSiteUpdate - The type used for update operations of the SqlSite. +type SQLSiteUpdate struct { + // The updatable properties of the SqlSite. + Properties *SQLSiteUpdateProperties +} + +// SQLSiteUpdateProperties - The updatable properties of the SqlSite. +type SQLSiteUpdateProperties struct { + // Gets or sets the discovery scenario. + DiscoveryScenario *SQLSitePropertiesDiscoveryScenario + + // Gets or sets the appliance details used by service to communicate + // to the appliance. + SiteAppliancePropertiesCollection []*SiteApplianceProperties +} + +// SQLSiteUsage - SQL site usage. +type SQLSiteUsage struct { + // Gets or sets the number of databases discovered in the site. + DatabaseCount *int32 + + // Gets or sets the number of run as accounts in the site. + RunAsAccountCount *int32 + + // Gets or sets the number of servers discovered in the site. + ServerCount *int32 +} + +// SasURIResponse - Import URI response class. +type SasURIResponse struct { + // Gets or sets the import type. + ImportType *ImportTypeValues + + // Gets or sets the job ARM ID. + JobArmID *string + + // Gets or sets the SAS URI. + URI *string +} + +// Server - A machine resource belonging to a site resource. +type Server struct { + // The resource-specific properties for this resource. + Properties *ServerProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ServerDisk - Server disk details. +type ServerDisk struct { + // Gets or sets Type of the disk. + DiskType *string + + // Gets or sets generated Id of the disk. + GeneratedID *string + + // Gets or sets Id of the disk. + ID *string + + // Gets or sets LUN of the disk. + Lun *int32 + + // Gets or sets Bytes allocated for the disk. + MaxSizeInBytes *int32 + + // Gets or sets Name of the disk. + Name *string + + // Gets or sets Path of the disk. + Path *string +} + +// ServerJob - A host resource belonging to a site resource. +type ServerJob struct { + // The resource-specific properties for this resource. + Properties *JobProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ServerJobListResult - The response of a ServerJob list operation. +type ServerJobListResult struct { + // REQUIRED; The ServerJob items on this page + Value []*ServerJob + + // The link to the next page of items + NextLink *string +} + +// ServerListResult - The response of a Server list operation. +type ServerListResult struct { + // REQUIRED; The Server items on this page + Value []*Server + + // The link to the next page of items + NextLink *string +} + +// ServerNetworkAdapter - Second level object represented in responses as part of Machine REST resource. +type ServerNetworkAdapter struct { + // Gets or sets Type of the IP address. + IPAddressType *string + + // Gets or sets Mac address of the NIC. + MacAddress *string + + // Gets or sets Network Name. + NetworkName *string + + // Gets or sets the NIC Id. + NicID *string + + // READ-ONLY; Gets IP addresses for the machine. + IPAddressList []*string +} + +// ServerProperties - Server REST resource. +type ServerProperties struct { + // Gets or sets the allocated Memory in MB. + AllocatedMemoryInMb *float32 + + // Gets or sets the BIOS GUID. + BiosGUID *string + + // Gets or sets the Machine BIOS serial number. + BiosSerialNumber *string + + // Gets or sets the disk details of server. + Disks []*ServerDisk + + // Gets or sets the firmware. + Firmware *string + + // Gets or sets the FQDN/IPAddress of the server. + Fqdn *string + + // Gets or sets the FQDN of machine which can be changed. + HydratedFqdn *string + + // Gets or sets the network adapters of the server. + NetworkAdapters []*ServerNetworkAdapter + + // Gets or sets the Number of Processor Cores allocated for the machine. + NumberOfProcessorCore *int32 + + // Gets or sets the Operating System Details installed on the machine. + OperatingSystemDetails *OperatingSystem + + // product support status. + ProductSupportStatus *ProductSupportStatus + + // Provisioning state of the server resource. + ProvisioningState *ProvisioningState + + // Gets or sets the run as account ID of the machine. + RunAsAccountID *string + + // Gets or sets tags on the Server machine. + Tags map[string]any + + // Gets or sets the validation required for the machine. + ValidationRequired *string + + // READ-ONLY; Gets the appliance names. + ApplianceNames []*string + + // READ-ONLY; Gets the data related to application discovery. + ApplicationDiscovery *ApplicationDiscovery + + // READ-ONLY; Apps And Roles of the Server. + AppsAndRoles *AppsAndRoles + + // READ-ONLY; Gets the marking machine creation. + CreatedTimestamp *string + + // READ-ONLY; Gets the data related to dependency map discovery. + DependencyMapDiscovery *DependencyMapDiscovery + + // READ-ONLY; Gets or sets if dependency mapping feature is enabled or not for the VM. + DependencyMapping *string + + // READ-ONLY; Gets or sets when dependency mapping collection was last disabled. + DependencyMappingEndTime *string + + // READ-ONLY; Gets or sets when dependency mapping collection is last started. + DependencyMappingStartTime *time.Time + + // READ-ONLY; Gets the Display name of the machine. For server entity hydrated FQDN is set as display name as the server id + // and server name are same. + DisplayName *string + + // READ-ONLY; Errors for machine. + Errors []*HealthErrorDetails + + // READ-ONLY; The last time at which the Guest Details was discovered or the error while discovering guest details based discovery + // of the machine. + GuestDetailsDiscoveryTimestamp *time.Time + + // READ-ONLY; Operating System Details extracted from the guest bu executing script inside the guest VM. + GuestOsDetails *GuestOsDetails + + // READ-ONLY; Gets the data related to iis discovery. + IisDiscovery *WebAppDiscovery + + // READ-ONLY; Value indicating whether VM is deleted. + IsDeleted *bool + + // READ-ONLY; Whether Refresh Fabric Layout Guest Details has been completed once. + // Portal will show discovery in progress, if this value is true. + IsGuestDetailsDiscoveryInProgress *bool + + // READ-ONLY; Number of applications installed in the guest VM. + NumberOfApplications *int32 + + // READ-ONLY; Gets the data related to Oracle discovery. + OracleDiscovery *OracleDiscovery + + // READ-ONLY; Processor Info of the Server machine. + ProcessorInfo *ProcessorInfo + + // READ-ONLY; Gets the data related to SQL discovery. + SQLDiscovery *SQLDiscovery + + // READ-ONLY; Gets the data related to SpringBoot discovery. + SpringBootDiscovery *SpringBootDiscovery + + // READ-ONLY; Gets the data related to static discovery. + StaticDiscovery *StaticDiscovery + + // READ-ONLY; Gets the data related to tomcat discovery. + TomcatDiscovery *WebAppDiscovery + + // READ-ONLY; Gets the timestamp marking last updated on the machine. + UpdatedTimestamp *string + + // READ-ONLY; Gets the data related to Web application discovery. + WebAppDiscovery *WebAppDiscovery +} + +// ServerRunAsAccount - A run as account resource belonging to a site resource. +type ServerRunAsAccount struct { + // The resource-specific properties for this resource. + Properties *RunAsAccountProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ServerRunAsAccountListResult - The response of a ServerRunAsAccount list operation. +type ServerRunAsAccountListResult struct { + // REQUIRED; The ServerRunAsAccount items on this page + Value []*ServerRunAsAccount + + // The link to the next page of items + NextLink *string +} + +// ServerSiteResource - A ServerSiteResource +type ServerSiteResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *SitesProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ServerSiteResourceListResult - The response of a ServerSiteResource list operation. +type ServerSiteResourceListResult struct { + // REQUIRED; The ServerSiteResource items on this page + Value []*ServerSiteResource + + // The link to the next page of items + NextLink *string +} + +// ServerSiteResourceUpdate - The type used for update operations of the ServerSiteResource. +type ServerSiteResourceUpdate struct { + // The updatable properties of the ServerSiteResource. + Properties *ServerSiteResourceUpdateProperties + + // Resource tags. + Tags map[string]*string +} + +// ServerSiteResourceUpdateProperties - The updatable properties of the ServerSiteResource. +type ServerSiteResourceUpdateProperties struct { + // Gets or sets the on-premises agent details. + AgentDetails *SiteAgentProperties + + // Gets or sets the Appliance Name. + ApplianceName *string + + // Gets or sets the ARM ID of migration hub solution for SDS. + DiscoverySolutionID *string + + // Gets or sets the service principal identity details used by agent for communication to the service. + ServicePrincipalIdentityDetails *SiteSpnProperties +} + +// ServerSiteUsage - Server site usage. +type ServerSiteUsage struct { + // Gets or sets the number of run as accounts in the site. + RunAsAccountCount *int32 + + // Gets or sets the number of servers part of the site. + ServerCount *int32 +} + +// ServerSiteUsageResponse - The properties of ServerSiteUsageResponse. +type ServerSiteUsageResponse struct { + // REQUIRED; Gets or sets the number of run as accounts in the site. + RunAsAccounts *int32 + + // REQUIRED; Gets or sets the number of servers part of the site. + ServerCount *int32 +} + +// ServerSoftwareInventory - An software inventory resource belonging to a server resource. +type ServerSoftwareInventory struct { + // The resource-specific properties for this resource. + Properties *MachineSoftwareInventoryProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ServerSoftwareInventoryListResult - The response of a ServerSoftwareInventory list operation. +type ServerSoftwareInventoryListResult struct { + // REQUIRED; The ServerSoftwareInventory items on this page + Value []*ServerSoftwareInventory + + // The link to the next page of items + NextLink *string +} + +// ServerUpdate - The type used for update operations of the Server. +type ServerUpdate struct { + // The updatable properties of the Server. + Properties *ServerUpdateProperties +} + +// ServerUpdateProperties - The updatable properties of the Server. +type ServerUpdateProperties struct { + // Gets or sets the allocated Memory in MB. + AllocatedMemoryInMb *float32 + + // Gets or sets the BIOS GUID. + BiosGUID *string + + // Gets or sets the Machine BIOS serial number. + BiosSerialNumber *string + + // Gets or sets the disk details of server. + Disks []*ServerDisk + + // Gets or sets the firmware. + Firmware *string + + // Gets or sets the FQDN/IPAddress of the server. + Fqdn *string + + // Gets or sets the FQDN of machine which can be changed. + HydratedFqdn *string + + // Gets or sets the network adapters of the server. + NetworkAdapters []*ServerNetworkAdapter + + // Gets or sets the Number of Processor Cores allocated for the machine. + NumberOfProcessorCore *int32 + + // Gets or sets the Operating System Details installed on the machine. + OperatingSystemDetails *OperatingSystem + + // product support status. + ProductSupportStatus *ProductSupportStatus + + // Provisioning state of the server resource. + ProvisioningState *ProvisioningState + + // Gets or sets the run as account ID of the machine. + RunAsAccountID *string + + // Gets or sets tags on the Server machine. + Tags map[string]any + + // Gets or sets the validation required for the machine. + ValidationRequired *string +} + +// SharePointServer in the guest virtual machine. +type SharePointServer struct { + // READ-ONLY; Gets or sets a value indicating whether the SharePointServer is Enterprise. + IsEnterprise *bool + + // READ-ONLY; Gets or sets ProductName of the SharePointServer. + ProductName *string + + // READ-ONLY; Gets or sets Status of the SharePointServer. + Status *string + + // READ-ONLY; Gets or sets Version of the SharePointServer. + Version *string +} + +// SiteAgentProperties - Class for site agent properties. +type SiteAgentProperties struct { + // Gets or sets the key vault ARM Id. + KeyVaultID *string + + // Gets or sets the key vault URI. + KeyVaultURI *string + + // READ-ONLY; Gets the ID of the agent. + ID *string + + // READ-ONLY; Gets the last heartbeat time of the agent in UTC. + LastHeartBeatUTC *time.Time + + // READ-ONLY; Gets the version of the agent. + Version *string +} + +// SiteApplianceProperties - Class for site appliance properties. +type SiteApplianceProperties struct { + // Gets or sets the on-premises agent details. + AgentDetails *SiteAgentProperties + + // Gets or sets the Appliance Name. + ApplianceName *string + + // Gets or sets the service principal identity details used by agent for communication to the service. + ServicePrincipalIdentityDetails *SiteSpnProperties +} + +// SiteErrorSummary - Site error summary. +type SiteErrorSummary struct { + // REQUIRED; Appliance Name. + ApplianceName *string + + // REQUIRED; Gets the error message. + DiscoveryScopeErrorSummaries *DiscoveryScopeErrorSummary + + // The link to fetch more models. + NextLink *string +} + +// SiteHealthSummary - The properties of ServerSiteResource. +type SiteHealthSummary struct { + // Gets or sets the count of affected objects. + AffectedObjectsCount *int64 + + // Gets or sets the affected resources. + AffectedResources []*string + + // Gets or sets sources of the exception. + FabricLayoutUpdateSources []*SiteHealthSummaryFabricLayoutUpdateSourcesItem + + // Gets or sets the hit count of the error. + HitCount *int64 + + // READ-ONLY; Gets the affected resource type. + AffectedResourceType *string + + // READ-ONLY; Gets the appliance name. + ApplianceName *string + + // READ-ONLY; Gets the error code. + ErrorCode *string + + // READ-ONLY; Gets the error Id. + ErrorID *int64 + + // READ-ONLY; Gets the error message. + ErrorMessage *string + + // READ-ONLY; Gets the remediation guidance. + RemediationGuidance *string + + // READ-ONLY; Gets the severity of error. + Severity *string + + // READ-ONLY; Gets the summary message. + SummaryMessage *string +} + +// SiteHealthSummaryCollection - Collection of SiteHealthSummary. +type SiteHealthSummaryCollection struct { + // REQUIRED; Gets the list of SiteHealthSummary. + Value []*SiteHealthSummary + + // READ-ONLY; Gets the value of next link. + NextLink *string +} + +// SiteProperties - The properties of VMwareSiteResource +type SiteProperties struct { + // Gets or sets the on-premises agent details. + AgentDetails *SiteAgentProperties + + // Gets or sets the Appliance Name. + ApplianceName *string + + // Gets or sets the ARM ID of migration hub solution for SDS. + DiscoverySolutionID *string + + // The status of the last operation. + ProvisioningState *ProvisioningState + + // Gets or sets the service principal identity details used by agent for communication to the service. + ServicePrincipalIdentityDetails *SiteSpnProperties + + // READ-ONLY; Gets the Master Site this site is linked to. + MasterSiteID *string + + // READ-ONLY; Gets the service endpoint. + ServiceEndpoint *string +} + +// SiteSpnProperties - Class for site properties. +type SiteSpnProperties struct { + // Gets or sets the AAD Authority URL which was used to request the token for the service principal. + AADAuthority *string + + // Gets or sets the application/client Id for the service principal with which the on-premise management/data plane components + // would communicate with our Azure services. + ApplicationID *string + + // Gets or sets the intended audience for the service principal. + Audience *string + + // Gets or sets the object Id of the service principal with which the on-premise + // management/data plane components would communicate with our Azure + // services. + ObjectID *string + + // Gets or sets the raw certificate data for building certificate expiry flows. + RawCertData *string + + // Gets or sets the tenant Id for the service principal with which the on-premise management/data plane components would communicate + // with our Azure services. + TenantID *string +} + +// SitesProperties - The properties of SiteResource +type SitesProperties struct { + // Gets or sets the on-premises agent details. + AgentDetails *SiteAgentProperties + + // Gets or sets the Appliance Name. + ApplianceName *string + + // Gets or sets the ARM ID of migration hub solution for SDS. + DiscoverySolutionID *string + + // Gets or sets the service principal identity details used by agent for communication to the service. + ServicePrincipalIdentityDetails *SiteSpnProperties + + // READ-ONLY; Gets the Master Site this site is linked to. + MasterSiteID *string + + // READ-ONLY; The status of the last operation. + ProvisioningState *ProvisioningState + + // READ-ONLY; Gets the service endpoint. + ServiceEndpoint *string +} + +// SpringBootDiscovery - Data related to a machine's spring boot discovery. +type SpringBootDiscovery struct { + // Gets or sets status of partner discovery. + DiscoveryScopeStatus *DiscoveryScopeStatus + + // Gets or sets status of partner shallow discovery. + ShallowDiscoveryStatus *ShallowDiscoveryStatus + + // Gets or sets number of successfully discovered applications. + TotalApplicationCount *int64 + + // Gets or sets number of successfully discovered instances. + TotalInstanceCount *int64 +} + +// StaticDiscovery - Contains data related static data discovery scope. +type StaticDiscovery struct { + // READ-ONLY; Gets discovery scope status. + DiscoveryScopeStatus *StaticDiscoveryScopeStatus + + // READ-ONLY; Gets errors for discovery scope. + Errors []*HealthErrorDetails + + // READ-ONLY; Gets the run as account ID with which feature worked successfully. + // It is discovered by the agent from the list of credentials. + HydratedRunAsAccountID *string +} + +// SystemCenter in the guest virtual machine. +type SystemCenter struct { + // READ-ONLY; Gets or sets ProductName of the SystemCenter. + ProductName *string + + // READ-ONLY; Gets or sets Status of the SystemCenter. + Status *string + + // READ-ONLY; Gets or sets Version of the SystemCenter. + Version *string +} + +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time + + // The identity that created the resource. + CreatedBy *string + + // The type of identity that created the resource. + CreatedByType *CreatedByType + + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time + + // The identity that last modified the resource. + LastModifiedBy *string + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType +} + +// TagsMachineInput - Machine class. +type TagsMachineInput struct { + // Gets or sets the ARM id of the machine. + MachineID *string + + // run as AccountId + Tags map[string]*string +} + +// TomcatEngineUnit - Tomcat engine data. +type TomcatEngineUnit struct { + // Gets or sets the hosts defined for the engine. + Hosts []*TomcatHostUnit + + // Gets or sets the name of the engine. + Name *string +} + +// TomcatHostUnit - Tomcat host data. +type TomcatHostUnit struct { + // Gets or sets the app base value configured for the host. + AppBase *string + + // Gets or sets the app base path for the host. + AppBasePath *string + + // Gets or sets the name of the host. + Name *string +} + +// TomcatServiceUnit - Tomcat service data. +type TomcatServiceUnit struct { + // Gets or sets the connectors defined for the service component. + Connectors []*ConnectorUnit + + // Gets or sets the engine defined for the service component. + Engine *TomcatEngineUnit + + // Gets or sets the name of the service. + Name *string +} + +// TomcatWebApplicationProperties - Class for web application properties. +type TomcatWebApplicationProperties struct { + // READ-ONLY; Gets the appliance names. + ApplianceNames []*string + + // READ-ONLY; Gets the front end bindings for the application. + Bindings []*FrontEndBinding + + // READ-ONLY; Gets the configuration. + Configurations []*WebApplicationConfigurationUnit + + // READ-ONLY; Gets the timestamp marking creation of the entity. + CreatedTimestamp *string + + // READ-ONLY; Gets the directories. + Directories []*WebApplicationDirectoryUnit + + // READ-ONLY; Gets the display name. + DisplayName *string + + // READ-ONLY; Gets the Error details. + Errors []*HealthErrorDetails + + // READ-ONLY; Gets the Error details. + Frameworks []*WebApplicationFramework + + // READ-ONLY; Boolean value having true if the application has database dependency. + HasDatabaseDependency *bool + + // READ-ONLY; Gets a value indicating whether the WebApp has errors or not. + HasErrors *bool + + // READ-ONLY; Gets a value indicating whether application is deleted. + IsDeleted *bool + + // READ-ONLY; Boolean value having true if the application has file dependency. + IsExternalLoggingConfigured *bool + + // READ-ONLY; Gets the list of machine ARM Ids on which the web application is deployed. + MachineArmIDs []*string + + // READ-ONLY; Machine display name + MachineDisplayName *string + + // READ-ONLY; Gets the physical path of the application. + PhysicalPath *string + + // READ-ONLY; provisioning state enum + ProvisioningState *ProvisioningState + + // READ-ONLY; Gets the server type. + ServerType *string + + // READ-ONLY; Static folders. + StaticFolders []*string + + // READ-ONLY; Gets tags that can be used with ODATA. + Tags map[string]*string + + // READ-ONLY; Gets the timestamp marking last update operation. + UpdatedTimestamp *string + + // READ-ONLY; Gets the virtual path of the application. + VirtualPath *string + + // READ-ONLY; Gets the web server id. + WebServerID *string + + // READ-ONLY; Gets the web server name. + WebServerName *string +} + +// TomcatWebApplications - Web application REST Resource. +type TomcatWebApplications struct { + // The resource-specific properties for this resource. + Properties *TomcatWebApplicationProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// TomcatWebApplicationsListResult - The response of a TomcatWebApplications list operation. +type TomcatWebApplicationsListResult struct { + // REQUIRED; The TomcatWebApplications items on this page + Value []*TomcatWebApplications + + // The link to the next page of items + NextLink *string +} + +// TomcatWebServerProperties - Class for web server properties. +type TomcatWebServerProperties struct { + // Gets a value indicating whether application is deleted. + IsClusteringPresent *bool + + // Gets or sets the Operating System Details installed on the machine. + OperatingSystemDetails *OperatingSystem + + // Gets or sets the services defined in the server. + Services []*TomcatServiceUnit + + // READ-ONLY; Gets the appliance names. + ApplianceNames []*string + + // READ-ONLY; Catalina Home + CatalinaHome *string + + // READ-ONLY; Gets the configuration location. + ConfigurationLocation *string + + // READ-ONLY; Gets the timestamp marking creation of the entity. + CreatedTimestamp *string + + // READ-ONLY; Gets the display name. DisplayName *string - // READ-ONLY; Gigabytes of storage provided by the recommended Azure disk size. - GigabytesForRecommendedDiskSize *int32 + // READ-ONLY; Gets the Error details. + Errors []*HealthErrorDetails + + // READ-ONLY; Gets a value indicating whether the WebApp has errors or not. + HasErrors *bool + + // READ-ONLY; is access log valve present + IsAccessLogValvePresent *bool + + // READ-ONLY; Gets a value indicating whether application is deleted. + IsDeleted *bool + + // READ-ONLY; Gets a value indicating whether application is deleted. + IsMemoryRealmPresent *bool + + // READ-ONLY; is session tracking present + IsSessionTrackingPresent *bool + + // READ-ONLY; Version of the JVM + JvmVersion *string + + // READ-ONLY; Gets the list of machines. + MachineIDs []*string + + // READ-ONLY; max memory usage in mb + MaxMemoryUsageInMb *string + + // READ-ONLY; provisioning state enum + ProvisioningState *ProvisioningState + + // READ-ONLY; Gets the run as account id. + RunAsAccountID *string - // READ-ONLY; Gigabytes of storage provisioned for this disk. - GigabytesProvisioned *float64 + // READ-ONLY; Gets the server FQDN. + ServerFqdn *string - // READ-ONLY; Disk throughput in MegaBytes per second. - MegabytesPerSecondOfRead *float64 + // READ-ONLY; Gets the server type. + ServerType *string - // READ-ONLY; Disk throughput in MegaBytes per second. - MegabytesPerSecondOfWrite *float64 + // READ-ONLY; session persistence mechanism + SessionPersistenceMechanism *string - // READ-ONLY; Estimated aggregate storage cost for a 31-day month for this disk. - MonthlyStorageCost *float64 + // READ-ONLY; Gets the timestamp marking last update operation. + UpdatedTimestamp *string - // READ-ONLY; Name of the assessed disk. - Name *string + // READ-ONLY; Gets the configuration location. + Version *string + + // READ-ONLY; Gets the list of web applications. + WebApplications []*string +} - // READ-ONLY; Number of read operations per second for the disk. - NumberOfReadOperationsPerSecond *float64 +// TomcatWebServers - Web server REST Resource. +type TomcatWebServers struct { + // The resource-specific properties for this resource. + Properties *TomcatWebServerProperties - // READ-ONLY; Number of read and write operations per second for the disk. - NumberOfWriteOperationsPerSecond *float64 + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string - // READ-ONLY; Recommended Azure size for the disk, given utilization data and preferences set on Assessment. - RecommendedDiskSize *AzureDiskSize + // READ-ONLY; The name of the resource + Name *string - // READ-ONLY; Storage type selected for this disk. - RecommendedDiskType *AzureDiskType + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // READ-ONLY; Whether this disk is suitable for Azure. - Suitability *CloudSuitability + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} - // READ-ONLY; If disk is suitable to be migrate but some conditions/checks were not considered while calculating suitability, - // this explains the details. - SuitabilityDetail *AzureDiskSuitabilityDetail +// TomcatWebServersListResult - The response of a TomcatWebServers list operation. +type TomcatWebServersListResult struct { + // REQUIRED; The TomcatWebServers items on this page + Value []*TomcatWebServers - // READ-ONLY; If disk is not suitable to be migrated, this explains the reasons and mitigation steps. - SuitabilityExplanation *AzureDiskSuitabilityExplanation + // The link to the next page of items + NextLink *string } -// AssessedMachine - A machine evaluated as part of an assessment. -type AssessedMachine struct { - // For optimistic concurrency control. - ETag *string +// TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' +// and a 'location' +type TrackedResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string - // Properties of an assessed machine. - Properties *AssessedMachineProperties + // Resource tags. + Tags map[string]*string - // READ-ONLY; Path reference to this assessed machine. - // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/assessments/{assessmentName}/assessedMachines/{assessedMachineName} + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Name of the machine. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Type of the object = [Microsoft.Migrate/assessmentProjects/groups/assessments/assessedMachines]. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// AssessedMachineProperties - Properties of an assessed machine. -type AssessedMachineProperties struct { - // READ-ONLY; Boot type of the machine. - BootType *MachineBootType +// UpdateMachineDepMapStatus - Defines class that represents input to enable or disable DMP on machine +// for cosmos entity operation. +type UpdateMachineDepMapStatus struct { + // Gets or sets the machine collection. + Machines []*DependencyMapMachineInput +} + +// UpdateMachineRunAsAccount - Defines class that represents input to update RunAsAccount on machine +// for cosmos entity operation. +type UpdateMachineRunAsAccount struct { + // Gets or sets the machine collection. + Machines []*RunAsAccountMachineInput +} - // READ-ONLY; Confidence rating of assessed machine. - ConfidenceRatingInPercentage *float64 +// UpdateMachineTags - Defines class that represents input to update Tags on machine +// for cosmos entity operation. +type UpdateMachineTags struct { + // Gets or sets the machine collection. + Machines []*TagsMachineInput +} - // READ-ONLY; Time when this machine was created. Date-Time represented in ISO-8601 format. - CreatedTimestamp *time.Time +// V20180501PreviewVmwareRunAsAccount - Run as account REST Resource. +type V20180501PreviewVmwareRunAsAccount struct { + // READ-ONLY; Relative URL to get this run as account. + ID *string - // READ-ONLY; ARM ID of the discovered machine. - DatacenterMachineArmID *string + // READ-ONLY; Gets the Name of the Run as account. + Name *string - // READ-ONLY; ARM ID of the discovered datacenter. - DatacenterManagementServerArmID *string + // READ-ONLY; Gets nested properties. + Properties *RunAsAccountProperties - // READ-ONLY; Name of the server hosting the datacenter management solution. - DatacenterManagementServerName *string + // READ-ONLY; Handled by resource provider. Type = Microsoft.OffAzure/VMWareSites/RunAsAccounts. + Type *string +} - // READ-ONLY; Description of the machine - Description *string +// V20180501PreviewVmwareRunAsAccountVmwareRunAsAccountCollection - Collection of VMware run as accounts. +type V20180501PreviewVmwareRunAsAccountVmwareRunAsAccountCollection struct { + // Gets the list of run as accounts. + Value []*V20180501PreviewVmwareRunAsAccount - // READ-ONLY; Dictionary of disks attached to the machine. Key is ID of disk. Value is a disk object. - Disks map[string]*AssessedDisk + // READ-ONLY; Gets the value of next link. + NextLink *string +} - // READ-ONLY; User readable name of the machine as defined by the user in their private datacenter. - DisplayName *string +// Vcenter - A vcenter resource belonging to a site resource. +type Vcenter struct { + // The resource-specific properties for this resource. + Properties *VcenterProperties - // READ-ONLY; Memory in Megabytes. - MegabytesOfMemory *float64 + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string - // READ-ONLY; Megabytes of memory in the Recommended Azure VM Size. - MegabytesOfMemoryForRecommendedSize *float64 + // READ-ONLY; The name of the resource + Name *string - // READ-ONLY; Monthly network cost estimate for the network adapters that are attached to this machine as a group, for a 31-day - // month. - MonthlyBandwidthCost *float64 + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // READ-ONLY; Compute Cost for a 31-day month, if the machine is migrated to Azure with the Recommended Size. - MonthlyComputeCostForRecommendedSize *float64 + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} - // READ-ONLY; Monthly premium storage cost estimate for the disks that are attached to this machine as a group, for a 31-day - // month. - MonthlyPremiumStorageCost *float64 +// VcenterListResult - The response of a Vcenter list operation. +type VcenterListResult struct { + // REQUIRED; The Vcenter items on this page + Value []*Vcenter - // READ-ONLY; Monthly standard SSD storage cost estimate for the disks that are attached to this machine as a group, for a - // 31-day month. - MonthlyStandardSSDStorageCost *float64 + // The link to the next page of items + NextLink *string +} - // READ-ONLY; Monthly storage cost estimate for the disks that are attached to this machine as a group, for a 31-day month. - MonthlyStorageCost *float64 +// VcenterProperties - The properties of VMwareSiteResource +type VcenterProperties struct { + // Gets or sets the FQDN/IPAddress of the vCenter. + Fqdn *string - // READ-ONLY; Dictionary of network adapters attached to the machine. Key is name of the adapter. Value is a network adapter - // object. - NetworkAdapters map[string]*AssessedNetworkAdapter + // Gets or sets the friendly name of the vCenter. + FriendlyName *string - // READ-ONLY; Processor count. - NumberOfCores *int32 + // Gets or sets the port of the vCenter. + Port *string - // READ-ONLY; Number of CPU cores in the Recommended Azure VM Size. - NumberOfCoresForRecommendedSize *int32 + // The status of the last operation. + ProvisioningState *ProvisioningState - // READ-ONLY; Operating System name of the machine. - OperatingSystemName *string + // Gets or sets the run as account ID of the vCenter. + RunAsAccountID *string - // READ-ONLY; Operating System type of the machine. - OperatingSystemType *string + // READ-ONLY; Gets the timestamp marking vCenter creation. + CreatedTimestamp *string - // READ-ONLY; Operating System version of the machine. - OperatingSystemVersion *string + // READ-ONLY; Gets the errors. + Errors []*HealthErrorDetails - // READ-ONLY; Utilization percentage of the processor core as observed in the private data center, in the Time Range selected - // on Assessment, reported as the Percentile value based on the percentile number selected - // in assessment. - PercentageCoresUtilization *float64 + // READ-ONLY; Gets the instance UUID of the vCenter. + InstanceUUID *string - // READ-ONLY; Utilization percentage of the memory as observed in the private data center, in the Time Range selected on Assessment, - // reported as the Percentile value based on the percentile number selected in - // assessment. - PercentageMemoryUtilization *float64 + // READ-ONLY; Gets the performance statistics enabled on the vCenter. + PerfStatisticsLevel *string - // READ-ONLY; Recommended Azure size for this machine. - RecommendedSize *AzureVMSize + // READ-ONLY; Gets the timestamp marking last updated on the vCenter. + UpdatedTimestamp *string - // READ-ONLY; Whether machine is suitable for migration to Azure. - Suitability *CloudSuitability + // READ-ONLY; Gets the version of the vCenter. + Version *string +} - // READ-ONLY; If machine is not suitable for cloud, this explains the reasons. - SuitabilityDetail *AzureVMSuitabilityDetail +// VmwareDatastore - Second level object returned as part of VMware host REST resource. +type VmwareDatastore struct { + // READ-ONLY; Capacity of the data store. + CapacityInGb *float32 - // READ-ONLY; If machine is not ready to be migrated, this explains the reasons and mitigation steps. - SuitabilityExplanation *AzureVMSuitabilityExplanation + // READ-ONLY; Free space of the data store. + FreeSpaceInGb *float32 - // READ-ONLY; Time when this machine was last updated. Date-Time represented in ISO-8601 format. - UpdatedTimestamp *time.Time -} + // READ-ONLY; Symbolic name of the data store. + SymbolicName *string -// AssessedMachineResultList - List of assessed machines. -type AssessedMachineResultList struct { - NextLink *string + // READ-ONLY; Type of the data store. + Type *VMwareDatastoreType - // List of assessed machines. - Value []*AssessedMachine + // READ-ONLY; Data store UUID. + UUID *string } -// AssessedNetworkAdapter - A network adapter assessed for an assessment. -type AssessedNetworkAdapter struct { - // Gigabytes transmitted through this adapter each month. - NetGigabytesTransmittedPerMonth *float64 +// VmwareDisk - Second level object returned as part of Machine REST resource. +type VmwareDisk struct { + // Gets or sets Type of the disk. + DiskType *string - // READ-ONLY; User friendly name of the assessed network adapter. - DisplayName *string + // Gets or sets LUN of the disk. + Lun *int32 - // READ-ONLY; List of IP Addresses on the network adapter. - IPAddresses []*string + // Gets or sets Bytes allocated for the disk. + MaxSizeInBytes *int64 - // READ-ONLY; MAC Address of the network adapter. - MacAddress *string + // Gets or sets Name of the disk. + Name *string - // READ-ONLY; Adapter throughput for incoming traffic in MegaBytes per second. - MegabytesPerSecondReceived *float64 + // Gets or sets Path of the disk. + Path *string - // READ-ONLY; Adapter throughput for outgoing traffic in MegaBytes per second. - MegabytesPerSecondTransmitted *float64 + // READ-ONLY; Gets or sets a value indicating the type of the disk controller type. + ControllerType *string - // READ-ONLY; Monthly cost estimate for network bandwidth used by this network adapter. - MonthlyBandwidthCosts *float64 + // READ-ONLY; Disk mode property used for identifying independent disks. + DiskMode *string - // READ-ONLY; Whether this adapter is suitable for Azure. - Suitability *CloudSuitability + // READ-ONLY; The provisioning policy of the disk. It is Thin or Thick or Unknown for the VMWare VMDK. + DiskProvisioningPolicy *string - // READ-ONLY; If network adapter is not suitable for cloud, this explains the reasons. - SuitabilityDetail *AzureNetworkAdapterSuitabilityDetail + // READ-ONLY; The scrubbing policy of disks which can be eagerly zeroed or lazily zeroed. + DiskScrubbingPolicy *string - // READ-ONLY; If network adapter is suitable, this explains the reasons and mitigation steps. - SuitabilityExplanation *AzureNetworkAdapterSuitabilityExplanation -} + // READ-ONLY; Label of the disk. + Label *string -// Assessment - An assessment created for a group in the Migration project. -type Assessment struct { - // REQUIRED; Properties of the assessment. - Properties *AssessmentProperties + // READ-ONLY; Disk UUID. + UUID *string +} - // For optimistic concurrency control. - ETag *string +// VmwareHost - A host resource belonging to a site resource. +type VmwareHost struct { + // The resource-specific properties for this resource. + Properties *VmwareHostProperties - // READ-ONLY; Path reference to this assessment. - // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/assessment/{assessmentName} + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Unique name of an assessment. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Type of the object = [Microsoft.Migrate/assessmentProjects/groups/assessments]. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// AssessmentOptions - Assessment options. -type AssessmentOptions struct { - // REQUIRED; Properties of the assessment options. - Properties *AssessmentOptionsProperties +// VmwareHostListResult - The response of a VmwareHost list operation. +type VmwareHostListResult struct { + // REQUIRED; The VmwareHost items on this page + Value []*VmwareHost - // READ-ONLY; Unique identifier of an assessment options. - ID *string + // The link to the next page of items + NextLink *string +} - // READ-ONLY; Unique name of an assessment options. - Name *string +// VmwareHostProperties - Class for host properties. +type VmwareHostProperties struct { + // READ-ONLY; Gets the appliance names. + ApplianceNames []*string + + // READ-ONLY; Gets the timestamp marking VMware host creation. + CreatedTimestamp *string + + // READ-ONLY; Gets the data stores. + Datastores []*VmwareDatastore + + // READ-ONLY; provisioning state enum + ProvisioningState *ProvisioningState + + // READ-ONLY; Gets the instance UUID of the vmware host. + UUID *string + + // READ-ONLY; Gets the timestamp marking last updated on the VMware host. + UpdatedTimestamp *string + + // READ-ONLY; Gets the V-center ID. + VcenterID *string } -// AssessmentOptionsProperties - Assessment options properties. -type AssessmentOptionsProperties struct { - // READ-ONLY; List of supported currencies for reserved instances. - ReservedInstanceSupportedCurrencies []*string +// VmwareJob - A host resource belonging to a site resource. +type VmwareJob struct { + // The resource-specific properties for this resource. + Properties *JobProperties - // READ-ONLY; List of supported Azure regions for reserved instances. - ReservedInstanceSupportedLocations []*string + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string - // READ-ONLY; List of supported Azure offer codes for reserved instances. - ReservedInstanceSupportedOffers []*string + // READ-ONLY; The name of the resource + Name *string - // READ-ONLY; List of supported VM Families. - ReservedInstanceVMFamilies []*string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // READ-ONLY; Dictionary of VM families grouped by vm family name describing the targeted azure locations of VM family and - // the category of the family. - VMFamilies []*VMFamily + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string } -// AssessmentOptionsResultList - List of API operations. -type AssessmentOptionsResultList struct { - // List of operations. - Value []*AssessmentOptions +// VmwareJobListResult - The response of a VmwareJob list operation. +type VmwareJobListResult struct { + // REQUIRED; The VmwareJob items on this page + Value []*VmwareJob + + // The link to the next page of items + NextLink *string } -// AssessmentProperties - Properties of an assessment. -type AssessmentProperties struct { - // REQUIRED; Storage type selected for this disk. - AzureDiskType *AzureDiskType +// VmwareMachineProperties - Class for machine properties. +type VmwareMachineProperties struct { + // Gets or sets the allocated Memory in MB. + AllocatedMemoryInMb *float64 - // REQUIRED; AHUB discount on windows virtual machines. - AzureHybridUseBenefit *AzureHybridUseBenefit + // Gets or sets the BIOS GUID. + BiosGUID *string - // REQUIRED; Target Azure location for which the machines should be assessed. These enums are the same as used by Compute - // API. - AzureLocation *AzureLocation + // Gets or sets the Machine BIOS serial number. + BiosSerialNumber *string - // REQUIRED; Offer code according to which cost estimation is done. - AzureOfferCode *AzureOfferCode + // Gets or sets the firmware. + Firmware *string - // REQUIRED; Pricing tier for Size evaluation. - AzurePricingTier *AzurePricingTier + // Gets or sets the Number of Processor Cores allocated for the machine. + NumberOfProcessorCore *int32 - // REQUIRED; Storage Redundancy type offered by Azure. - AzureStorageRedundancy *AzureStorageRedundancy + // Gets or sets the Operating System Details installed on the machine. + OperatingSystemDetails *OperatingSystem - // REQUIRED; List of azure VM families. - AzureVMFamilies []*AzureVMFamily + // product support status. + ProductSupportStatus *ProductSupportStatus - // REQUIRED; Currency to report prices in. - Currency *Currency + // Gets or sets the run as account ID of the machine. + RunAsAccountID *string - // REQUIRED; Custom discount percentage to be applied on final costs. Can be in the range [0, 100]. - DiscountPercentage *float64 + // Gets or sets tags on the VMware machine. + Tags map[string]*string - // REQUIRED; Percentile of performance data used to recommend Azure size. - Percentile *Percentile + // READ-ONLY; Gets or sets the machine alt guest name. + AltGuestName *string - // REQUIRED; Azure reserved instance. - ReservedInstance *ReservedInstance + // READ-ONLY; Gets the appliance names. + ApplianceNames []*string - // REQUIRED; Scaling factor used over utilization data to add a performance buffer for new machines to be created in Azure. - // Min Value = 1.0, Max value = 1.9, Default = 1.3. - ScalingFactor *float64 + // READ-ONLY; Gets the data related to application discovery. + ApplicationDiscovery *ApplicationDiscovery - // REQUIRED; Assessment sizing criterion. - SizingCriterion *AssessmentSizingCriterion + // READ-ONLY; Apps And Roles of the Server. + AppsAndRoles *AppsAndRoles - // REQUIRED; User configurable setting that describes the status of the assessment. - Stage *AssessmentStage + // READ-ONLY; Value indicating whether change tracking is enabled. + ChangeTrackingEnabled *bool - // REQUIRED; Time range of performance data used to recommend a size. - TimeRange *TimeRange + // READ-ONLY; Value indicating whether change tracking is supported. + ChangeTrackingSupported *bool - // REQUIRED; Specify the duration for which the VMs are up in the on-premises environment. - VMUptime *VMUptime + // READ-ONLY; Gets the marking machine creation. + CreatedTimestamp *string - // READ-ONLY; Confidence rating percentage for assessment. Can be in the range [0, 100]. - ConfidenceRatingInPercentage *float64 + // READ-ONLY; Scope of the data center. + DataCenterScope *string - // READ-ONLY; Time when this project was created. Date-Time represented in ISO-8601 format. - CreatedTimestamp *time.Time + // READ-ONLY; Gets the data related to dependency map discovery. + DependencyMapDiscovery *DependencyMapDiscovery - // READ-ONLY; Enterprise agreement subscription arm id. - EaSubscriptionID *string + // READ-ONLY; Gets or sets if dependency mapping feature is enabled or not for the VM. + DependencyMapping *string - // READ-ONLY; Monthly network cost estimate for the machines that are part of this assessment as a group, for a 31-day month. - MonthlyBandwidthCost *float64 + // READ-ONLY; Gets or sets when dependency mapping collection was last disabled. + DependencyMappingEndTime *string - // READ-ONLY; Monthly compute cost estimate for the machines that are part of this assessment as a group, for a 31-day month. - MonthlyComputeCost *float64 + // READ-ONLY; Gets or sets when dependency mapping collection is last started. + DependencyMappingStartTime *time.Time - // READ-ONLY; Monthly premium storage cost estimate for the machines that are part of this assessment as a group, for a 31-day - // month. - MonthlyPremiumStorageCost *float64 + // READ-ONLY; User description of the machine. + Description *string - // READ-ONLY; Monthly standard SSD storage cost estimate for the machines that are part of this assessment as a group, for - // a 31-day month. - MonthlyStandardSSDStorageCost *float64 + // READ-ONLY; Gets or sets whether Disk Enabled UUID is set or not. + DiskEnabledUUID *string - // READ-ONLY; Monthly storage cost estimate for the machines that are part of this assessment as a group, for a 31-day month. - MonthlyStorageCost *float64 + // READ-ONLY; Disks attached to the machine. + Disks []*VmwareDisk - // READ-ONLY; Number of assessed machines part of this assessment. - NumberOfMachines *int32 + // READ-ONLY; Gets the Display name of the machine. + DisplayName *string - // READ-ONLY; End time to consider performance data for assessment - PerfDataEndTime *time.Time + // READ-ONLY; Errors for machine. + Errors []*HealthErrorDetails - // READ-ONLY; Start time to consider performance data for assessment - PerfDataStartTime *time.Time + // READ-ONLY; The last time at which the Guest Details was discovered or the error while discovering guest details based discovery + // of the machine. + GuestDetailsDiscoveryTimestamp *time.Time - // READ-ONLY; Time when the Azure Prices were queried. Date-Time represented in ISO-8601 format. - PricesTimestamp *time.Time + // READ-ONLY; Operating System Details extracted from the guest bu executing script inside the guest VM. + GuestOsDetails *GuestOsDetails - // READ-ONLY; Whether the assessment has been created and is valid. - Status *AssessmentStatus + // READ-ONLY; Indicates whether the host is in maintenance mode. + HostInMaintenanceMode *bool - // READ-ONLY; Time when this project was last updated. Date-Time represented in ISO-8601 format. - UpdatedTimestamp *time.Time -} + // READ-ONLY; The host name. + HostName *string -// AssessmentResultList - List of assessments. -type AssessmentResultList struct { - // List of assessments. - Value []*Assessment -} + // READ-ONLY; The host power state. + HostPowerState *string -type CollectorAgentProperties struct { - SpnDetails *CollectorBodyAgentSpnProperties + // READ-ONLY; The host version. + HostVersion *string - // READ-ONLY - ID *string + // READ-ONLY; Gets the data related to iis discovery. + IisDiscovery *WebAppDiscovery - // READ-ONLY - LastHeartbeatUTC *time.Time + // READ-ONLY; On-premise Instance UUID of the machine. + InstanceUUID *string - // READ-ONLY - Version *string -} + // READ-ONLY; Value indicating whether VM is deleted. + IsDeleted *bool -type CollectorBodyAgentSpnProperties struct { - // Application/client Id for the service principal with which the on-premise management/data plane components would communicate - // with our Azure services. - ApplicationID *string + // READ-ONLY; Whether Refresh Fabric Layout Guest Details has been completed once. + // Portal will show discovery in progress, if this value is true. + IsGuestDetailsDiscoveryInProgress *bool - // Intended audience for the service principal. - Audience *string + // READ-ONLY; Maximum number of snapshots for the VM. Default value is -1. + MaxSnapshots *int32 - // AAD Authority URL which was used to request the token for the service principal. - Authority *string + // READ-ONLY; Network adapters attached to the machine. + NetworkAdapters []*VmwareNetworkAdapter - // Object Id of the service principal with which the on-premise management/data plane components would communicate with our - // Azure services. - ObjectID *string + // READ-ONLY; Number of applications installed in the guest VM. + NumberOfApplications *int32 - // Tenant Id for the service principal with which the on-premise management/data plane components would communicate with our - // Azure services. - TenantID *string -} + // READ-ONLY; Number of snapshots for the VM. Default value is -1. + NumberOfSnapshots *int32 -type CollectorProperties struct { - AgentProperties *CollectorAgentProperties + // READ-ONLY; Gets the data related to Oracle discovery. + OracleDiscovery *OracleDiscovery - // The ARM id of the discovery service site. - DiscoverySiteID *string + // READ-ONLY; Gets the Machine power status. + PowerStatus *string - // READ-ONLY; Time when this collector was created. Date-Time represented in ISO-8601 format. - CreatedTimestamp *string + // READ-ONLY; The status of the last operation. + ProvisioningState *ProvisioningState + + // READ-ONLY; Gets the data related to SQL discovery. + SQLDiscovery *SQLDiscovery + + // READ-ONLY; Gets the data related to SpringBoot discovery. + SpringBootDiscovery *SpringBootDiscovery + + // READ-ONLY; Gets the data related to static discovery. + StaticDiscovery *StaticDiscovery - // READ-ONLY; Time when this collector was updated. Date-Time represented in ISO-8601 format. + // READ-ONLY; Gets the data related to tomcat discovery. + TomcatDiscovery *WebAppDiscovery + + // READ-ONLY; Gets the timestamp marking last updated on the machine. UpdatedTimestamp *string -} -// Disk - A disk discovered on a machine. -type Disk struct { - // READ-ONLY; User friendly name of the disk. - DisplayName *string + // READ-ONLY; VCenter FQDN/IPAddress. + VCenterFqdn *string - // READ-ONLY; Gigabytes of storage provisioned for this disk. - GigabytesAllocated *float64 -} + // READ-ONLY; VCenter ARM ID. + VCenterID *string -// DownloadURL - Download URL for assessment report. -type DownloadURL struct { - // READ-ONLY; Hyperlink to download report. - AssessmentReportURL *string + // READ-ONLY; Gets the Root location of the VM configuration file. + VMConfigurationFileLocation *string - // READ-ONLY; Expiry date of download url. - ExpirationTime *time.Time -} + // READ-ONLY; Gets the VM FQDN. + VMFqdn *string -// Group - A group created in a Migration project. -type Group struct { - // REQUIRED; Properties of the group. - Properties *GroupProperties + // READ-ONLY; VMware tools status. + VMwareToolsStatus *string - // For optimistic concurrency control. - ETag *string + // READ-ONLY; VMware tools version. + VMwareToolsVersion *string + + // READ-ONLY; Gets the data related to Web application discovery. + WebAppDiscovery *WebAppDiscovery +} - // READ-ONLY; Path reference to this group. /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName} +// VmwareMachineSoftwareInventory - An software inventory resource belonging to a machine resource. +type VmwareMachineSoftwareInventory struct { + // The resource-specific properties for this resource. + Properties *MachineSoftwareInventoryProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Name of the group. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Type of the object = [Microsoft.Migrate/assessmentProjects/groups]. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// GroupBodyProperties - Body properties of group update. -type GroupBodyProperties struct { - // List of machine names that are part of this group. - Machines []*string +// VmwareMachineSoftwareInventoryListResult - The response of a VmwareMachineSoftwareInventory list operation. +type VmwareMachineSoftwareInventoryListResult struct { + // REQUIRED; The VmwareMachineSoftwareInventory items on this page + Value []*VmwareMachineSoftwareInventory - // Whether to add or remove the machines. - OperationType *GroupUpdateOperation + // The link to the next page of items + NextLink *string } -// GroupProperties - Properties of group resource. -type GroupProperties struct { - // The type of group. - GroupType *string - - // READ-ONLY; If the assessments are in running state. - AreAssessmentsRunning *bool +// VmwareNetworkAdapter - Second level object represented in responses as part of Machine REST resource. +type VmwareNetworkAdapter struct { + // Gets or sets Type of the IP address. + IPAddressType *string - // READ-ONLY; List of References to Assessments created on this group. - Assessments []*string + // Gets or sets Mac address of the NIC. + MacAddress *string - // READ-ONLY; Time when this group was created. Date-Time represented in ISO-8601 format. - CreatedTimestamp *time.Time + // Gets or sets Network Name. + NetworkName *string - // READ-ONLY; Whether the group has been created and is valid. - GroupStatus *GroupStatus + // Gets or sets the NIC Id. + NicID *string - // READ-ONLY; Number of machines part of this group. - MachineCount *int32 + // READ-ONLY; Gets or sets the adapter type. + AdapterType *string - // READ-ONLY; Time when this group was last updated. Date-Time represented in ISO-8601 format. - UpdatedTimestamp *time.Time -} + // READ-ONLY; Gets IP addresses for the machine. + IPAddressList []*string -// GroupResultList - List of groups. -type GroupResultList struct { - // List of groups. - Value []*Group + // READ-ONLY; Label of the NIC. + Label *string } -type HyperVCollector struct { - ETag *string - Properties *CollectorProperties +// VmwareRunAsAccountResource - A runasaccount resource belonging to a site resource. +type VmwareRunAsAccountResource struct { + // The resource-specific properties for this resource. + Properties *RunAsAccountProperties - // READ-ONLY + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY + // READ-ONLY; The name of the resource Name *string - // READ-ONLY + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// HyperVCollectorList - List of Hyper-V collectors. -type HyperVCollectorList struct { - // List of Hyper-V collectors. - Value []*HyperVCollector +// VmwareRunAsAccountResourceListResult - The response of a VmwareRunAsAccountResource list operation. +type VmwareRunAsAccountResourceListResult struct { + // REQUIRED; The VmwareRunAsAccountResource items on this page + Value []*VmwareRunAsAccountResource + + // The link to the next page of items + NextLink *string } -type ImportCollector struct { - ETag *string - Properties *ImportCollectorProperties +// VmwareSite - A VmwareSite +type VmwareSite struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *SitesProperties - // READ-ONLY + // Resource tags. + Tags map[string]*string + + // READ-ONLY; If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. + // Entity tags are used for comparing two or more entities from the same requested resource. + // HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range + // (section 14.27) header fields. + ETag *string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY + // READ-ONLY; The name of the resource Name *string - // READ-ONLY + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// ImportCollectorList - List of Import collectors. -type ImportCollectorList struct { - // List of Import collectors. - Value []*ImportCollector -} +// VmwareSiteListResult - The response of a VmwareSite list operation. +type VmwareSiteListResult struct { + // REQUIRED; The VmwareSite items on this page + Value []*VmwareSite -type ImportCollectorProperties struct { - DiscoverySiteID *string + // The link to the next page of items + NextLink *string +} - // READ-ONLY - CreatedTimestamp *string +// VmwareSiteUpdate - The type used for update operations of the VmwareSite. +type VmwareSiteUpdate struct { + // The updatable properties of the VmwareSite. + Properties *VmwareSiteUpdateProperties - // READ-ONLY - UpdatedTimestamp *string + // Resource tags. + Tags map[string]*string } -// Machine - A machine in a migration project. -type Machine struct { - // For optimistic concurrency control. - ETag *string +// VmwareSiteUpdateProperties - The updatable properties of the VmwareSite. +type VmwareSiteUpdateProperties struct { + // Gets or sets the on-premises agent details. + AgentDetails *SiteAgentProperties - // Properties of the machine. - Properties *MachineProperties + // Gets or sets the Appliance Name. + ApplianceName *string - // READ-ONLY; Path reference to this machine. /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/machines/{machineName} - ID *string + // Gets or sets the ARM ID of migration hub solution for SDS. + DiscoverySolutionID *string - // READ-ONLY; Name of the machine. It is a GUID which is unique identifier of machine in private data center. For user-readable - // name, we have a displayName property on this machine. - Name *string + // The status of the last operation. + ProvisioningState *ProvisioningState - // READ-ONLY; Type of the object = [Microsoft.Migrate/assessmentProjects/machines]. - Type *string + // Gets or sets the service principal identity details used by agent for communication to the service. + ServicePrincipalIdentityDetails *SiteSpnProperties } -// MachineProperties - Properties of a machine. -type MachineProperties struct { - // READ-ONLY; Boot type of the machine. - BootType *MachineBootType +// VmwareSiteUsage - VMware site usage. +type VmwareSiteUsage struct { + // Gets or sets the number of machines discovered in the site. + MachineCount *int32 + + // Gets or sets the number of run as accounts in the site. + RunAsAccountCount *int32 - // READ-ONLY; Time when this machine was created. Date-Time represented in ISO-8601 format. - CreatedTimestamp *time.Time + // Gets or sets the number of vCenters part of the site. + VCenterCount *int32 +} - // READ-ONLY; ARM ID of the data center as tracked by the Microsoft.OffAzure. - DatacenterManagementServerArmID *string +// WebAppDiscovery - Data related to a machine's WebApps discovery. +type WebAppDiscovery struct { + // Gets or sets status of partner discovery. + DiscoveryScopeStatus *DiscoveryScopeStatus - // READ-ONLY; Name of the server hosting the datacenter management solution. - DatacenterManagementServerName *string + // Gets or sets number of successfully discovered web applications. + TotalWebApplicationCount *int64 - // READ-ONLY; Description of the machine - Description *string + // Gets or sets number of successfully discovered web servers.. + TotalWebServerCount *int64 +} - // READ-ONLY; ARM ID of the machine as tracked by the Microsoft.OffAzure. - DiscoveryMachineArmID *string +// WebAppExtendedMachine - Web app extended machine REST Resource. +type WebAppExtendedMachine struct { + // The resource-specific properties for this resource. + Properties *WebAppExtendedMachineProperties - // READ-ONLY; Dictionary of disks attached to the machine. Key is ID of disk. Value is a disk object - Disks map[string]*Disk + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string - // READ-ONLY; User readable name of the machine as defined by the user in their private datacenter. - DisplayName *string + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // READ-ONLY; List of references to the groups that the machine is member of. - Groups []*string + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} - // READ-ONLY; Memory in Megabytes. - MegabytesOfMemory *float32 +// WebAppExtendedMachineListResult - The response of a WebAppExtendedMachine list operation. +type WebAppExtendedMachineListResult struct { + // REQUIRED; The WebAppExtendedMachine items on this page + Value []*WebAppExtendedMachine - // READ-ONLY; Dictionary of network adapters attached to the machine. Key is ID of network adapter. Value is a network adapter - // object - NetworkAdapters map[string]*NetworkAdapter + // The link to the next page of items + NextLink *string +} - // READ-ONLY; Processor count. - NumberOfCores *int32 +// WebAppExtendedMachineProperties - Class for web extended machine properties. +type WebAppExtendedMachineProperties struct { + // READ-ONLY; Gets the timestamp marking creation of the entity. + CreatedTimestamp *string - // READ-ONLY; Operating System name of the machine. - OperatingSystemName *string + // READ-ONLY; Gets the Error details. + Errors []*HealthErrorDetails - // READ-ONLY; Operating System type of the machine. - OperatingSystemType *string + // READ-ONLY; Gets the hydrated host name. + HostName *string - // READ-ONLY; Operating System version of the machine. - OperatingSystemVersion *string + // READ-ONLY; Gets the agent hydrated run as account. + HydratedRunAsAccountID *string - // READ-ONLY; Time when this machine was last updated. Date-Time represented in ISO-8601 format. - UpdatedTimestamp *time.Time -} + // READ-ONLY; Gets a value indicating whether application is deleted. + IsDeleted *bool -// MachineResultList - List of machines. -type MachineResultList struct { - NextLink *string + // READ-ONLY; Gets the Name of the extended machine. + MachineDisplayName *string - // List of machines. - Value []*Machine -} + // READ-ONLY; Gets the machine ARM id. + MachineID *string -// NetworkAdapter - A network adapter discovered on a machine. -type NetworkAdapter struct { - // READ-ONLY; User friendly name of the network adapter. - DisplayName *string + // READ-ONLY; provisioning state enum + ProvisioningState *ProvisioningState - // READ-ONLY; List of IP Addresses on the network adapter. - IPAddresses []*string + // READ-ONLY; Gets the run as account ID of the machine used for web app discovery. + RunAsAccountID *string - // READ-ONLY; MAC Address of the network adapter. - MacAddress *string + // READ-ONLY; Gets the timestamp marking last update operation. + UpdatedTimestamp *string } -// Operation - A REST API operation supported by the provider. -type Operation struct { - // READ-ONLY; Displayable properties of the operation. - Display *OperationDisplay +// WebAppProperties - Class representing web app properties web model. +type WebAppProperties struct { + // Gets or sets Tags. + Tags map[string]*string - // READ-ONLY; Name of the operation. - Name *string + // Gets or sets the arm id of the web app. + WebAppArmID *string +} - // READ-ONLY; Origin of the operation. - Origin *string +// WebAppPropertiesCollection - Collection of web app properties. +type WebAppPropertiesCollection struct { + // Gets or sets the list of web app properties. + WebApps []*WebAppProperties } -// OperationDisplay - Displayable properties of the operation. -type OperationDisplay struct { - // READ-ONLY; Description of the operation. - Description *string +// WebAppRunAsAccount - Run as account REST Resource. +type WebAppRunAsAccount struct { + // The resource-specific properties for this resource. + Properties *RunAsAccountProperties - // READ-ONLY; Operation Type. - Operation *string + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string - // READ-ONLY; Provider of the operation. - Provider *string + // READ-ONLY; The name of the resource + Name *string - // READ-ONLY; Resource operated on by the operation. - Resource *string -} + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData -// OperationResultList - List of API operations. -type OperationResultList struct { - // List of operations. - Value []*Operation + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string } -// PrivateEndpointConnection - A private endpoint connection for a project. -type PrivateEndpointConnection struct { - // REQUIRED; Properties of the private endpoint endpoint connection. - Properties *PrivateEndpointConnectionProperties +// WebAppRunAsAccountListResult - The response of a WebAppRunAsAccount list operation. +type WebAppRunAsAccountListResult struct { + // REQUIRED; The WebAppRunAsAccount items on this page + Value []*WebAppRunAsAccount - // For optimistic concurrency control. - ETag *string + // The link to the next page of items + NextLink *string +} + +// WebAppSite - WebApp site web model. +type WebAppSite struct { + // The resource-specific properties for this resource. + Properties *WebAppSiteProperties - // READ-ONLY; Path reference to this private endpoint endpoint connection. - // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/privateEndpointConnections/{privateEndpointConnectionName} + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Name of the private endpoint endpoint connection. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Type of the object = [Microsoft.Migrate/assessmentProjects/privateEndpointConnections]. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// PrivateEndpointConnectionCollection - A collection of private endpoint connections for a project. -type PrivateEndpointConnectionCollection struct { - // READ-ONLY +// WebAppSiteListResult - The response of a WebAppSite list operation. +type WebAppSiteListResult struct { + // REQUIRED; The WebAppSite items on this page + Value []*WebAppSite + + // The link to the next page of items NextLink *string +} - // READ-ONLY; A list of private endpoint connections for a project. - Value []*PrivateEndpointConnection +// WebAppSiteProperties - Class for Web app site properties. +type WebAppSiteProperties struct { + // Gets or sets the discovery scenario. + DiscoveryScenario *WebAppSitePropertiesDiscoveryScenario + + // Gets or sets the appliance details used by service to communicate + // to the appliance. + SiteAppliancePropertiesCollection []*SiteApplianceProperties + + // READ-ONLY; provisioning state enum + ProvisioningState *ProvisioningState + + // READ-ONLY; Gets the service endpoint. + ServiceEndpoint *string } -// PrivateEndpointConnectionProperties - Private endpoint connection properties. -type PrivateEndpointConnectionProperties struct { - // State of the private endpoint connection. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState +// WebAppSiteUpdate - The type used for update operations of the WebAppSite. +type WebAppSiteUpdate struct { + // The updatable properties of the WebAppSite. + Properties *WebAppSiteUpdateProperties +} - // READ-ONLY; ARM id for the private endpoint resource corresponding to the connection. - PrivateEndpoint *ResourceID +// WebAppSiteUpdateProperties - The updatable properties of the WebAppSite. +type WebAppSiteUpdateProperties struct { + // Gets or sets the discovery scenario. + DiscoveryScenario *WebAppSitePropertiesDiscoveryScenario - // READ-ONLY; Indicates whether there is an ongoing operation on the private endpoint. - ProvisioningState *PrivateEndpointConnectionPropertiesProvisioningState + // Gets or sets the appliance details used by service to communicate + // to the appliance. + SiteAppliancePropertiesCollection []*SiteApplianceProperties } -// PrivateLinkResource - A private link resource for a project for which a private endpoint can be created. -type PrivateLinkResource struct { - // READ-ONLY; Path reference to this private link resource. - // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/privateLinkResources/{privateLinkResourceName} +// WebAppSiteUsage - Web app site usage. +type WebAppSiteUsage struct { + // Gets or sets the number of run as accounts in the site. + RunAsAccountCount *int32 + + // Gets or sets the number of web applications discovered in the site. + WebApplicationCount *int32 + + // Gets or sets the number of web servers discovered in the site. + WebServerCount *int32 +} + +// WebApplication - Web application REST Resource. +type WebApplication struct { + // The resource-specific properties for this resource. + Properties *WebApplicationProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Name of the private link resource. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Properties of the private link resource. - Properties *PrivateLinkResourceProperties + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // READ-ONLY; Type of the object = [Microsoft.Migrate/assessmentProjects/privateLinkResources]. + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// PrivateLinkResourceCollection - A list of private link resources -type PrivateLinkResourceCollection struct { - // READ-ONLY; Link to retrieve next page of results. - NextLink *string +// WebApplicationAppsAndRolesModel - WebApplication in the guest virtual machine. +type WebApplicationAppsAndRolesModel struct { + // READ-ONLY; Gets or sets ApplicationPool of the WebApplication. + ApplicationPool *string - // READ-ONLY; Array of results. - Value []*PrivateLinkResource -} + // READ-ONLY; Gets or sets GroupName of the WebApplication. + GroupName *string -// PrivateLinkResourceProperties - Properties of a private link resource. -type PrivateLinkResourceProperties struct { - // READ-ONLY; The private link resource group id. - GroupID *string + // READ-ONLY; Gets or sets Name of the WebApplication. + Name *string - // READ-ONLY; The private link resource required member names. - RequiredMembers []*string + // READ-ONLY; Gets or sets Platform of the WebApplication. + Platform *string - // READ-ONLY; Required DNS zone names of the the private link resource. - RequiredZoneNames []*string + // READ-ONLY; Gets or sets Status of the WebApplication. + Status *string + + // READ-ONLY; Gets or sets WebServer of the WebApplication. + WebServer *string } -// PrivateLinkServiceConnectionState - State of a private endpoint connection. -type PrivateLinkServiceConnectionState struct { - // Actions required on the private endpoint connection. - ActionsRequired *string +// WebApplicationConfigurationUnit - Web Application configuration unit. +type WebApplicationConfigurationUnit struct { + // Gets or sets the configuration file path. + FilePath *string - // Description of the private endpoint connection. - Description *string + // Gets or sets the identifier for the configuration. + Identifier *string - // Connection status of the private endpoint connection. - Status *PrivateLinkServiceConnectionStateStatus -} + // Gets or sets a value indicating whether the configuration is edited or not by the user. + IsDeploymentTimeEditable *bool -// Project - Azure Migrate Project. -type Project struct { - // For optimistic concurrency control. - ETag *string + // Gets or sets the configuration local file path. + LocalFilePath *string - // Azure location in which project is created. - Location *string + // Gets or sets the configuration name. + Name *string - // Properties of the project. - Properties *ProjectProperties + // Gets or sets the configuration section in the file. + Section *string - // Tags provided by Azure Tagging service. - Tags any + // Gets or sets the configuration target file path. + TargetFilePath *string - // READ-ONLY; Path reference to this project /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName} + // Gets or sets the configuration type. + Type *string +} + +// WebApplicationDirectoryUnit - Web Application directory unit. +type WebApplicationDirectoryUnit struct { + // Gets or sets the unique id corresponding to the application directory. ID *string - // READ-ONLY; Name of the project. + // Gets or sets a value indicating whether the directory object is editable. + // True when the directory is added as an optional directory, false when + // discovery is done manually. + IsEditable *bool + + // Gets or sets the local scratch path at which the directories has been copied. + LocalScratchPath *string + + // Gets or sets the mount path of the application directory. + MountPath *string + + // Gets or sets the paths of the directory on the source machine. + SourcePaths []*string + + // Gets or sets the size of the directory on the source machine. + SourceSize *string +} + +// WebApplicationFramework - Framework specific data for a web application. +type WebApplicationFramework struct { + // Gets or sets Name of the framework. Name *string - // READ-ONLY; Type of the object = [Microsoft.Migrate/assessmentProjects]. - Type *string + // Gets or sets Version of the framework. + Version *string } -// ProjectProperties - Properties of a project. -type ProjectProperties struct { - // Assessment solution ARM id tracked by Microsoft.Migrate/migrateProjects. - AssessmentSolutionID *string +// WebApplicationListResult - The response of a WebApplication list operation. +type WebApplicationListResult struct { + // REQUIRED; The WebApplication items on this page + Value []*WebApplication - // The ARM id of the storage account used for interactions when public access is disabled. - CustomerStorageAccountArmID *string + // The link to the next page of items + NextLink *string +} + +// WebApplicationProperties - Class for web application properties. +type WebApplicationProperties struct { + // READ-ONLY; Gets the appliance names. + ApplianceNames []*string + + // READ-ONLY; Gets the front end bindings for the application. + Bindings []*FrontEndBinding - // The ARM id of service map workspace created by customer. - CustomerWorkspaceID *string + // READ-ONLY; Gets the configuration. + Configurations []*WebApplicationConfigurationUnit - // Location of service map workspace created by customer. - CustomerWorkspaceLocation *string + // READ-ONLY; Gets the timestamp marking creation of the entity. + CreatedTimestamp *string + + // READ-ONLY; Gets the directories. + Directories []*WebApplicationDirectoryUnit - // Assessment project status. - ProjectStatus *ProjectStatus + // READ-ONLY; Gets the display name. + DisplayName *string - // This value can be set to 'enabled' to avoid breaking changes on existing customer resources and templates. If set to 'disabled', - // traffic over public interface is not allowed, and private endpoint - // connections would be the exclusive access method. - PublicNetworkAccess *string + // READ-ONLY; Gets the Error details. + Errors []*HealthErrorDetails - // READ-ONLY; Time when this project was created. Date-Time represented in ISO-8601 format. - CreatedTimestamp *time.Time + // READ-ONLY; Gets the Error details. + Frameworks []*WebApplicationFramework - // READ-ONLY; Time when last assessment was created. Date-Time represented in ISO-8601 format. This value will be null until - // assessment is created. - LastAssessmentTimestamp *time.Time + // READ-ONLY; Gets a value indicating whether the WebApp has errors or not. + HasErrors *bool - // READ-ONLY; Number of assessments created in the project. - NumberOfAssessments *int32 + // READ-ONLY; Gets a value indicating whether application is deleted. + IsDeleted *bool - // READ-ONLY; Number of groups created in the project. - NumberOfGroups *int32 + // READ-ONLY; Gets the list of machine ARM Ids on which the SQL server is deployed. + MachineArmIDs []*string - // READ-ONLY; Number of machines in the project. - NumberOfMachines *int32 + // READ-ONLY; Machine display name + MachineDisplayName *string - // READ-ONLY; The list of private endpoint connections to the project. - PrivateEndpointConnections []*PrivateEndpointConnection + // READ-ONLY; Gets the physical path of the application. + PhysicalPath *string - // READ-ONLY; Provisioning state of the project. + // READ-ONLY; provisioning state enum ProvisioningState *ProvisioningState - // READ-ONLY; Endpoint at which the collector agent can call agent REST API. - ServiceEndpoint *string + // READ-ONLY; Gets the server type. + ServerType *string + + // READ-ONLY; Static folders. + StaticFolders []*string + + // READ-ONLY; Gets tags that can be used with ODATA. + Tags map[string]*string + + // READ-ONLY; Gets the timestamp marking last update operation. + UpdatedTimestamp *string + + // READ-ONLY; Gets the virtual path of the application. + VirtualPath *string - // READ-ONLY; Time when this project was last updated. Date-Time represented in ISO-8601 format. - UpdatedTimestamp *time.Time + // READ-ONLY; Gets the web server id. + WebServerID *string + + // READ-ONLY; Gets the web server name. + WebServerName *string } -// ProjectResultList - List of projects. -type ProjectResultList struct { - NextLink *string +// WebRoleImportDisk - Class representing the imported machine web model. +type WebRoleImportDisk struct { + // Gets or sets Type of the disk. + DiskType *string - // List of projects. - Value []*Project + // Gets or sets LUN of the disk. + Lun *int32 + + // Gets or sets Bytes allocated for the disk. + MaxSizeInBytes *int64 + + // Gets or sets Name of the disk. + Name *string + + // Gets or sets Path of the disk. + Path *string + + // READ-ONLY; Disk read throughput. + MegabytesPerSecondOfRead *float32 + + // READ-ONLY; Disk write throughput. + MegabytesPerSecondOfWrite *float32 + + // READ-ONLY; Disk read IOPS. + NumberOfReadOperationsPerSecond *float32 + + // READ-ONLY; Disk write IOPS. + NumberOfWriteOperationsPerSecond *float32 } -// ResourceID - ARM id for a resource. -type ResourceID struct { - // READ-ONLY - ID *string +// WebRoleOperatingSystem - Second level object returned as part of Machine REST resource. +type WebRoleOperatingSystem struct { + // Gets or sets the Architecture of the operating system. + OSArchitecture *string + + // Gets or sets the Name of the operating system. + OSName *string + + // Gets or sets the type of the operating system. + OSType *string + + // Gets or sets the Version of the operating system. + OSVersion *string } -type ServerCollector struct { - ETag *string - Properties *CollectorProperties +// WebServer - Web application REST Resource. +type WebServer struct { + // The resource-specific properties for this resource. + Properties *WebServerProperties - // READ-ONLY + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY + // READ-ONLY; The name of the resource Name *string - // READ-ONLY + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// ServerCollectorList - List of Server collectors. -type ServerCollectorList struct { - // List of Server collectors. - Value []*ServerCollector +// WebServerListResult - The response of a WebServer list operation. +type WebServerListResult struct { + // REQUIRED; The WebServer items on this page + Value []*WebServer + + // The link to the next page of items + NextLink *string } -// UpdateGroupBody - Properties of group update. -type UpdateGroupBody struct { - // For optimistic concurrency control. - ETag *string +// WebServerProperties - Class for web server properties. +type WebServerProperties struct { + // READ-ONLY; Gets the appliance names. + ApplianceNames []*string - // Properties of the group. - Properties *GroupBodyProperties -} + // READ-ONLY; Gets the configuration location. + ConfigurationLocation *string -// VMFamily - VM family name, the list of targeted azure locations and the category of the family. -type VMFamily struct { - // READ-ONLY; Category of the VM family. - Category []*string + // READ-ONLY; Gets the timestamp marking creation of the entity. + CreatedTimestamp *string - // READ-ONLY; Name of the VM family. - FamilyName *string + // READ-ONLY; Gets the display name. + DisplayName *string - // READ-ONLY; List of Azure regions. - TargetLocations []*string -} + // READ-ONLY; Gets the Error details. + Errors []*HealthErrorDetails -type VMUptime struct { - // Number of days in a month for VM uptime. - DaysPerMonth *int32 + // READ-ONLY; Gets a value indicating whether the WebApp has errors or not. + HasErrors *bool - // Number of hours per day for VM uptime. - HoursPerDay *int32 -} + // READ-ONLY; Gets a value indicating whether application is deleted. + IsDeleted *bool -type VMwareCollector struct { - ETag *string - Properties *CollectorProperties + // READ-ONLY; Gets the list of machines. + MachineIDs []*string - // READ-ONLY - ID *string + // READ-ONLY; provisioning state enum + ProvisioningState *ProvisioningState - // READ-ONLY - Name *string + // READ-ONLY; Gets the run as account id. + RunAsAccountID *string - // READ-ONLY - Type *string -} + // READ-ONLY; Gets the server FQDN. + ServerFqdn *string + + // READ-ONLY; Gets the server type. + ServerType *string + + // READ-ONLY; Gets the timestamp marking last update operation. + UpdatedTimestamp *string + + // READ-ONLY; Gets the configuration location. + Version *string -// VMwareCollectorList - List of VMware collectors. -type VMwareCollectorList struct { - // List of VMware collectors. - Value []*VMwareCollector + // READ-ONLY; Gets the list of web applications. + WebApplications []*string } diff --git a/sdk/resourcemanager/migrate/armmigrate/models_serde.go b/sdk/resourcemanager/migrate/armmigrate/models_serde.go index 0e6743119aed..8626b7b31385 100644 --- a/sdk/resourcemanager/migrate/armmigrate/models_serde.go +++ b/sdk/resourcemanager/migrate/armmigrate/models_serde.go @@ -15,28 +15,17 @@ import ( "reflect" ) -// MarshalJSON implements the json.Marshaller interface for type AssessedDisk. -func (a AssessedDisk) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "displayName", a.DisplayName) - populate(objectMap, "gigabytesForRecommendedDiskSize", a.GigabytesForRecommendedDiskSize) - populate(objectMap, "gigabytesProvisioned", a.GigabytesProvisioned) - populate(objectMap, "megabytesPerSecondOfRead", a.MegabytesPerSecondOfRead) - populate(objectMap, "megabytesPerSecondOfWrite", a.MegabytesPerSecondOfWrite) - populate(objectMap, "monthlyStorageCost", a.MonthlyStorageCost) +// MarshalJSON implements the json.Marshaller interface for type Application. +func (a Application) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) populate(objectMap, "name", a.Name) - populate(objectMap, "numberOfReadOperationsPerSecond", a.NumberOfReadOperationsPerSecond) - populate(objectMap, "numberOfWriteOperationsPerSecond", a.NumberOfWriteOperationsPerSecond) - populate(objectMap, "recommendedDiskSize", a.RecommendedDiskSize) - populate(objectMap, "recommendedDiskType", a.RecommendedDiskType) - populate(objectMap, "suitability", a.Suitability) - populate(objectMap, "suitabilityDetail", a.SuitabilityDetail) - populate(objectMap, "suitabilityExplanation", a.SuitabilityExplanation) + populate(objectMap, "provider", a.Provider) + populate(objectMap, "version", a.Version) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AssessedDisk. -func (a *AssessedDisk) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Application. +func (a *Application) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -44,47 +33,14 @@ func (a *AssessedDisk) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "displayName": - err = unpopulate(val, "DisplayName", &a.DisplayName) - delete(rawMsg, key) - case "gigabytesForRecommendedDiskSize": - err = unpopulate(val, "GigabytesForRecommendedDiskSize", &a.GigabytesForRecommendedDiskSize) - delete(rawMsg, key) - case "gigabytesProvisioned": - err = unpopulate(val, "GigabytesProvisioned", &a.GigabytesProvisioned) - delete(rawMsg, key) - case "megabytesPerSecondOfRead": - err = unpopulate(val, "MegabytesPerSecondOfRead", &a.MegabytesPerSecondOfRead) - delete(rawMsg, key) - case "megabytesPerSecondOfWrite": - err = unpopulate(val, "MegabytesPerSecondOfWrite", &a.MegabytesPerSecondOfWrite) - delete(rawMsg, key) - case "monthlyStorageCost": - err = unpopulate(val, "MonthlyStorageCost", &a.MonthlyStorageCost) - delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &a.Name) delete(rawMsg, key) - case "numberOfReadOperationsPerSecond": - err = unpopulate(val, "NumberOfReadOperationsPerSecond", &a.NumberOfReadOperationsPerSecond) - delete(rawMsg, key) - case "numberOfWriteOperationsPerSecond": - err = unpopulate(val, "NumberOfWriteOperationsPerSecond", &a.NumberOfWriteOperationsPerSecond) - delete(rawMsg, key) - case "recommendedDiskSize": - err = unpopulate(val, "RecommendedDiskSize", &a.RecommendedDiskSize) - delete(rawMsg, key) - case "recommendedDiskType": - err = unpopulate(val, "RecommendedDiskType", &a.RecommendedDiskType) - delete(rawMsg, key) - case "suitability": - err = unpopulate(val, "Suitability", &a.Suitability) - delete(rawMsg, key) - case "suitabilityDetail": - err = unpopulate(val, "SuitabilityDetail", &a.SuitabilityDetail) + case "provider": + err = unpopulate(val, "Provider", &a.Provider) delete(rawMsg, key) - case "suitabilityExplanation": - err = unpopulate(val, "SuitabilityExplanation", &a.SuitabilityExplanation) + case "version": + err = unpopulate(val, "Version", &a.Version) delete(rawMsg, key) } if err != nil { @@ -94,19 +50,17 @@ func (a *AssessedDisk) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AssessedMachine. -func (a AssessedMachine) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ApplicationDiscovery. +func (a ApplicationDiscovery) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "eTag", a.ETag) - populate(objectMap, "id", a.ID) - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "type", a.Type) + populate(objectMap, "discoveryScopeStatus", a.DiscoveryScopeStatus) + populate(objectMap, "errors", a.Errors) + populate(objectMap, "hydratedRunAsAccountId", a.HydratedRunAsAccountID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AssessedMachine. -func (a *AssessedMachine) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationDiscovery. +func (a *ApplicationDiscovery) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -114,20 +68,14 @@ func (a *AssessedMachine) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "eTag": - err = unpopulate(val, "ETag", &a.ETag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) + case "discoveryScopeStatus": + err = unpopulate(val, "DiscoveryScopeStatus", &a.DiscoveryScopeStatus) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) + case "errors": + err = unpopulate(val, "Errors", &a.Errors) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) + case "hydratedRunAsAccountId": + err = unpopulate(val, "HydratedRunAsAccountID", &a.HydratedRunAsAccountID) delete(rawMsg, key) } if err != nil { @@ -137,43 +85,23 @@ func (a *AssessedMachine) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AssessedMachineProperties. -func (a AssessedMachineProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AppsAndRoles. +func (a AppsAndRoles) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "bootType", a.BootType) - populate(objectMap, "confidenceRatingInPercentage", a.ConfidenceRatingInPercentage) - populateDateTimeRFC3339(objectMap, "createdTimestamp", a.CreatedTimestamp) - populate(objectMap, "datacenterMachineArmId", a.DatacenterMachineArmID) - populate(objectMap, "datacenterManagementServerArmId", a.DatacenterManagementServerArmID) - populate(objectMap, "datacenterManagementServerName", a.DatacenterManagementServerName) - populate(objectMap, "description", a.Description) - populate(objectMap, "disks", a.Disks) - populate(objectMap, "displayName", a.DisplayName) - populate(objectMap, "megabytesOfMemory", a.MegabytesOfMemory) - populate(objectMap, "megabytesOfMemoryForRecommendedSize", a.MegabytesOfMemoryForRecommendedSize) - populate(objectMap, "monthlyBandwidthCost", a.MonthlyBandwidthCost) - populate(objectMap, "monthlyComputeCostForRecommendedSize", a.MonthlyComputeCostForRecommendedSize) - populate(objectMap, "monthlyPremiumStorageCost", a.MonthlyPremiumStorageCost) - populate(objectMap, "monthlyStandardSSDStorageCost", a.MonthlyStandardSSDStorageCost) - populate(objectMap, "monthlyStorageCost", a.MonthlyStorageCost) - populate(objectMap, "networkAdapters", a.NetworkAdapters) - populate(objectMap, "numberOfCores", a.NumberOfCores) - populate(objectMap, "numberOfCoresForRecommendedSize", a.NumberOfCoresForRecommendedSize) - populate(objectMap, "operatingSystemName", a.OperatingSystemName) - populate(objectMap, "operatingSystemType", a.OperatingSystemType) - populate(objectMap, "operatingSystemVersion", a.OperatingSystemVersion) - populate(objectMap, "percentageCoresUtilization", a.PercentageCoresUtilization) - populate(objectMap, "percentageMemoryUtilization", a.PercentageMemoryUtilization) - populate(objectMap, "recommendedSize", a.RecommendedSize) - populate(objectMap, "suitability", a.Suitability) - populate(objectMap, "suitabilityDetail", a.SuitabilityDetail) - populate(objectMap, "suitabilityExplanation", a.SuitabilityExplanation) - populateDateTimeRFC3339(objectMap, "updatedTimestamp", a.UpdatedTimestamp) + populate(objectMap, "applications", a.Applications) + populate(objectMap, "bizTalkServers", a.BizTalkServers) + populate(objectMap, "exchangeServers", a.ExchangeServers) + populate(objectMap, "features", a.Features) + populate(objectMap, "otherDatabases", a.OtherDatabases) + populate(objectMap, "sqlServers", a.SQLServers) + populate(objectMap, "sharePointServers", a.SharePointServers) + populate(objectMap, "systemCenters", a.SystemCenters) + populate(objectMap, "webApplications", a.WebApplications) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AssessedMachineProperties. -func (a *AssessedMachineProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AppsAndRoles. +func (a *AppsAndRoles) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -181,92 +109,32 @@ func (a *AssessedMachineProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "bootType": - err = unpopulate(val, "BootType", &a.BootType) - delete(rawMsg, key) - case "confidenceRatingInPercentage": - err = unpopulate(val, "ConfidenceRatingInPercentage", &a.ConfidenceRatingInPercentage) - delete(rawMsg, key) - case "createdTimestamp": - err = unpopulateDateTimeRFC3339(val, "CreatedTimestamp", &a.CreatedTimestamp) - delete(rawMsg, key) - case "datacenterMachineArmId": - err = unpopulate(val, "DatacenterMachineArmID", &a.DatacenterMachineArmID) + case "applications": + err = unpopulate(val, "Applications", &a.Applications) delete(rawMsg, key) - case "datacenterManagementServerArmId": - err = unpopulate(val, "DatacenterManagementServerArmID", &a.DatacenterManagementServerArmID) + case "bizTalkServers": + err = unpopulate(val, "BizTalkServers", &a.BizTalkServers) delete(rawMsg, key) - case "datacenterManagementServerName": - err = unpopulate(val, "DatacenterManagementServerName", &a.DatacenterManagementServerName) + case "exchangeServers": + err = unpopulate(val, "ExchangeServers", &a.ExchangeServers) delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &a.Description) - delete(rawMsg, key) - case "disks": - err = unpopulate(val, "Disks", &a.Disks) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &a.DisplayName) - delete(rawMsg, key) - case "megabytesOfMemory": - err = unpopulate(val, "MegabytesOfMemory", &a.MegabytesOfMemory) - delete(rawMsg, key) - case "megabytesOfMemoryForRecommendedSize": - err = unpopulate(val, "MegabytesOfMemoryForRecommendedSize", &a.MegabytesOfMemoryForRecommendedSize) - delete(rawMsg, key) - case "monthlyBandwidthCost": - err = unpopulate(val, "MonthlyBandwidthCost", &a.MonthlyBandwidthCost) - delete(rawMsg, key) - case "monthlyComputeCostForRecommendedSize": - err = unpopulate(val, "MonthlyComputeCostForRecommendedSize", &a.MonthlyComputeCostForRecommendedSize) - delete(rawMsg, key) - case "monthlyPremiumStorageCost": - err = unpopulate(val, "MonthlyPremiumStorageCost", &a.MonthlyPremiumStorageCost) - delete(rawMsg, key) - case "monthlyStandardSSDStorageCost": - err = unpopulate(val, "MonthlyStandardSSDStorageCost", &a.MonthlyStandardSSDStorageCost) - delete(rawMsg, key) - case "monthlyStorageCost": - err = unpopulate(val, "MonthlyStorageCost", &a.MonthlyStorageCost) - delete(rawMsg, key) - case "networkAdapters": - err = unpopulate(val, "NetworkAdapters", &a.NetworkAdapters) - delete(rawMsg, key) - case "numberOfCores": - err = unpopulate(val, "NumberOfCores", &a.NumberOfCores) - delete(rawMsg, key) - case "numberOfCoresForRecommendedSize": - err = unpopulate(val, "NumberOfCoresForRecommendedSize", &a.NumberOfCoresForRecommendedSize) + case "features": + err = unpopulate(val, "Features", &a.Features) delete(rawMsg, key) - case "operatingSystemName": - err = unpopulate(val, "OperatingSystemName", &a.OperatingSystemName) + case "otherDatabases": + err = unpopulate(val, "OtherDatabases", &a.OtherDatabases) delete(rawMsg, key) - case "operatingSystemType": - err = unpopulate(val, "OperatingSystemType", &a.OperatingSystemType) + case "sqlServers": + err = unpopulate(val, "SQLServers", &a.SQLServers) delete(rawMsg, key) - case "operatingSystemVersion": - err = unpopulate(val, "OperatingSystemVersion", &a.OperatingSystemVersion) + case "sharePointServers": + err = unpopulate(val, "SharePointServers", &a.SharePointServers) delete(rawMsg, key) - case "percentageCoresUtilization": - err = unpopulate(val, "PercentageCoresUtilization", &a.PercentageCoresUtilization) + case "systemCenters": + err = unpopulate(val, "SystemCenters", &a.SystemCenters) delete(rawMsg, key) - case "percentageMemoryUtilization": - err = unpopulate(val, "PercentageMemoryUtilization", &a.PercentageMemoryUtilization) - delete(rawMsg, key) - case "recommendedSize": - err = unpopulate(val, "RecommendedSize", &a.RecommendedSize) - delete(rawMsg, key) - case "suitability": - err = unpopulate(val, "Suitability", &a.Suitability) - delete(rawMsg, key) - case "suitabilityDetail": - err = unpopulate(val, "SuitabilityDetail", &a.SuitabilityDetail) - delete(rawMsg, key) - case "suitabilityExplanation": - err = unpopulate(val, "SuitabilityExplanation", &a.SuitabilityExplanation) - delete(rawMsg, key) - case "updatedTimestamp": - err = unpopulateDateTimeRFC3339(val, "UpdatedTimestamp", &a.UpdatedTimestamp) + case "webApplications": + err = unpopulate(val, "WebApplications", &a.WebApplications) delete(rawMsg, key) } if err != nil { @@ -276,549 +144,503 @@ func (a *AssessedMachineProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AssessedMachineResultList. -func (a AssessedMachineResultList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type BizTalkServer. +func (b BizTalkServer) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", a.NextLink) - populate(objectMap, "value", a.Value) + populate(objectMap, "productName", b.ProductName) + populate(objectMap, "status", b.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AssessedMachineResultList. -func (a *AssessedMachineResultList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type BizTalkServer. +func (b *BizTalkServer) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &a.NextLink) + case "productName": + err = unpopulate(val, "ProductName", &b.ProductName) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &a.Value) + case "status": + err = unpopulate(val, "Status", &b.Status) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AssessedNetworkAdapter. -func (a AssessedNetworkAdapter) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ConnectorUnit. +func (c ConnectorUnit) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "displayName", a.DisplayName) - populate(objectMap, "ipAddresses", a.IPAddresses) - populate(objectMap, "macAddress", a.MacAddress) - populate(objectMap, "megabytesPerSecondReceived", a.MegabytesPerSecondReceived) - populate(objectMap, "megabytesPerSecondTransmitted", a.MegabytesPerSecondTransmitted) - populate(objectMap, "monthlyBandwidthCosts", a.MonthlyBandwidthCosts) - populate(objectMap, "netGigabytesTransmittedPerMonth", a.NetGigabytesTransmittedPerMonth) - populate(objectMap, "suitability", a.Suitability) - populate(objectMap, "suitabilityDetail", a.SuitabilityDetail) - populate(objectMap, "suitabilityExplanation", a.SuitabilityExplanation) + populate(objectMap, "bindings", c.Bindings) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AssessedNetworkAdapter. -func (a *AssessedNetworkAdapter) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectorUnit. +func (c *ConnectorUnit) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "displayName": - err = unpopulate(val, "DisplayName", &a.DisplayName) - delete(rawMsg, key) - case "ipAddresses": - err = unpopulate(val, "IPAddresses", &a.IPAddresses) - delete(rawMsg, key) - case "macAddress": - err = unpopulate(val, "MacAddress", &a.MacAddress) - delete(rawMsg, key) - case "megabytesPerSecondReceived": - err = unpopulate(val, "MegabytesPerSecondReceived", &a.MegabytesPerSecondReceived) - delete(rawMsg, key) - case "megabytesPerSecondTransmitted": - err = unpopulate(val, "MegabytesPerSecondTransmitted", &a.MegabytesPerSecondTransmitted) - delete(rawMsg, key) - case "monthlyBandwidthCosts": - err = unpopulate(val, "MonthlyBandwidthCosts", &a.MonthlyBandwidthCosts) - delete(rawMsg, key) - case "netGigabytesTransmittedPerMonth": - err = unpopulate(val, "NetGigabytesTransmittedPerMonth", &a.NetGigabytesTransmittedPerMonth) - delete(rawMsg, key) - case "suitability": - err = unpopulate(val, "Suitability", &a.Suitability) - delete(rawMsg, key) - case "suitabilityDetail": - err = unpopulate(val, "SuitabilityDetail", &a.SuitabilityDetail) - delete(rawMsg, key) - case "suitabilityExplanation": - err = unpopulate(val, "SuitabilityExplanation", &a.SuitabilityExplanation) + case "bindings": + err = unpopulate(val, "Bindings", &c.Bindings) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Assessment. -func (a Assessment) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeleteImportMachinesJob. +func (d DeleteImportMachinesJob) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "eTag", a.ETag) - populate(objectMap, "id", a.ID) - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "type", a.Type) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "type", d.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Assessment. -func (a *Assessment) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeleteImportMachinesJob. +func (d *DeleteImportMachinesJob) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "eTag": - err = unpopulate(val, "ETag", &a.ETag) - delete(rawMsg, key) case "id": - err = unpopulate(val, "ID", &a.ID) + err = unpopulate(val, "ID", &d.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &a.Name) + err = unpopulate(val, "Name", &d.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &a.Properties) + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &a.Type) + err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AssessmentOptions. -func (a AssessmentOptions) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeleteImportMachinesJobCollection. +func (d DeleteImportMachinesJobCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", a.ID) - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentOptions. -func (a *AssessmentOptions) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeleteImportMachinesJobCollection. +func (d *DeleteImportMachinesJobCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) + case "value": + err = unpopulate(val, "Value", &d.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AssessmentOptionsProperties. -func (a AssessmentOptionsProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeleteImportedMachinesJobProperties. +func (d DeleteImportedMachinesJobProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "reservedInstanceSupportedCurrencies", a.ReservedInstanceSupportedCurrencies) - populate(objectMap, "reservedInstanceSupportedLocations", a.ReservedInstanceSupportedLocations) - populate(objectMap, "reservedInstanceSupportedOffers", a.ReservedInstanceSupportedOffers) - populate(objectMap, "reservedInstanceVmFamilies", a.ReservedInstanceVMFamilies) - populate(objectMap, "vmFamilies", a.VMFamilies) + populate(objectMap, "blobName", d.BlobName) + populate(objectMap, "deletionConfirmation", d.DeletionConfirmation) + populate(objectMap, "displayName", d.DisplayName) + populate(objectMap, "endTime", d.EndTime) + populate(objectMap, "errorSasUri", d.ErrorSasURI) + populate(objectMap, "errors", d.Errors) + populate(objectMap, "jobState", d.JobState) + populate(objectMap, "numberOfMachinesDeleted", d.NumberOfMachinesDeleted) + populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "startTime", d.StartTime) + populate(objectMap, "status", d.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentOptionsProperties. -func (a *AssessmentOptionsProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeleteImportedMachinesJobProperties. +func (d *DeleteImportedMachinesJobProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "reservedInstanceSupportedCurrencies": - err = unpopulate(val, "ReservedInstanceSupportedCurrencies", &a.ReservedInstanceSupportedCurrencies) + case "blobName": + err = unpopulate(val, "BlobName", &d.BlobName) + delete(rawMsg, key) + case "deletionConfirmation": + err = unpopulate(val, "DeletionConfirmation", &d.DeletionConfirmation) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &d.DisplayName) delete(rawMsg, key) - case "reservedInstanceSupportedLocations": - err = unpopulate(val, "ReservedInstanceSupportedLocations", &a.ReservedInstanceSupportedLocations) + case "endTime": + err = unpopulate(val, "EndTime", &d.EndTime) delete(rawMsg, key) - case "reservedInstanceSupportedOffers": - err = unpopulate(val, "ReservedInstanceSupportedOffers", &a.ReservedInstanceSupportedOffers) + case "errorSasUri": + err = unpopulate(val, "ErrorSasURI", &d.ErrorSasURI) delete(rawMsg, key) - case "reservedInstanceVmFamilies": - err = unpopulate(val, "ReservedInstanceVMFamilies", &a.ReservedInstanceVMFamilies) + case "errors": + err = unpopulate(val, "Errors", &d.Errors) delete(rawMsg, key) - case "vmFamilies": - err = unpopulate(val, "VMFamilies", &a.VMFamilies) + case "jobState": + err = unpopulate(val, "JobState", &d.JobState) + delete(rawMsg, key) + case "numberOfMachinesDeleted": + err = unpopulate(val, "NumberOfMachinesDeleted", &d.NumberOfMachinesDeleted) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + delete(rawMsg, key) + case "startTime": + err = unpopulate(val, "StartTime", &d.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &d.Status) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AssessmentOptionsResultList. -func (a AssessmentOptionsResultList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DependencyMapDiscovery. +func (d DependencyMapDiscovery) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", a.Value) + populate(objectMap, "discoveryScopeStatus", d.DiscoveryScopeStatus) + populate(objectMap, "errors", d.Errors) + populate(objectMap, "hydratedRunAsAccountId", d.HydratedRunAsAccountID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentOptionsResultList. -func (a *AssessmentOptionsResultList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DependencyMapDiscovery. +func (d *DependencyMapDiscovery) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "value": - err = unpopulate(val, "Value", &a.Value) + case "discoveryScopeStatus": + err = unpopulate(val, "DiscoveryScopeStatus", &d.DiscoveryScopeStatus) + delete(rawMsg, key) + case "errors": + err = unpopulate(val, "Errors", &d.Errors) + delete(rawMsg, key) + case "hydratedRunAsAccountId": + err = unpopulate(val, "HydratedRunAsAccountID", &d.HydratedRunAsAccountID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AssessmentProperties. -func (a AssessmentProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DependencyMapMachineInput. +func (d DependencyMapMachineInput) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "azureDiskType", a.AzureDiskType) - populate(objectMap, "azureHybridUseBenefit", a.AzureHybridUseBenefit) - populate(objectMap, "azureLocation", a.AzureLocation) - populate(objectMap, "azureOfferCode", a.AzureOfferCode) - populate(objectMap, "azurePricingTier", a.AzurePricingTier) - populate(objectMap, "azureStorageRedundancy", a.AzureStorageRedundancy) - populate(objectMap, "azureVmFamilies", a.AzureVMFamilies) - populate(objectMap, "confidenceRatingInPercentage", a.ConfidenceRatingInPercentage) - populateDateTimeRFC3339(objectMap, "createdTimestamp", a.CreatedTimestamp) - populate(objectMap, "currency", a.Currency) - populate(objectMap, "discountPercentage", a.DiscountPercentage) - populate(objectMap, "eaSubscriptionId", a.EaSubscriptionID) - populate(objectMap, "monthlyBandwidthCost", a.MonthlyBandwidthCost) - populate(objectMap, "monthlyComputeCost", a.MonthlyComputeCost) - populate(objectMap, "monthlyPremiumStorageCost", a.MonthlyPremiumStorageCost) - populate(objectMap, "monthlyStandardSSDStorageCost", a.MonthlyStandardSSDStorageCost) - populate(objectMap, "monthlyStorageCost", a.MonthlyStorageCost) - populate(objectMap, "numberOfMachines", a.NumberOfMachines) - populate(objectMap, "percentile", a.Percentile) - populateDateTimeRFC3339(objectMap, "perfDataEndTime", a.PerfDataEndTime) - populateDateTimeRFC3339(objectMap, "perfDataStartTime", a.PerfDataStartTime) - populateDateTimeRFC3339(objectMap, "pricesTimestamp", a.PricesTimestamp) - populate(objectMap, "reservedInstance", a.ReservedInstance) - populate(objectMap, "scalingFactor", a.ScalingFactor) - populate(objectMap, "sizingCriterion", a.SizingCriterion) - populate(objectMap, "stage", a.Stage) - populate(objectMap, "status", a.Status) - populate(objectMap, "timeRange", a.TimeRange) - populateDateTimeRFC3339(objectMap, "updatedTimestamp", a.UpdatedTimestamp) - populate(objectMap, "vmUptime", a.VMUptime) + populate(objectMap, "isDependencyMapToBeEnabled", d.IsDependencyMapToBeEnabled) + populate(objectMap, "machineId", d.MachineID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentProperties. -func (a *AssessmentProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DependencyMapMachineInput. +func (d *DependencyMapMachineInput) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "azureDiskType": - err = unpopulate(val, "AzureDiskType", &a.AzureDiskType) - delete(rawMsg, key) - case "azureHybridUseBenefit": - err = unpopulate(val, "AzureHybridUseBenefit", &a.AzureHybridUseBenefit) - delete(rawMsg, key) - case "azureLocation": - err = unpopulate(val, "AzureLocation", &a.AzureLocation) - delete(rawMsg, key) - case "azureOfferCode": - err = unpopulate(val, "AzureOfferCode", &a.AzureOfferCode) - delete(rawMsg, key) - case "azurePricingTier": - err = unpopulate(val, "AzurePricingTier", &a.AzurePricingTier) - delete(rawMsg, key) - case "azureStorageRedundancy": - err = unpopulate(val, "AzureStorageRedundancy", &a.AzureStorageRedundancy) - delete(rawMsg, key) - case "azureVmFamilies": - err = unpopulate(val, "AzureVMFamilies", &a.AzureVMFamilies) - delete(rawMsg, key) - case "confidenceRatingInPercentage": - err = unpopulate(val, "ConfidenceRatingInPercentage", &a.ConfidenceRatingInPercentage) + case "isDependencyMapToBeEnabled": + err = unpopulate(val, "IsDependencyMapToBeEnabled", &d.IsDependencyMapToBeEnabled) delete(rawMsg, key) - case "createdTimestamp": - err = unpopulateDateTimeRFC3339(val, "CreatedTimestamp", &a.CreatedTimestamp) - delete(rawMsg, key) - case "currency": - err = unpopulate(val, "Currency", &a.Currency) - delete(rawMsg, key) - case "discountPercentage": - err = unpopulate(val, "DiscountPercentage", &a.DiscountPercentage) - delete(rawMsg, key) - case "eaSubscriptionId": - err = unpopulate(val, "EaSubscriptionID", &a.EaSubscriptionID) - delete(rawMsg, key) - case "monthlyBandwidthCost": - err = unpopulate(val, "MonthlyBandwidthCost", &a.MonthlyBandwidthCost) - delete(rawMsg, key) - case "monthlyComputeCost": - err = unpopulate(val, "MonthlyComputeCost", &a.MonthlyComputeCost) - delete(rawMsg, key) - case "monthlyPremiumStorageCost": - err = unpopulate(val, "MonthlyPremiumStorageCost", &a.MonthlyPremiumStorageCost) - delete(rawMsg, key) - case "monthlyStandardSSDStorageCost": - err = unpopulate(val, "MonthlyStandardSSDStorageCost", &a.MonthlyStandardSSDStorageCost) + case "machineId": + err = unpopulate(val, "MachineID", &d.MachineID) delete(rawMsg, key) - case "monthlyStorageCost": - err = unpopulate(val, "MonthlyStorageCost", &a.MonthlyStorageCost) - delete(rawMsg, key) - case "numberOfMachines": - err = unpopulate(val, "NumberOfMachines", &a.NumberOfMachines) - delete(rawMsg, key) - case "percentile": - err = unpopulate(val, "Percentile", &a.Percentile) - delete(rawMsg, key) - case "perfDataEndTime": - err = unpopulateDateTimeRFC3339(val, "PerfDataEndTime", &a.PerfDataEndTime) - delete(rawMsg, key) - case "perfDataStartTime": - err = unpopulateDateTimeRFC3339(val, "PerfDataStartTime", &a.PerfDataStartTime) - delete(rawMsg, key) - case "pricesTimestamp": - err = unpopulateDateTimeRFC3339(val, "PricesTimestamp", &a.PricesTimestamp) - delete(rawMsg, key) - case "reservedInstance": - err = unpopulate(val, "ReservedInstance", &a.ReservedInstance) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DependencyMapServiceMapextensionsClientGroupMembersRequest. +func (d DependencyMapServiceMapextensionsClientGroupMembersRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "endTime", d.EndTime) + populate(objectMap, "filters", d.Filters) + populate(objectMap, "machineId", d.MachineID) + populate(objectMap, "processGroupName", d.ProcessGroupName) + populate(objectMap, "processName", d.ProcessName) + populateDateTimeRFC3339(objectMap, "startTime", d.StartTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DependencyMapServiceMapextensionsClientGroupMembersRequest. +func (d *DependencyMapServiceMapextensionsClientGroupMembersRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endTime": + err = unpopulateDateTimeRFC3339(val, "EndTime", &d.EndTime) delete(rawMsg, key) - case "scalingFactor": - err = unpopulate(val, "ScalingFactor", &a.ScalingFactor) + case "filters": + err = unpopulate(val, "Filters", &d.Filters) delete(rawMsg, key) - case "sizingCriterion": - err = unpopulate(val, "SizingCriterion", &a.SizingCriterion) + case "machineId": + err = unpopulate(val, "MachineID", &d.MachineID) delete(rawMsg, key) - case "stage": - err = unpopulate(val, "Stage", &a.Stage) + case "processGroupName": + err = unpopulate(val, "ProcessGroupName", &d.ProcessGroupName) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &a.Status) + case "processName": + err = unpopulate(val, "ProcessName", &d.ProcessName) delete(rawMsg, key) - case "timeRange": - err = unpopulate(val, "TimeRange", &a.TimeRange) + case "startTime": + err = unpopulateDateTimeRFC3339(val, "StartTime", &d.StartTime) delete(rawMsg, key) - case "updatedTimestamp": - err = unpopulateDateTimeRFC3339(val, "UpdatedTimestamp", &a.UpdatedTimestamp) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DependencyMapServiceMapextensionsDependencyMapRequestFilters. +func (d DependencyMapServiceMapextensionsDependencyMapRequestFilters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "machineIds", d.MachineIDs) + populate(objectMap, "processIds", d.ProcessIDs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DependencyMapServiceMapextensionsDependencyMapRequestFilters. +func (d *DependencyMapServiceMapextensionsDependencyMapRequestFilters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "machineIds": + err = unpopulate(val, "MachineIDs", &d.MachineIDs) delete(rawMsg, key) - case "vmUptime": - err = unpopulate(val, "VMUptime", &a.VMUptime) + case "processIds": + err = unpopulate(val, "ProcessIDs", &d.ProcessIDs) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AssessmentResultList. -func (a AssessmentResultList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DependencyMapServiceMapextensionsExportDependenciesRequest. +func (d DependencyMapServiceMapextensionsExportDependenciesRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", a.Value) + populateDateTimeRFC3339(objectMap, "endTime", d.EndTime) + populateDateTimeRFC3339(objectMap, "startTime", d.StartTime) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentResultList. -func (a *AssessmentResultList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DependencyMapServiceMapextensionsExportDependenciesRequest. +func (d *DependencyMapServiceMapextensionsExportDependenciesRequest) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "value": - err = unpopulate(val, "Value", &a.Value) + case "endTime": + err = unpopulateDateTimeRFC3339(val, "EndTime", &d.EndTime) + delete(rawMsg, key) + case "startTime": + err = unpopulateDateTimeRFC3339(val, "StartTime", &d.StartTime) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CollectorAgentProperties. -func (c CollectorAgentProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DependencyMapServiceMapextensionsScopeMapRequest. +func (d DependencyMapServiceMapextensionsScopeMapRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", c.ID) - populateDateTimeRFC3339(objectMap, "lastHeartbeatUtc", c.LastHeartbeatUTC) - populate(objectMap, "spnDetails", c.SpnDetails) - populate(objectMap, "version", c.Version) + populateDateTimeRFC3339(objectMap, "endTime", d.EndTime) + populate(objectMap, "filters", d.Filters) + populateDateTimeRFC3339(objectMap, "startTime", d.StartTime) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CollectorAgentProperties. -func (c *CollectorAgentProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DependencyMapServiceMapextensionsScopeMapRequest. +func (d *DependencyMapServiceMapextensionsScopeMapRequest) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &c.ID) - delete(rawMsg, key) - case "lastHeartbeatUtc": - err = unpopulateDateTimeRFC3339(val, "LastHeartbeatUTC", &c.LastHeartbeatUTC) + case "endTime": + err = unpopulateDateTimeRFC3339(val, "EndTime", &d.EndTime) delete(rawMsg, key) - case "spnDetails": - err = unpopulate(val, "SpnDetails", &c.SpnDetails) + case "filters": + err = unpopulate(val, "Filters", &d.Filters) delete(rawMsg, key) - case "version": - err = unpopulate(val, "Version", &c.Version) + case "startTime": + err = unpopulateDateTimeRFC3339(val, "StartTime", &d.StartTime) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CollectorBodyAgentSpnProperties. -func (c CollectorBodyAgentSpnProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DependencyMapServiceMapextensionsServerGroupMembersRequest. +func (d DependencyMapServiceMapextensionsServerGroupMembersRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "applicationId", c.ApplicationID) - populate(objectMap, "audience", c.Audience) - populate(objectMap, "authority", c.Authority) - populate(objectMap, "objectId", c.ObjectID) - populate(objectMap, "tenantId", c.TenantID) + populateDateTimeRFC3339(objectMap, "endTime", d.EndTime) + populate(objectMap, "filters", d.Filters) + populate(objectMap, "serverPort", d.ServerPort) + populateDateTimeRFC3339(objectMap, "startTime", d.StartTime) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CollectorBodyAgentSpnProperties. -func (c *CollectorBodyAgentSpnProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DependencyMapServiceMapextensionsServerGroupMembersRequest. +func (d *DependencyMapServiceMapextensionsServerGroupMembersRequest) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "applicationId": - err = unpopulate(val, "ApplicationID", &c.ApplicationID) + case "endTime": + err = unpopulateDateTimeRFC3339(val, "EndTime", &d.EndTime) delete(rawMsg, key) - case "audience": - err = unpopulate(val, "Audience", &c.Audience) - delete(rawMsg, key) - case "authority": - err = unpopulate(val, "Authority", &c.Authority) + case "filters": + err = unpopulate(val, "Filters", &d.Filters) delete(rawMsg, key) - case "objectId": - err = unpopulate(val, "ObjectID", &c.ObjectID) + case "serverPort": + err = unpopulate(val, "ServerPort", &d.ServerPort) delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &c.TenantID) + case "startTime": + err = unpopulateDateTimeRFC3339(val, "StartTime", &d.StartTime) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CollectorProperties. -func (c CollectorProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DependencyMapServiceMapextensionsSingleMachineDetailedMapRequest. +func (d DependencyMapServiceMapextensionsSingleMachineDetailedMapRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "agentProperties", c.AgentProperties) - populate(objectMap, "createdTimestamp", c.CreatedTimestamp) - populate(objectMap, "discoverySiteId", c.DiscoverySiteID) - populate(objectMap, "updatedTimestamp", c.UpdatedTimestamp) + populateDateTimeRFC3339(objectMap, "endTime", d.EndTime) + populate(objectMap, "filters", d.Filters) + populate(objectMap, "machineId", d.MachineID) + populateDateTimeRFC3339(objectMap, "startTime", d.StartTime) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CollectorProperties. -func (c *CollectorProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DependencyMapServiceMapextensionsSingleMachineDetailedMapRequest. +func (d *DependencyMapServiceMapextensionsSingleMachineDetailedMapRequest) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "agentProperties": - err = unpopulate(val, "AgentProperties", &c.AgentProperties) + case "endTime": + err = unpopulateDateTimeRFC3339(val, "EndTime", &d.EndTime) delete(rawMsg, key) - case "createdTimestamp": - err = unpopulate(val, "CreatedTimestamp", &c.CreatedTimestamp) + case "filters": + err = unpopulate(val, "Filters", &d.Filters) delete(rawMsg, key) - case "discoverySiteId": - err = unpopulate(val, "DiscoverySiteID", &c.DiscoverySiteID) + case "machineId": + err = unpopulate(val, "MachineID", &d.MachineID) delete(rawMsg, key) - case "updatedTimestamp": - err = unpopulate(val, "UpdatedTimestamp", &c.UpdatedTimestamp) + case "startTime": + err = unpopulateDateTimeRFC3339(val, "StartTime", &d.StartTime) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Disk. -func (d Disk) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DirectoryPath. +func (d DirectoryPath) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "displayName", d.DisplayName) - populate(objectMap, "gigabytesAllocated", d.GigabytesAllocated) + populate(objectMap, "physical", d.Physical) + populate(objectMap, "virtual", d.Virtual) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Disk. -func (d *Disk) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DirectoryPath. +func (d *DirectoryPath) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -826,11 +648,11 @@ func (d *Disk) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "displayName": - err = unpopulate(val, "DisplayName", &d.DisplayName) + case "physical": + err = unpopulate(val, "Physical", &d.Physical) delete(rawMsg, key) - case "gigabytesAllocated": - err = unpopulate(val, "GigabytesAllocated", &d.GigabytesAllocated) + case "virtual": + err = unpopulate(val, "Virtual", &d.Virtual) delete(rawMsg, key) } if err != nil { @@ -840,16 +662,17 @@ func (d *Disk) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DownloadURL. -func (d DownloadURL) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DiscoveryScopeErrorSummary. +func (d DiscoveryScopeErrorSummary) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "assessmentReportUrl", d.AssessmentReportURL) - populateDateTimeRFC3339(objectMap, "expirationTime", d.ExpirationTime) + populate(objectMap, "affectedObjectsCount", d.AffectedObjectsCount) + populate(objectMap, "affectedResourceType", d.AffectedResourceType) + populate(objectMap, "discoveryScope", d.DiscoveryScope) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DownloadURL. -func (d *DownloadURL) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DiscoveryScopeErrorSummary. +func (d *DiscoveryScopeErrorSummary) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -857,11 +680,14 @@ func (d *DownloadURL) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "assessmentReportUrl": - err = unpopulate(val, "AssessmentReportURL", &d.AssessmentReportURL) + case "affectedObjectsCount": + err = unpopulate(val, "AffectedObjectsCount", &d.AffectedObjectsCount) delete(rawMsg, key) - case "expirationTime": - err = unpopulateDateTimeRFC3339(val, "ExpirationTime", &d.ExpirationTime) + case "affectedResourceType": + err = unpopulate(val, "AffectedResourceType", &d.AffectedResourceType) + delete(rawMsg, key) + case "discoveryScope": + err = unpopulate(val, "DiscoveryScope", &d.DiscoveryScope) delete(rawMsg, key) } if err != nil { @@ -871,1303 +697,10662 @@ func (d *DownloadURL) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Group. -func (g Group) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DiscoverySiteDataSource. +func (d DiscoverySiteDataSource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "eTag", g.ETag) - populate(objectMap, "id", g.ID) - populate(objectMap, "name", g.Name) - populate(objectMap, "properties", g.Properties) - populate(objectMap, "type", g.Type) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "type", d.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Group. -func (g *Group) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DiscoverySiteDataSource. +func (d *DiscoverySiteDataSource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "eTag": - err = unpopulate(val, "ETag", &g.ETag) - delete(rawMsg, key) case "id": - err = unpopulate(val, "ID", &g.ID) + err = unpopulate(val, "ID", &d.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &g.Name) + err = unpopulate(val, "Name", &d.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &g.Properties) + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &g.Type) + err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GroupBodyProperties. -func (g GroupBodyProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DiscoverySiteDataSourceListResult. +func (d DiscoverySiteDataSourceListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "machines", g.Machines) - populate(objectMap, "operationType", g.OperationType) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GroupBodyProperties. -func (g *GroupBodyProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DiscoverySiteDataSourceListResult. +func (d *DiscoverySiteDataSourceListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "machines": - err = unpopulate(val, "Machines", &g.Machines) + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) delete(rawMsg, key) - case "operationType": - err = unpopulate(val, "OperationType", &g.OperationType) + case "value": + err = unpopulate(val, "Value", &d.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GroupProperties. -func (g GroupProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DiscoverySiteDataSourceProperties. +func (d DiscoverySiteDataSourceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "areAssessmentsRunning", g.AreAssessmentsRunning) - populate(objectMap, "assessments", g.Assessments) - populateDateTimeRFC3339(objectMap, "createdTimestamp", g.CreatedTimestamp) - populate(objectMap, "groupStatus", g.GroupStatus) - populate(objectMap, "groupType", g.GroupType) - populate(objectMap, "machineCount", g.MachineCount) - populateDateTimeRFC3339(objectMap, "updatedTimestamp", g.UpdatedTimestamp) + populate(objectMap, "discoverySiteId", d.DiscoverySiteID) + populate(objectMap, "provisioningState", d.ProvisioningState) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GroupProperties. -func (g *GroupProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DiscoverySiteDataSourceProperties. +func (d *DiscoverySiteDataSourceProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "areAssessmentsRunning": - err = unpopulate(val, "AreAssessmentsRunning", &g.AreAssessmentsRunning) - delete(rawMsg, key) - case "assessments": - err = unpopulate(val, "Assessments", &g.Assessments) - delete(rawMsg, key) - case "createdTimestamp": - err = unpopulateDateTimeRFC3339(val, "CreatedTimestamp", &g.CreatedTimestamp) - delete(rawMsg, key) - case "groupStatus": - err = unpopulate(val, "GroupStatus", &g.GroupStatus) - delete(rawMsg, key) - case "groupType": - err = unpopulate(val, "GroupType", &g.GroupType) - delete(rawMsg, key) - case "machineCount": - err = unpopulate(val, "MachineCount", &g.MachineCount) + case "discoverySiteId": + err = unpopulate(val, "DiscoverySiteID", &d.DiscoverySiteID) delete(rawMsg, key) - case "updatedTimestamp": - err = unpopulateDateTimeRFC3339(val, "UpdatedTimestamp", &g.UpdatedTimestamp) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GroupResultList. -func (g GroupResultList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", g.Value) + populateAny(objectMap, "info", e.Info) + populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GroupResultList. -func (g *GroupResultList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. +func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "value": - err = unpopulate(val, "Value", &g.Value) + case "info": + err = unpopulate(val, "Info", &e.Info) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type HyperVCollector. -func (h HyperVCollector) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "eTag", h.ETag) - populate(objectMap, "id", h.ID) - populate(objectMap, "name", h.Name) - populate(objectMap, "properties", h.Properties) - populate(objectMap, "type", h.Type) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type HyperVCollector. -func (h *HyperVCollector) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. +func (e *ErrorDetail) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "eTag": - err = unpopulate(val, "ETag", &h.ETag) + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &h.ID) + case "code": + err = unpopulate(val, "Code", &e.Code) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &h.Name) + case "details": + err = unpopulate(val, "Details", &e.Details) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &h.Properties) + case "message": + err = unpopulate(val, "Message", &e.Message) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &h.Type) + case "target": + err = unpopulate(val, "Target", &e.Target) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type HyperVCollectorList. -func (h HyperVCollectorList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorDetails. +func (e ErrorDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", h.Value) + populate(objectMap, "agentErrorCode", e.AgentErrorCode) + populate(objectMap, "agentErrorMessage", e.AgentErrorMessage) + populate(objectMap, "agentErrorPossibleCauses", e.AgentErrorPossibleCauses) + populate(objectMap, "agentErrorRecommendedAction", e.AgentErrorRecommendedAction) + populate(objectMap, "code", e.Code) + populate(objectMap, "isAgentReportedError", e.IsAgentReportedError) + populate(objectMap, "message", e.Message) + populate(objectMap, "possibleCauses", e.PossibleCauses) + populate(objectMap, "recommendedAction", e.RecommendedAction) + populate(objectMap, "severity", e.Severity) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type HyperVCollectorList. -func (h *HyperVCollectorList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetails. +func (e *ErrorDetails) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "value": - err = unpopulate(val, "Value", &h.Value) + case "agentErrorCode": + err = unpopulate(val, "AgentErrorCode", &e.AgentErrorCode) + delete(rawMsg, key) + case "agentErrorMessage": + err = unpopulate(val, "AgentErrorMessage", &e.AgentErrorMessage) + delete(rawMsg, key) + case "agentErrorPossibleCauses": + err = unpopulate(val, "AgentErrorPossibleCauses", &e.AgentErrorPossibleCauses) + delete(rawMsg, key) + case "agentErrorRecommendedAction": + err = unpopulate(val, "AgentErrorRecommendedAction", &e.AgentErrorRecommendedAction) + delete(rawMsg, key) + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "isAgentReportedError": + err = unpopulate(val, "IsAgentReportedError", &e.IsAgentReportedError) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "possibleCauses": + err = unpopulate(val, "PossibleCauses", &e.PossibleCauses) + delete(rawMsg, key) + case "recommendedAction": + err = unpopulate(val, "RecommendedAction", &e.RecommendedAction) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &e.Severity) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ImportCollector. -func (i ImportCollector) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. +func (e ErrorResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "eTag", i.ETag) - populate(objectMap, "id", i.ID) - populate(objectMap, "name", i.Name) - populate(objectMap, "properties", i.Properties) - populate(objectMap, "type", i.Type) + populate(objectMap, "error", e.Error) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ImportCollector. -func (i *ImportCollector) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. +func (e *ErrorResponse) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "eTag": - err = unpopulate(val, "ETag", &i.ETag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &i.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &i.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &i.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &i.Type) + case "error": + err = unpopulate(val, "Error", &e.Error) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ImportCollectorList. -func (i ImportCollectorList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorSummaryRequest. +func (e ErrorSummaryRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", i.Value) + populate(objectMap, "applianceName", e.ApplianceName) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ImportCollectorList. -func (i *ImportCollectorList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorSummaryRequest. +func (e *ErrorSummaryRequest) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "value": - err = unpopulate(val, "Value", &i.Value) + case "applianceName": + err = unpopulate(val, "ApplianceName", &e.ApplianceName) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ImportCollectorProperties. -func (i ImportCollectorProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Errors. +func (e Errors) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "createdTimestamp", i.CreatedTimestamp) - populate(objectMap, "discoverySiteId", i.DiscoverySiteID) - populate(objectMap, "updatedTimestamp", i.UpdatedTimestamp) + populate(objectMap, "applianceName", e.ApplianceName) + populate(objectMap, "code", e.Code) + populate(objectMap, "discoveryScope", e.DiscoveryScope) + populate(objectMap, "id", e.ID) + populate(objectMap, "message", e.Message) + populate(objectMap, "messageParameters", e.MessageParameters) + populate(objectMap, "possibleCauses", e.PossibleCauses) + populate(objectMap, "recommendedAction", e.RecommendedAction) + populate(objectMap, "runAsAccountId", e.RunAsAccountID) + populate(objectMap, "severity", e.Severity) + populate(objectMap, "source", e.Source) + populate(objectMap, "summaryMessage", e.SummaryMessage) + populateDateTimeRFC3339(objectMap, "updatedTimeStamp", e.UpdatedTimeStamp) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ImportCollectorProperties. -func (i *ImportCollectorProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Errors. +func (e *Errors) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "createdTimestamp": - err = unpopulate(val, "CreatedTimestamp", &i.CreatedTimestamp) + case "applianceName": + err = unpopulate(val, "ApplianceName", &e.ApplianceName) delete(rawMsg, key) - case "discoverySiteId": - err = unpopulate(val, "DiscoverySiteID", &i.DiscoverySiteID) + case "code": + err = unpopulate(val, "Code", &e.Code) delete(rawMsg, key) - case "updatedTimestamp": - err = unpopulate(val, "UpdatedTimestamp", &i.UpdatedTimestamp) + case "discoveryScope": + err = unpopulate(val, "DiscoveryScope", &e.DiscoveryScope) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "messageParameters": + err = unpopulate(val, "MessageParameters", &e.MessageParameters) + delete(rawMsg, key) + case "possibleCauses": + err = unpopulate(val, "PossibleCauses", &e.PossibleCauses) + delete(rawMsg, key) + case "recommendedAction": + err = unpopulate(val, "RecommendedAction", &e.RecommendedAction) + delete(rawMsg, key) + case "runAsAccountId": + err = unpopulate(val, "RunAsAccountID", &e.RunAsAccountID) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &e.Severity) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &e.Source) + delete(rawMsg, key) + case "summaryMessage": + err = unpopulate(val, "SummaryMessage", &e.SummaryMessage) + delete(rawMsg, key) + case "updatedTimeStamp": + err = unpopulateDateTimeRFC3339(val, "UpdatedTimeStamp", &e.UpdatedTimeStamp) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Machine. -func (m Machine) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExchangeServer. +func (e ExchangeServer) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "eTag", m.ETag) - populate(objectMap, "id", m.ID) - populate(objectMap, "name", m.Name) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "type", m.Type) + populate(objectMap, "edition", e.Edition) + populate(objectMap, "productName", e.ProductName) + populate(objectMap, "roles", e.Roles) + populate(objectMap, "servicePack", e.ServicePack) + populate(objectMap, "version", e.Version) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Machine. -func (m *Machine) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExchangeServer. +func (e *ExchangeServer) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "eTag": - err = unpopulate(val, "ETag", &m.ETag) + case "edition": + err = unpopulate(val, "Edition", &e.Edition) delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &m.ID) + case "productName": + err = unpopulate(val, "ProductName", &e.ProductName) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &m.Name) + case "roles": + err = unpopulate(val, "Roles", &e.Roles) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &m.Properties) + case "servicePack": + err = unpopulate(val, "ServicePack", &e.ServicePack) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &m.Type) + case "version": + err = unpopulate(val, "Version", &e.Version) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type MachineProperties. -func (m MachineProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExportImportedMachinesJob. +func (e ExportImportedMachinesJob) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "bootType", m.BootType) - populateDateTimeRFC3339(objectMap, "createdTimestamp", m.CreatedTimestamp) - populate(objectMap, "datacenterManagementServerArmId", m.DatacenterManagementServerArmID) - populate(objectMap, "datacenterManagementServerName", m.DatacenterManagementServerName) - populate(objectMap, "description", m.Description) - populate(objectMap, "discoveryMachineArmId", m.DiscoveryMachineArmID) - populate(objectMap, "disks", m.Disks) - populate(objectMap, "displayName", m.DisplayName) - populate(objectMap, "groups", m.Groups) - populate(objectMap, "megabytesOfMemory", m.MegabytesOfMemory) - populate(objectMap, "networkAdapters", m.NetworkAdapters) - populate(objectMap, "numberOfCores", m.NumberOfCores) - populate(objectMap, "operatingSystemName", m.OperatingSystemName) - populate(objectMap, "operatingSystemType", m.OperatingSystemType) - populate(objectMap, "operatingSystemVersion", m.OperatingSystemVersion) - populateDateTimeRFC3339(objectMap, "updatedTimestamp", m.UpdatedTimestamp) + populate(objectMap, "displayName", e.DisplayName) + populate(objectMap, "endTime", e.EndTime) + populate(objectMap, "id", e.ID) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "startTime", e.StartTime) + populate(objectMap, "status", e.Status) + populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type MachineProperties. -func (m *MachineProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExportImportedMachinesJob. +func (e *ExportImportedMachinesJob) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "bootType": - err = unpopulate(val, "BootType", &m.BootType) - delete(rawMsg, key) - case "createdTimestamp": - err = unpopulateDateTimeRFC3339(val, "CreatedTimestamp", &m.CreatedTimestamp) - delete(rawMsg, key) - case "datacenterManagementServerArmId": - err = unpopulate(val, "DatacenterManagementServerArmID", &m.DatacenterManagementServerArmID) - delete(rawMsg, key) - case "datacenterManagementServerName": - err = unpopulate(val, "DatacenterManagementServerName", &m.DatacenterManagementServerName) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &m.Description) - delete(rawMsg, key) - case "discoveryMachineArmId": - err = unpopulate(val, "DiscoveryMachineArmID", &m.DiscoveryMachineArmID) - delete(rawMsg, key) - case "disks": - err = unpopulate(val, "Disks", &m.Disks) - delete(rawMsg, key) case "displayName": - err = unpopulate(val, "DisplayName", &m.DisplayName) + err = unpopulate(val, "DisplayName", &e.DisplayName) delete(rawMsg, key) - case "groups": - err = unpopulate(val, "Groups", &m.Groups) + case "endTime": + err = unpopulate(val, "EndTime", &e.EndTime) delete(rawMsg, key) - case "megabytesOfMemory": - err = unpopulate(val, "MegabytesOfMemory", &m.MegabytesOfMemory) - delete(rawMsg, key) - case "networkAdapters": - err = unpopulate(val, "NetworkAdapters", &m.NetworkAdapters) + case "id": + err = unpopulate(val, "ID", &e.ID) delete(rawMsg, key) - case "numberOfCores": - err = unpopulate(val, "NumberOfCores", &m.NumberOfCores) + case "name": + err = unpopulate(val, "Name", &e.Name) delete(rawMsg, key) - case "operatingSystemName": - err = unpopulate(val, "OperatingSystemName", &m.OperatingSystemName) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) delete(rawMsg, key) - case "operatingSystemType": - err = unpopulate(val, "OperatingSystemType", &m.OperatingSystemType) + case "startTime": + err = unpopulate(val, "StartTime", &e.StartTime) delete(rawMsg, key) - case "operatingSystemVersion": - err = unpopulate(val, "OperatingSystemVersion", &m.OperatingSystemVersion) + case "status": + err = unpopulate(val, "Status", &e.Status) delete(rawMsg, key) - case "updatedTimestamp": - err = unpopulateDateTimeRFC3339(val, "UpdatedTimestamp", &m.UpdatedTimestamp) + case "type": + err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type MachineResultList. -func (m MachineResultList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExportImportedMachinesJobEntityProperties. +func (e ExportImportedMachinesJobEntityProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", m.NextLink) - populate(objectMap, "value", m.Value) + populate(objectMap, "blobName", e.BlobName) + populate(objectMap, "sasUri", e.SasURI) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type MachineResultList. -func (m *MachineResultList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExportImportedMachinesJobEntityProperties. +func (e *ExportImportedMachinesJobEntityProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &m.NextLink) + case "blobName": + err = unpopulate(val, "BlobName", &e.BlobName) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &m.Value) + case "sasUri": + err = unpopulate(val, "SasURI", &e.SasURI) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type NetworkAdapter. -func (n NetworkAdapter) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExportMachineErrorsRequest. +func (e ExportMachineErrorsRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "displayName", n.DisplayName) - populate(objectMap, "ipAddresses", n.IPAddresses) - populate(objectMap, "macAddress", n.MacAddress) + populate(objectMap, "properties", e.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkAdapter. -func (n *NetworkAdapter) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExportMachineErrorsRequest. +func (e *ExportMachineErrorsRequest) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "displayName": - err = unpopulate(val, "DisplayName", &n.DisplayName) - delete(rawMsg, key) - case "ipAddresses": - err = unpopulate(val, "IPAddresses", &n.IPAddresses) - delete(rawMsg, key) - case "macAddress": - err = unpopulate(val, "MacAddress", &n.MacAddress) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Operation. -func (o Operation) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExportMachinesRequest. +func (e ExportMachinesRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "display", o.Display) - populate(objectMap, "name", o.Name) - populate(objectMap, "origin", o.Origin) + populate(objectMap, "filter", e.Filter) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. -func (o *Operation) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExportMachinesRequest. +func (e *ExportMachinesRequest) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "display": - err = unpopulate(val, "Display", &o.Display) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) - delete(rawMsg, key) - case "origin": - err = unpopulate(val, "Origin", &o.Origin) + case "filter": + err = unpopulate(val, "Filter", &e.Filter) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. -func (o OperationDisplay) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExportSQLServersRequest. +func (e ExportSQLServersRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "description", o.Description) - populate(objectMap, "operation", o.Operation) - populate(objectMap, "provider", o.Provider) - populate(objectMap, "resource", o.Resource) + populate(objectMap, "applianceName", e.ApplianceName) + populate(objectMap, "filter", e.Filter) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. -func (o *OperationDisplay) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExportSQLServersRequest. +func (e *ExportSQLServersRequest) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "description": - err = unpopulate(val, "Description", &o.Description) - delete(rawMsg, key) - case "operation": - err = unpopulate(val, "Operation", &o.Operation) + case "applianceName": + err = unpopulate(val, "ApplianceName", &e.ApplianceName) delete(rawMsg, key) - case "provider": - err = unpopulate(val, "Provider", &o.Provider) - delete(rawMsg, key) - case "resource": - err = unpopulate(val, "Resource", &o.Resource) + case "filter": + err = unpopulate(val, "Filter", &e.Filter) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationResultList. -func (o OperationResultList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExportWebAppsRequest. +func (e ExportWebAppsRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", o.Value) + populate(objectMap, "filter", e.Filter) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationResultList. -func (o *OperationResultList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExportWebAppsRequest. +func (e *ExportWebAppsRequest) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "value": - err = unpopulate(val, "Value", &o.Value) + case "filter": + err = unpopulate(val, "Filter", &e.Filter) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. -func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Feature. +func (f Feature) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "eTag", p.ETag) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "type", p.Type) + populate(objectMap, "featureType", f.FeatureType) + populate(objectMap, "name", f.Name) + populate(objectMap, "parent", f.Parent) + populate(objectMap, "status", f.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection. -func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Feature. +func (f *Feature) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", f, err) } for key, val := range rawMsg { var err error switch key { - case "eTag": - err = unpopulate(val, "ETag", &p.ETag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &p.ID) + case "featureType": + err = unpopulate(val, "FeatureType", &f.FeatureType) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &p.Name) + err = unpopulate(val, "Name", &f.Name) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &p.Properties) + case "parent": + err = unpopulate(val, "Parent", &f.Parent) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) + case "status": + err = unpopulate(val, "Status", &f.Status) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", f, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionCollection. -func (p PrivateEndpointConnectionCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type FileMetaData. +func (f FileMetaData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) + populate(objectMap, "fileType", f.FileType) + populate(objectMap, "isMemoryOptimizedDataOptionEnabled", f.IsMemoryOptimizedDataOptionEnabled) + populate(objectMap, "logicalName", f.LogicalName) + populate(objectMap, "physicalFullName", f.PhysicalFullName) + populate(objectMap, "sizeInMb", f.SizeInMb) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionCollection. -func (p *PrivateEndpointConnectionCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type FileMetaData. +func (f *FileMetaData) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", f, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &p.NextLink) + case "fileType": + err = unpopulate(val, "FileType", &f.FileType) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &p.Value) + case "isMemoryOptimizedDataOptionEnabled": + err = unpopulate(val, "IsMemoryOptimizedDataOptionEnabled", &f.IsMemoryOptimizedDataOptionEnabled) + delete(rawMsg, key) + case "logicalName": + err = unpopulate(val, "LogicalName", &f.LogicalName) + delete(rawMsg, key) + case "physicalFullName": + err = unpopulate(val, "PhysicalFullName", &f.PhysicalFullName) + delete(rawMsg, key) + case "sizeInMb": + err = unpopulate(val, "SizeInMb", &f.SizeInMb) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", f, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. -func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type FrontEndBinding. +func (f FrontEndBinding) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "privateEndpoint", p.PrivateEndpoint) - populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) - populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "hostName", f.HostName) + populate(objectMap, "ipAddress", f.IPAddress) + populate(objectMap, "port", f.Port) + populate(objectMap, "protocol", f.Protocol) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProperties. -func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type FrontEndBinding. +func (f *FrontEndBinding) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", f, err) } for key, val := range rawMsg { var err error switch key { - case "privateEndpoint": - err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) + case "hostName": + err = unpopulate(val, "HostName", &f.HostName) delete(rawMsg, key) - case "privateLinkServiceConnectionState": - err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) + case "ipAddress": + err = unpopulate(val, "IPAddress", &f.IPAddress) delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + case "port": + err = unpopulate(val, "Port", &f.Port) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &f.Protocol) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", f, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource. -func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GuestOsDetails. +func (g GuestOsDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "type", p.Type) + populate(objectMap, "osArchitecture", g.OSArchitecture) + populate(objectMap, "osName", g.OSName) + populate(objectMap, "osType", g.OSType) + populate(objectMap, "osVersion", g.OSVersion) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResource. -func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GuestOsDetails. +func (g *GuestOsDetails) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) + case "osArchitecture": + err = unpopulate(val, "OSArchitecture", &g.OSArchitecture) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) + case "osName": + err = unpopulate(val, "OSName", &g.OSName) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &p.Properties) + case "osType": + err = unpopulate(val, "OSType", &g.OSType) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) + case "osVersion": + err = unpopulate(val, "OSVersion", &g.OSVersion) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceCollection. -func (p PrivateLinkResourceCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type HealthErrorDetails. +func (h HealthErrorDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) + populate(objectMap, "applianceName", h.ApplianceName) + populate(objectMap, "code", h.Code) + populate(objectMap, "discoveryScope", h.DiscoveryScope) + populate(objectMap, "id", h.ID) + populate(objectMap, "message", h.Message) + populate(objectMap, "messageParameters", h.MessageParameters) + populate(objectMap, "possibleCauses", h.PossibleCauses) + populate(objectMap, "recommendedAction", h.RecommendedAction) + populate(objectMap, "runAsAccountId", h.RunAsAccountID) + populate(objectMap, "severity", h.Severity) + populate(objectMap, "source", h.Source) + populate(objectMap, "summaryMessage", h.SummaryMessage) + populateDateTimeRFC3339(objectMap, "updatedTimeStamp", h.UpdatedTimeStamp) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceCollection. -func (p *PrivateLinkResourceCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type HealthErrorDetails. +func (h *HealthErrorDetails) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", h, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &p.NextLink) + case "applianceName": + err = unpopulate(val, "ApplianceName", &h.ApplianceName) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &p.Value) + case "code": + err = unpopulate(val, "Code", &h.Code) + delete(rawMsg, key) + case "discoveryScope": + err = unpopulate(val, "DiscoveryScope", &h.DiscoveryScope) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &h.ID) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &h.Message) + delete(rawMsg, key) + case "messageParameters": + err = unpopulate(val, "MessageParameters", &h.MessageParameters) + delete(rawMsg, key) + case "possibleCauses": + err = unpopulate(val, "PossibleCauses", &h.PossibleCauses) + delete(rawMsg, key) + case "recommendedAction": + err = unpopulate(val, "RecommendedAction", &h.RecommendedAction) + delete(rawMsg, key) + case "runAsAccountId": + err = unpopulate(val, "RunAsAccountID", &h.RunAsAccountID) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &h.Severity) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &h.Source) + delete(rawMsg, key) + case "summaryMessage": + err = unpopulate(val, "SummaryMessage", &h.SummaryMessage) + delete(rawMsg, key) + case "updatedTimeStamp": + err = unpopulateDateTimeRFC3339(val, "UpdatedTimeStamp", &h.UpdatedTimeStamp) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", h, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. -func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type HypervCluster. +func (h HypervCluster) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "groupId", p.GroupID) - populate(objectMap, "requiredMembers", p.RequiredMembers) - populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) + populate(objectMap, "id", h.ID) + populate(objectMap, "name", h.Name) + populate(objectMap, "properties", h.Properties) + populate(objectMap, "systemData", h.SystemData) + populate(objectMap, "type", h.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceProperties. +// UnmarshalJSON implements the json.Unmarshaller interface for type HypervCluster. +func (h *HypervCluster) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &h.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &h.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &h.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &h.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &h.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HypervClusterListResult. +func (h HypervClusterListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", h.NextLink) + populate(objectMap, "value", h.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HypervClusterListResult. +func (h *HypervClusterListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &h.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &h.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HypervClusterProperties. +func (h HypervClusterProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "createdTimestamp", h.CreatedTimestamp) + populate(objectMap, "errors", h.Errors) + populate(objectMap, "fqdn", h.Fqdn) + populate(objectMap, "functionalLevel", h.FunctionalLevel) + populate(objectMap, "hostFqdnList", h.HostFqdnList) + populate(objectMap, "provisioningState", h.ProvisioningState) + populate(objectMap, "runAsAccountId", h.RunAsAccountID) + populate(objectMap, "status", h.Status) + populate(objectMap, "updatedTimestamp", h.UpdatedTimestamp) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HypervClusterProperties. +func (h *HypervClusterProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdTimestamp": + err = unpopulate(val, "CreatedTimestamp", &h.CreatedTimestamp) + delete(rawMsg, key) + case "errors": + err = unpopulate(val, "Errors", &h.Errors) + delete(rawMsg, key) + case "fqdn": + err = unpopulate(val, "Fqdn", &h.Fqdn) + delete(rawMsg, key) + case "functionalLevel": + err = unpopulate(val, "FunctionalLevel", &h.FunctionalLevel) + delete(rawMsg, key) + case "hostFqdnList": + err = unpopulate(val, "HostFqdnList", &h.HostFqdnList) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &h.ProvisioningState) + delete(rawMsg, key) + case "runAsAccountId": + err = unpopulate(val, "RunAsAccountID", &h.RunAsAccountID) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &h.Status) + delete(rawMsg, key) + case "updatedTimestamp": + err = unpopulate(val, "UpdatedTimestamp", &h.UpdatedTimestamp) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HypervDisk. +func (h HypervDisk) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "diskType", h.DiskType) + populate(objectMap, "instanceId", h.InstanceID) + populate(objectMap, "lun", h.Lun) + populate(objectMap, "maxSizeInBytes", h.MaxSizeInBytes) + populate(objectMap, "name", h.Name) + populate(objectMap, "path", h.Path) + populate(objectMap, "vhdId", h.VhdID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HypervDisk. +func (h *HypervDisk) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "diskType": + err = unpopulate(val, "DiskType", &h.DiskType) + delete(rawMsg, key) + case "instanceId": + err = unpopulate(val, "InstanceID", &h.InstanceID) + delete(rawMsg, key) + case "lun": + err = unpopulate(val, "Lun", &h.Lun) + delete(rawMsg, key) + case "maxSizeInBytes": + err = unpopulate(val, "MaxSizeInBytes", &h.MaxSizeInBytes) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &h.Name) + delete(rawMsg, key) + case "path": + err = unpopulate(val, "Path", &h.Path) + delete(rawMsg, key) + case "vhdId": + err = unpopulate(val, "VhdID", &h.VhdID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HypervHost. +func (h HypervHost) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", h.ID) + populate(objectMap, "name", h.Name) + populate(objectMap, "properties", h.Properties) + populate(objectMap, "systemData", h.SystemData) + populate(objectMap, "type", h.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HypervHost. +func (h *HypervHost) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &h.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &h.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &h.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &h.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &h.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HypervHostListResult. +func (h HypervHostListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", h.NextLink) + populate(objectMap, "value", h.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HypervHostListResult. +func (h *HypervHostListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &h.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &h.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HypervHostProperties. +func (h HypervHostProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "createdTimestamp", h.CreatedTimestamp) + populate(objectMap, "errors", h.Errors) + populate(objectMap, "fqdn", h.Fqdn) + populate(objectMap, "provisioningState", h.ProvisioningState) + populate(objectMap, "runAsAccountId", h.RunAsAccountID) + populate(objectMap, "updatedTimestamp", h.UpdatedTimestamp) + populate(objectMap, "version", h.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HypervHostProperties. +func (h *HypervHostProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdTimestamp": + err = unpopulate(val, "CreatedTimestamp", &h.CreatedTimestamp) + delete(rawMsg, key) + case "errors": + err = unpopulate(val, "Errors", &h.Errors) + delete(rawMsg, key) + case "fqdn": + err = unpopulate(val, "Fqdn", &h.Fqdn) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &h.ProvisioningState) + delete(rawMsg, key) + case "runAsAccountId": + err = unpopulate(val, "RunAsAccountID", &h.RunAsAccountID) + delete(rawMsg, key) + case "updatedTimestamp": + err = unpopulate(val, "UpdatedTimestamp", &h.UpdatedTimestamp) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &h.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HypervJob. +func (h HypervJob) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", h.ID) + populate(objectMap, "name", h.Name) + populate(objectMap, "properties", h.Properties) + populate(objectMap, "systemData", h.SystemData) + populate(objectMap, "type", h.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HypervJob. +func (h *HypervJob) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &h.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &h.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &h.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &h.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &h.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HypervJobListResult. +func (h HypervJobListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", h.NextLink) + populate(objectMap, "value", h.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HypervJobListResult. +func (h *HypervJobListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &h.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &h.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HypervMachine. +func (h HypervMachine) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", h.ID) + populate(objectMap, "name", h.Name) + populate(objectMap, "properties", h.Properties) + populate(objectMap, "systemData", h.SystemData) + populate(objectMap, "type", h.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HypervMachine. +func (h *HypervMachine) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &h.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &h.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &h.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &h.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &h.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HypervMachineListResult. +func (h HypervMachineListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", h.NextLink) + populate(objectMap, "value", h.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HypervMachineListResult. +func (h *HypervMachineListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &h.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &h.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HypervMachineProperties. +func (h HypervMachineProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "allocatedMemoryInMb", h.AllocatedMemoryInMb) + populate(objectMap, "applianceNames", h.ApplianceNames) + populate(objectMap, "applicationDiscovery", h.ApplicationDiscovery) + populate(objectMap, "appsAndRoles", h.AppsAndRoles) + populate(objectMap, "biosGuid", h.BiosGUID) + populate(objectMap, "biosSerialNumber", h.BiosSerialNumber) + populate(objectMap, "clusterFqdn", h.ClusterFqdn) + populate(objectMap, "clusterId", h.ClusterID) + populate(objectMap, "createdTimestamp", h.CreatedTimestamp) + populate(objectMap, "dataProtectionRequested", h.DataProtectionRequested) + populate(objectMap, "dependencyMapDiscovery", h.DependencyMapDiscovery) + populate(objectMap, "dependencyMapping", h.DependencyMapping) + populate(objectMap, "dependencyMappingEndTime", h.DependencyMappingEndTime) + populateDateTimeRFC3339(objectMap, "dependencyMappingStartTime", h.DependencyMappingStartTime) + populate(objectMap, "disks", h.Disks) + populate(objectMap, "displayName", h.DisplayName) + populate(objectMap, "encryptStateAndVmMigrationTraffic", h.EncryptStateAndVMMigrationTraffic) + populate(objectMap, "errors", h.Errors) + populate(objectMap, "firmware", h.Firmware) + populate(objectMap, "generation", h.Generation) + populateDateTimeRFC3339(objectMap, "guestDetailsDiscoveryTimestamp", h.GuestDetailsDiscoveryTimestamp) + populate(objectMap, "guestOsDetails", h.GuestOsDetails) + populate(objectMap, "highAvailability", h.HighAvailability) + populate(objectMap, "hostFqdn", h.HostFqdn) + populate(objectMap, "hostId", h.HostID) + populate(objectMap, "iisDiscovery", h.IisDiscovery) + populate(objectMap, "instanceUuid", h.InstanceUUID) + populate(objectMap, "isDeleted", h.IsDeleted) + populate(objectMap, "isDynamicMemoryEnabled", h.IsDynamicMemoryEnabled) + populate(objectMap, "isGuestDetailsDiscoveryInProgress", h.IsGuestDetailsDiscoveryInProgress) + populate(objectMap, "ksdEnabled", h.KsdEnabled) + populate(objectMap, "managementServerType", h.ManagementServerType) + populate(objectMap, "maxMemoryMb", h.MaxMemoryMb) + populate(objectMap, "networkAdapters", h.NetworkAdapters) + populate(objectMap, "numberOfApplications", h.NumberOfApplications) + populate(objectMap, "numberOfProcessorCore", h.NumberOfProcessorCore) + populate(objectMap, "operatingSystemDetails", h.OperatingSystemDetails) + populate(objectMap, "oracleDiscovery", h.OracleDiscovery) + populate(objectMap, "powerStatus", h.PowerStatus) + populate(objectMap, "productSupportStatus", h.ProductSupportStatus) + populate(objectMap, "provisioningState", h.ProvisioningState) + populate(objectMap, "runAsAccountId", h.RunAsAccountID) + populate(objectMap, "sqlDiscovery", h.SQLDiscovery) + populate(objectMap, "secureBootEnabled", h.SecureBootEnabled) + populate(objectMap, "secureBootTemplate", h.SecureBootTemplate) + populate(objectMap, "secureBootTemplateId", h.SecureBootTemplateID) + populate(objectMap, "shieldingRequested", h.ShieldingRequested) + populate(objectMap, "springBootDiscovery", h.SpringBootDiscovery) + populate(objectMap, "staticDiscovery", h.StaticDiscovery) + populate(objectMap, "tags", h.Tags) + populate(objectMap, "tomcatDiscovery", h.TomcatDiscovery) + populate(objectMap, "tpmEnabled", h.TpmEnabled) + populate(objectMap, "updatedTimestamp", h.UpdatedTimestamp) + populate(objectMap, "vmConfigurationFileLocation", h.VMConfigurationFileLocation) + populate(objectMap, "vmFqdn", h.VMFqdn) + populate(objectMap, "version", h.Version) + populate(objectMap, "virtualizationBasedSecurityOptOut", h.VirtualizationBasedSecurityOptOut) + populate(objectMap, "webAppDiscovery", h.WebAppDiscovery) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HypervMachineProperties. +func (h *HypervMachineProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allocatedMemoryInMb": + err = unpopulate(val, "AllocatedMemoryInMb", &h.AllocatedMemoryInMb) + delete(rawMsg, key) + case "applianceNames": + err = unpopulate(val, "ApplianceNames", &h.ApplianceNames) + delete(rawMsg, key) + case "applicationDiscovery": + err = unpopulate(val, "ApplicationDiscovery", &h.ApplicationDiscovery) + delete(rawMsg, key) + case "appsAndRoles": + err = unpopulate(val, "AppsAndRoles", &h.AppsAndRoles) + delete(rawMsg, key) + case "biosGuid": + err = unpopulate(val, "BiosGUID", &h.BiosGUID) + delete(rawMsg, key) + case "biosSerialNumber": + err = unpopulate(val, "BiosSerialNumber", &h.BiosSerialNumber) + delete(rawMsg, key) + case "clusterFqdn": + err = unpopulate(val, "ClusterFqdn", &h.ClusterFqdn) + delete(rawMsg, key) + case "clusterId": + err = unpopulate(val, "ClusterID", &h.ClusterID) + delete(rawMsg, key) + case "createdTimestamp": + err = unpopulate(val, "CreatedTimestamp", &h.CreatedTimestamp) + delete(rawMsg, key) + case "dataProtectionRequested": + err = unpopulate(val, "DataProtectionRequested", &h.DataProtectionRequested) + delete(rawMsg, key) + case "dependencyMapDiscovery": + err = unpopulate(val, "DependencyMapDiscovery", &h.DependencyMapDiscovery) + delete(rawMsg, key) + case "dependencyMapping": + err = unpopulate(val, "DependencyMapping", &h.DependencyMapping) + delete(rawMsg, key) + case "dependencyMappingEndTime": + err = unpopulate(val, "DependencyMappingEndTime", &h.DependencyMappingEndTime) + delete(rawMsg, key) + case "dependencyMappingStartTime": + err = unpopulateDateTimeRFC3339(val, "DependencyMappingStartTime", &h.DependencyMappingStartTime) + delete(rawMsg, key) + case "disks": + err = unpopulate(val, "Disks", &h.Disks) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &h.DisplayName) + delete(rawMsg, key) + case "encryptStateAndVmMigrationTraffic": + err = unpopulate(val, "EncryptStateAndVMMigrationTraffic", &h.EncryptStateAndVMMigrationTraffic) + delete(rawMsg, key) + case "errors": + err = unpopulate(val, "Errors", &h.Errors) + delete(rawMsg, key) + case "firmware": + err = unpopulate(val, "Firmware", &h.Firmware) + delete(rawMsg, key) + case "generation": + err = unpopulate(val, "Generation", &h.Generation) + delete(rawMsg, key) + case "guestDetailsDiscoveryTimestamp": + err = unpopulateDateTimeRFC3339(val, "GuestDetailsDiscoveryTimestamp", &h.GuestDetailsDiscoveryTimestamp) + delete(rawMsg, key) + case "guestOsDetails": + err = unpopulate(val, "GuestOsDetails", &h.GuestOsDetails) + delete(rawMsg, key) + case "highAvailability": + err = unpopulate(val, "HighAvailability", &h.HighAvailability) + delete(rawMsg, key) + case "hostFqdn": + err = unpopulate(val, "HostFqdn", &h.HostFqdn) + delete(rawMsg, key) + case "hostId": + err = unpopulate(val, "HostID", &h.HostID) + delete(rawMsg, key) + case "iisDiscovery": + err = unpopulate(val, "IisDiscovery", &h.IisDiscovery) + delete(rawMsg, key) + case "instanceUuid": + err = unpopulate(val, "InstanceUUID", &h.InstanceUUID) + delete(rawMsg, key) + case "isDeleted": + err = unpopulate(val, "IsDeleted", &h.IsDeleted) + delete(rawMsg, key) + case "isDynamicMemoryEnabled": + err = unpopulate(val, "IsDynamicMemoryEnabled", &h.IsDynamicMemoryEnabled) + delete(rawMsg, key) + case "isGuestDetailsDiscoveryInProgress": + err = unpopulate(val, "IsGuestDetailsDiscoveryInProgress", &h.IsGuestDetailsDiscoveryInProgress) + delete(rawMsg, key) + case "ksdEnabled": + err = unpopulate(val, "KsdEnabled", &h.KsdEnabled) + delete(rawMsg, key) + case "managementServerType": + err = unpopulate(val, "ManagementServerType", &h.ManagementServerType) + delete(rawMsg, key) + case "maxMemoryMb": + err = unpopulate(val, "MaxMemoryMb", &h.MaxMemoryMb) + delete(rawMsg, key) + case "networkAdapters": + err = unpopulate(val, "NetworkAdapters", &h.NetworkAdapters) + delete(rawMsg, key) + case "numberOfApplications": + err = unpopulate(val, "NumberOfApplications", &h.NumberOfApplications) + delete(rawMsg, key) + case "numberOfProcessorCore": + err = unpopulate(val, "NumberOfProcessorCore", &h.NumberOfProcessorCore) + delete(rawMsg, key) + case "operatingSystemDetails": + err = unpopulate(val, "OperatingSystemDetails", &h.OperatingSystemDetails) + delete(rawMsg, key) + case "oracleDiscovery": + err = unpopulate(val, "OracleDiscovery", &h.OracleDiscovery) + delete(rawMsg, key) + case "powerStatus": + err = unpopulate(val, "PowerStatus", &h.PowerStatus) + delete(rawMsg, key) + case "productSupportStatus": + err = unpopulate(val, "ProductSupportStatus", &h.ProductSupportStatus) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &h.ProvisioningState) + delete(rawMsg, key) + case "runAsAccountId": + err = unpopulate(val, "RunAsAccountID", &h.RunAsAccountID) + delete(rawMsg, key) + case "sqlDiscovery": + err = unpopulate(val, "SQLDiscovery", &h.SQLDiscovery) + delete(rawMsg, key) + case "secureBootEnabled": + err = unpopulate(val, "SecureBootEnabled", &h.SecureBootEnabled) + delete(rawMsg, key) + case "secureBootTemplate": + err = unpopulate(val, "SecureBootTemplate", &h.SecureBootTemplate) + delete(rawMsg, key) + case "secureBootTemplateId": + err = unpopulate(val, "SecureBootTemplateID", &h.SecureBootTemplateID) + delete(rawMsg, key) + case "shieldingRequested": + err = unpopulate(val, "ShieldingRequested", &h.ShieldingRequested) + delete(rawMsg, key) + case "springBootDiscovery": + err = unpopulate(val, "SpringBootDiscovery", &h.SpringBootDiscovery) + delete(rawMsg, key) + case "staticDiscovery": + err = unpopulate(val, "StaticDiscovery", &h.StaticDiscovery) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &h.Tags) + delete(rawMsg, key) + case "tomcatDiscovery": + err = unpopulate(val, "TomcatDiscovery", &h.TomcatDiscovery) + delete(rawMsg, key) + case "tpmEnabled": + err = unpopulate(val, "TpmEnabled", &h.TpmEnabled) + delete(rawMsg, key) + case "updatedTimestamp": + err = unpopulate(val, "UpdatedTimestamp", &h.UpdatedTimestamp) + delete(rawMsg, key) + case "vmConfigurationFileLocation": + err = unpopulate(val, "VMConfigurationFileLocation", &h.VMConfigurationFileLocation) + delete(rawMsg, key) + case "vmFqdn": + err = unpopulate(val, "VMFqdn", &h.VMFqdn) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &h.Version) + delete(rawMsg, key) + case "virtualizationBasedSecurityOptOut": + err = unpopulate(val, "VirtualizationBasedSecurityOptOut", &h.VirtualizationBasedSecurityOptOut) + delete(rawMsg, key) + case "webAppDiscovery": + err = unpopulate(val, "WebAppDiscovery", &h.WebAppDiscovery) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HypervMachineUpdate. +func (h HypervMachineUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", h.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HypervMachineUpdate. +func (h *HypervMachineUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &h.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HypervMachineUpdateProperties. +func (h HypervMachineUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "allocatedMemoryInMb", h.AllocatedMemoryInMb) + populate(objectMap, "biosGuid", h.BiosGUID) + populate(objectMap, "biosSerialNumber", h.BiosSerialNumber) + populate(objectMap, "firmware", h.Firmware) + populate(objectMap, "numberOfProcessorCore", h.NumberOfProcessorCore) + populate(objectMap, "operatingSystemDetails", h.OperatingSystemDetails) + populate(objectMap, "productSupportStatus", h.ProductSupportStatus) + populate(objectMap, "runAsAccountId", h.RunAsAccountID) + populate(objectMap, "tags", h.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HypervMachineUpdateProperties. +func (h *HypervMachineUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allocatedMemoryInMb": + err = unpopulate(val, "AllocatedMemoryInMb", &h.AllocatedMemoryInMb) + delete(rawMsg, key) + case "biosGuid": + err = unpopulate(val, "BiosGUID", &h.BiosGUID) + delete(rawMsg, key) + case "biosSerialNumber": + err = unpopulate(val, "BiosSerialNumber", &h.BiosSerialNumber) + delete(rawMsg, key) + case "firmware": + err = unpopulate(val, "Firmware", &h.Firmware) + delete(rawMsg, key) + case "numberOfProcessorCore": + err = unpopulate(val, "NumberOfProcessorCore", &h.NumberOfProcessorCore) + delete(rawMsg, key) + case "operatingSystemDetails": + err = unpopulate(val, "OperatingSystemDetails", &h.OperatingSystemDetails) + delete(rawMsg, key) + case "productSupportStatus": + err = unpopulate(val, "ProductSupportStatus", &h.ProductSupportStatus) + delete(rawMsg, key) + case "runAsAccountId": + err = unpopulate(val, "RunAsAccountID", &h.RunAsAccountID) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &h.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HypervNetworkAdapter. +func (h HypervNetworkAdapter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "ipAddressList", h.IPAddressList) + populate(objectMap, "ipAddressType", h.IPAddressType) + populate(objectMap, "macAddress", h.MacAddress) + populate(objectMap, "networkId", h.NetworkID) + populate(objectMap, "networkName", h.NetworkName) + populate(objectMap, "nicId", h.NicID) + populate(objectMap, "nicType", h.NicType) + populate(objectMap, "staticIpAddress", h.StaticIPAddress) + populate(objectMap, "subnetName", h.SubnetName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HypervNetworkAdapter. +func (h *HypervNetworkAdapter) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ipAddressList": + err = unpopulate(val, "IPAddressList", &h.IPAddressList) + delete(rawMsg, key) + case "ipAddressType": + err = unpopulate(val, "IPAddressType", &h.IPAddressType) + delete(rawMsg, key) + case "macAddress": + err = unpopulate(val, "MacAddress", &h.MacAddress) + delete(rawMsg, key) + case "networkId": + err = unpopulate(val, "NetworkID", &h.NetworkID) + delete(rawMsg, key) + case "networkName": + err = unpopulate(val, "NetworkName", &h.NetworkName) + delete(rawMsg, key) + case "nicId": + err = unpopulate(val, "NicID", &h.NicID) + delete(rawMsg, key) + case "nicType": + err = unpopulate(val, "NicType", &h.NicType) + delete(rawMsg, key) + case "staticIpAddress": + err = unpopulate(val, "StaticIPAddress", &h.StaticIPAddress) + delete(rawMsg, key) + case "subnetName": + err = unpopulate(val, "SubnetName", &h.SubnetName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HypervOperationsStatusResource. +func (h HypervOperationsStatusResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", h.ID) + populate(objectMap, "name", h.Name) + populate(objectMap, "properties", h.Properties) + populate(objectMap, "systemData", h.SystemData) + populate(objectMap, "type", h.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HypervOperationsStatusResource. +func (h *HypervOperationsStatusResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &h.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &h.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &h.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &h.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &h.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HypervRunAsAccountResource. +func (h HypervRunAsAccountResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", h.ID) + populate(objectMap, "name", h.Name) + populate(objectMap, "properties", h.Properties) + populate(objectMap, "systemData", h.SystemData) + populate(objectMap, "type", h.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HypervRunAsAccountResource. +func (h *HypervRunAsAccountResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &h.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &h.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &h.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &h.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &h.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HypervRunAsAccountResourceListResult. +func (h HypervRunAsAccountResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", h.NextLink) + populate(objectMap, "value", h.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HypervRunAsAccountResourceListResult. +func (h *HypervRunAsAccountResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &h.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &h.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HypervSite. +func (h HypervSite) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", h.ID) + populate(objectMap, "location", h.Location) + populate(objectMap, "name", h.Name) + populate(objectMap, "properties", h.Properties) + populate(objectMap, "systemData", h.SystemData) + populate(objectMap, "tags", h.Tags) + populate(objectMap, "type", h.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HypervSite. +func (h *HypervSite) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &h.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &h.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &h.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &h.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &h.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &h.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &h.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HypervSiteListResult. +func (h HypervSiteListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", h.NextLink) + populate(objectMap, "value", h.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HypervSiteListResult. +func (h *HypervSiteListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &h.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &h.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HypervSiteUpdate. +func (h HypervSiteUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", h.Properties) + populate(objectMap, "tags", h.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HypervSiteUpdate. +func (h *HypervSiteUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &h.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &h.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HypervSiteUpdateProperties. +func (h HypervSiteUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "agentDetails", h.AgentDetails) + populate(objectMap, "applianceName", h.ApplianceName) + populate(objectMap, "discoverySolutionId", h.DiscoverySolutionID) + populate(objectMap, "provisioningState", h.ProvisioningState) + populate(objectMap, "servicePrincipalIdentityDetails", h.ServicePrincipalIdentityDetails) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HypervSiteUpdateProperties. +func (h *HypervSiteUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "agentDetails": + err = unpopulate(val, "AgentDetails", &h.AgentDetails) + delete(rawMsg, key) + case "applianceName": + err = unpopulate(val, "ApplianceName", &h.ApplianceName) + delete(rawMsg, key) + case "discoverySolutionId": + err = unpopulate(val, "DiscoverySolutionID", &h.DiscoverySolutionID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &h.ProvisioningState) + delete(rawMsg, key) + case "servicePrincipalIdentityDetails": + err = unpopulate(val, "ServicePrincipalIdentityDetails", &h.ServicePrincipalIdentityDetails) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HypervSiteUsage. +func (h HypervSiteUsage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clusterCount", h.ClusterCount) + populate(objectMap, "hostCount", h.HostCount) + populate(objectMap, "machineCount", h.MachineCount) + populate(objectMap, "runAsAccountCount", h.RunAsAccountCount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HypervSiteUsage. +func (h *HypervSiteUsage) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clusterCount": + err = unpopulate(val, "ClusterCount", &h.ClusterCount) + delete(rawMsg, key) + case "hostCount": + err = unpopulate(val, "HostCount", &h.HostCount) + delete(rawMsg, key) + case "machineCount": + err = unpopulate(val, "MachineCount", &h.MachineCount) + delete(rawMsg, key) + case "runAsAccountCount": + err = unpopulate(val, "RunAsAccountCount", &h.RunAsAccountCount) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HypervVMSoftwareInventory. +func (h HypervVMSoftwareInventory) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", h.ID) + populate(objectMap, "name", h.Name) + populate(objectMap, "properties", h.Properties) + populate(objectMap, "systemData", h.SystemData) + populate(objectMap, "type", h.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HypervVMSoftwareInventory. +func (h *HypervVMSoftwareInventory) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &h.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &h.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &h.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &h.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &h.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HypervVMSoftwareInventoryListResult. +func (h HypervVMSoftwareInventoryListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", h.NextLink) + populate(objectMap, "value", h.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HypervVMSoftwareInventoryListResult. +func (h *HypervVMSoftwareInventoryListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &h.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &h.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IisApplicationUnit. +func (i IisApplicationUnit) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "applicationPoolName", i.ApplicationPoolName) + populate(objectMap, "directories", i.Directories) + populate(objectMap, "enable32BitApiOnWin64", i.Enable32BitAPIOnWin64) + populate(objectMap, "managedPipelineMode", i.ManagedPipelineMode) + populate(objectMap, "path", i.Path) + populate(objectMap, "runtimeVersion", i.RuntimeVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IisApplicationUnit. +func (i *IisApplicationUnit) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "applicationPoolName": + err = unpopulate(val, "ApplicationPoolName", &i.ApplicationPoolName) + delete(rawMsg, key) + case "directories": + err = unpopulate(val, "Directories", &i.Directories) + delete(rawMsg, key) + case "enable32BitApiOnWin64": + err = unpopulate(val, "Enable32BitAPIOnWin64", &i.Enable32BitAPIOnWin64) + delete(rawMsg, key) + case "managedPipelineMode": + err = unpopulate(val, "ManagedPipelineMode", &i.ManagedPipelineMode) + delete(rawMsg, key) + case "path": + err = unpopulate(val, "Path", &i.Path) + delete(rawMsg, key) + case "runtimeVersion": + err = unpopulate(val, "RuntimeVersion", &i.RuntimeVersion) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IisVirtualApplicationUnit. +func (i IisVirtualApplicationUnit) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "directories", i.Directories) + populate(objectMap, "isVirtualDirectory", i.IsVirtualDirectory) + populate(objectMap, "path", i.Path) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IisVirtualApplicationUnit. +func (i *IisVirtualApplicationUnit) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "directories": + err = unpopulate(val, "Directories", &i.Directories) + delete(rawMsg, key) + case "isVirtualDirectory": + err = unpopulate(val, "IsVirtualDirectory", &i.IsVirtualDirectory) + delete(rawMsg, key) + case "path": + err = unpopulate(val, "Path", &i.Path) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IisWebApplicationProperties. +func (i IisWebApplicationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "applianceNames", i.ApplianceNames) + populate(objectMap, "applications", i.Applications) + populate(objectMap, "bindings", i.Bindings) + populate(objectMap, "configurations", i.Configurations) + populate(objectMap, "createdTimestamp", i.CreatedTimestamp) + populate(objectMap, "directories", i.Directories) + populate(objectMap, "displayName", i.DisplayName) + populate(objectMap, "errors", i.Errors) + populate(objectMap, "frameworks", i.Frameworks) + populate(objectMap, "hasErrors", i.HasErrors) + populate(objectMap, "isDeleted", i.IsDeleted) + populate(objectMap, "machineArmIds", i.MachineArmIDs) + populate(objectMap, "machineDisplayName", i.MachineDisplayName) + populate(objectMap, "physicalPath", i.PhysicalPath) + populate(objectMap, "provisioningState", i.ProvisioningState) + populate(objectMap, "serverType", i.ServerType) + populate(objectMap, "staticFolders", i.StaticFolders) + populate(objectMap, "tags", i.Tags) + populate(objectMap, "updatedTimestamp", i.UpdatedTimestamp) + populate(objectMap, "virtualApplications", i.VirtualApplications) + populate(objectMap, "virtualPath", i.VirtualPath) + populate(objectMap, "webServerId", i.WebServerID) + populate(objectMap, "webServerName", i.WebServerName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IisWebApplicationProperties. +func (i *IisWebApplicationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "applianceNames": + err = unpopulate(val, "ApplianceNames", &i.ApplianceNames) + delete(rawMsg, key) + case "applications": + err = unpopulate(val, "Applications", &i.Applications) + delete(rawMsg, key) + case "bindings": + err = unpopulate(val, "Bindings", &i.Bindings) + delete(rawMsg, key) + case "configurations": + err = unpopulate(val, "Configurations", &i.Configurations) + delete(rawMsg, key) + case "createdTimestamp": + err = unpopulate(val, "CreatedTimestamp", &i.CreatedTimestamp) + delete(rawMsg, key) + case "directories": + err = unpopulate(val, "Directories", &i.Directories) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &i.DisplayName) + delete(rawMsg, key) + case "errors": + err = unpopulate(val, "Errors", &i.Errors) + delete(rawMsg, key) + case "frameworks": + err = unpopulate(val, "Frameworks", &i.Frameworks) + delete(rawMsg, key) + case "hasErrors": + err = unpopulate(val, "HasErrors", &i.HasErrors) + delete(rawMsg, key) + case "isDeleted": + err = unpopulate(val, "IsDeleted", &i.IsDeleted) + delete(rawMsg, key) + case "machineArmIds": + err = unpopulate(val, "MachineArmIDs", &i.MachineArmIDs) + delete(rawMsg, key) + case "machineDisplayName": + err = unpopulate(val, "MachineDisplayName", &i.MachineDisplayName) + delete(rawMsg, key) + case "physicalPath": + err = unpopulate(val, "PhysicalPath", &i.PhysicalPath) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &i.ProvisioningState) + delete(rawMsg, key) + case "serverType": + err = unpopulate(val, "ServerType", &i.ServerType) + delete(rawMsg, key) + case "staticFolders": + err = unpopulate(val, "StaticFolders", &i.StaticFolders) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &i.Tags) + delete(rawMsg, key) + case "updatedTimestamp": + err = unpopulate(val, "UpdatedTimestamp", &i.UpdatedTimestamp) + delete(rawMsg, key) + case "virtualApplications": + err = unpopulate(val, "VirtualApplications", &i.VirtualApplications) + delete(rawMsg, key) + case "virtualPath": + err = unpopulate(val, "VirtualPath", &i.VirtualPath) + delete(rawMsg, key) + case "webServerId": + err = unpopulate(val, "WebServerID", &i.WebServerID) + delete(rawMsg, key) + case "webServerName": + err = unpopulate(val, "WebServerName", &i.WebServerName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IisWebApplications. +func (i IisWebApplications) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", i.ID) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "systemData", i.SystemData) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IisWebApplications. +func (i *IisWebApplications) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &i.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IisWebApplicationsListResult. +func (i IisWebApplicationsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IisWebApplicationsListResult. +func (i *IisWebApplicationsListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &i.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &i.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IisWebApplicationsUpdate. +func (i IisWebApplicationsUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", i.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IisWebApplicationsUpdate. +func (i *IisWebApplicationsUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IisWebApplicationsUpdateProperties. +func (i IisWebApplicationsUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tags", i.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IisWebApplicationsUpdateProperties. +func (i *IisWebApplicationsUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tags": + err = unpopulate(val, "Tags", &i.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IisWebServerProperties. +func (i IisWebServerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "applianceNames", i.ApplianceNames) + populate(objectMap, "configurationLocation", i.ConfigurationLocation) + populate(objectMap, "createdTimestamp", i.CreatedTimestamp) + populate(objectMap, "displayName", i.DisplayName) + populate(objectMap, "errors", i.Errors) + populate(objectMap, "hasErrors", i.HasErrors) + populate(objectMap, "isDeleted", i.IsDeleted) + populate(objectMap, "machineIds", i.MachineIDs) + populate(objectMap, "provisioningState", i.ProvisioningState) + populate(objectMap, "runAsAccountId", i.RunAsAccountID) + populate(objectMap, "serverFqdn", i.ServerFqdn) + populate(objectMap, "serverType", i.ServerType) + populate(objectMap, "updatedTimestamp", i.UpdatedTimestamp) + populate(objectMap, "version", i.Version) + populate(objectMap, "webApplications", i.WebApplications) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IisWebServerProperties. +func (i *IisWebServerProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "applianceNames": + err = unpopulate(val, "ApplianceNames", &i.ApplianceNames) + delete(rawMsg, key) + case "configurationLocation": + err = unpopulate(val, "ConfigurationLocation", &i.ConfigurationLocation) + delete(rawMsg, key) + case "createdTimestamp": + err = unpopulate(val, "CreatedTimestamp", &i.CreatedTimestamp) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &i.DisplayName) + delete(rawMsg, key) + case "errors": + err = unpopulate(val, "Errors", &i.Errors) + delete(rawMsg, key) + case "hasErrors": + err = unpopulate(val, "HasErrors", &i.HasErrors) + delete(rawMsg, key) + case "isDeleted": + err = unpopulate(val, "IsDeleted", &i.IsDeleted) + delete(rawMsg, key) + case "machineIds": + err = unpopulate(val, "MachineIDs", &i.MachineIDs) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &i.ProvisioningState) + delete(rawMsg, key) + case "runAsAccountId": + err = unpopulate(val, "RunAsAccountID", &i.RunAsAccountID) + delete(rawMsg, key) + case "serverFqdn": + err = unpopulate(val, "ServerFqdn", &i.ServerFqdn) + delete(rawMsg, key) + case "serverType": + err = unpopulate(val, "ServerType", &i.ServerType) + delete(rawMsg, key) + case "updatedTimestamp": + err = unpopulate(val, "UpdatedTimestamp", &i.UpdatedTimestamp) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &i.Version) + delete(rawMsg, key) + case "webApplications": + err = unpopulate(val, "WebApplications", &i.WebApplications) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IisWebServers. +func (i IisWebServers) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", i.ID) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "systemData", i.SystemData) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IisWebServers. +func (i *IisWebServers) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &i.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IisWebServersListResult. +func (i IisWebServersListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IisWebServersListResult. +func (i *IisWebServersListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &i.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &i.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImportJob. +func (i ImportJob) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", i.ID) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "systemData", i.SystemData) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImportJob. +func (i *ImportJob) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &i.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImportJobListResult. +func (i ImportJobListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImportJobListResult. +func (i *ImportJobListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &i.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &i.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImportMachine. +func (i ImportMachine) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", i.ID) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "systemData", i.SystemData) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImportMachine. +func (i *ImportMachine) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &i.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImportMachineListResult. +func (i ImportMachineListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImportMachineListResult. +func (i *ImportMachineListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &i.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &i.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImportMachineProperties. +func (i ImportMachineProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "allocatedMemoryInMb", i.AllocatedMemoryInMb) + populate(objectMap, "biosGuid", i.BiosGUID) + populate(objectMap, "biosSerialNumber", i.BiosSerialNumber) + populate(objectMap, "createdTimestamp", i.CreatedTimestamp) + populate(objectMap, "disks", i.Disks) + populate(objectMap, "displayName", i.DisplayName) + populate(objectMap, "firmware", i.Firmware) + populate(objectMap, "hypervisor", i.Hypervisor) + populate(objectMap, "hypervisorVersionNumber", i.HypervisorVersionNumber) + populate(objectMap, "ipAddresses", i.IPAddresses) + populate(objectMap, "isDeleted", i.IsDeleted) + populate(objectMap, "macAddress", i.MacAddress) + populate(objectMap, "machineId", i.MachineID) + populate(objectMap, "machineManagerId", i.MachineManagerID) + populate(objectMap, "networkInThroughput", i.NetworkInThroughput) + populate(objectMap, "networkOutThroughput", i.NetworkOutThroughput) + populate(objectMap, "numberOfDisks", i.NumberOfDisks) + populate(objectMap, "numberOfNetworkAdapters", i.NumberOfNetworkAdapters) + populate(objectMap, "numberOfProcessorCore", i.NumberOfProcessorCore) + populate(objectMap, "operatingSystemDetails", i.OperatingSystemDetails) + populate(objectMap, "percentageCpuUtilization", i.PercentageCPUUtilization) + populate(objectMap, "percentageMemoryUtilization", i.PercentageMemoryUtilization) + populate(objectMap, "provisioningState", i.ProvisioningState) + populate(objectMap, "serverType", i.ServerType) + populate(objectMap, "storageInUseGb", i.StorageInUseGb) + populate(objectMap, "tags", i.Tags) + populate(objectMap, "totalDiskReadOperationsPerSecond", i.TotalDiskReadOperationsPerSecond) + populate(objectMap, "totalDiskReadThroughput", i.TotalDiskReadThroughput) + populate(objectMap, "totalDiskWriteOperationsPerSecond", i.TotalDiskWriteOperationsPerSecond) + populate(objectMap, "totalDiskWriteThroughput", i.TotalDiskWriteThroughput) + populate(objectMap, "updatedTimestamp", i.UpdatedTimestamp) + populate(objectMap, "vmFqdn", i.VMFqdn) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImportMachineProperties. +func (i *ImportMachineProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allocatedMemoryInMb": + err = unpopulate(val, "AllocatedMemoryInMb", &i.AllocatedMemoryInMb) + delete(rawMsg, key) + case "biosGuid": + err = unpopulate(val, "BiosGUID", &i.BiosGUID) + delete(rawMsg, key) + case "biosSerialNumber": + err = unpopulate(val, "BiosSerialNumber", &i.BiosSerialNumber) + delete(rawMsg, key) + case "createdTimestamp": + err = unpopulate(val, "CreatedTimestamp", &i.CreatedTimestamp) + delete(rawMsg, key) + case "disks": + err = unpopulate(val, "Disks", &i.Disks) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &i.DisplayName) + delete(rawMsg, key) + case "firmware": + err = unpopulate(val, "Firmware", &i.Firmware) + delete(rawMsg, key) + case "hypervisor": + err = unpopulate(val, "Hypervisor", &i.Hypervisor) + delete(rawMsg, key) + case "hypervisorVersionNumber": + err = unpopulate(val, "HypervisorVersionNumber", &i.HypervisorVersionNumber) + delete(rawMsg, key) + case "ipAddresses": + err = unpopulate(val, "IPAddresses", &i.IPAddresses) + delete(rawMsg, key) + case "isDeleted": + err = unpopulate(val, "IsDeleted", &i.IsDeleted) + delete(rawMsg, key) + case "macAddress": + err = unpopulate(val, "MacAddress", &i.MacAddress) + delete(rawMsg, key) + case "machineId": + err = unpopulate(val, "MachineID", &i.MachineID) + delete(rawMsg, key) + case "machineManagerId": + err = unpopulate(val, "MachineManagerID", &i.MachineManagerID) + delete(rawMsg, key) + case "networkInThroughput": + err = unpopulate(val, "NetworkInThroughput", &i.NetworkInThroughput) + delete(rawMsg, key) + case "networkOutThroughput": + err = unpopulate(val, "NetworkOutThroughput", &i.NetworkOutThroughput) + delete(rawMsg, key) + case "numberOfDisks": + err = unpopulate(val, "NumberOfDisks", &i.NumberOfDisks) + delete(rawMsg, key) + case "numberOfNetworkAdapters": + err = unpopulate(val, "NumberOfNetworkAdapters", &i.NumberOfNetworkAdapters) + delete(rawMsg, key) + case "numberOfProcessorCore": + err = unpopulate(val, "NumberOfProcessorCore", &i.NumberOfProcessorCore) + delete(rawMsg, key) + case "operatingSystemDetails": + err = unpopulate(val, "OperatingSystemDetails", &i.OperatingSystemDetails) + delete(rawMsg, key) + case "percentageCpuUtilization": + err = unpopulate(val, "PercentageCPUUtilization", &i.PercentageCPUUtilization) + delete(rawMsg, key) + case "percentageMemoryUtilization": + err = unpopulate(val, "PercentageMemoryUtilization", &i.PercentageMemoryUtilization) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &i.ProvisioningState) + delete(rawMsg, key) + case "serverType": + err = unpopulate(val, "ServerType", &i.ServerType) + delete(rawMsg, key) + case "storageInUseGb": + err = unpopulate(val, "StorageInUseGb", &i.StorageInUseGb) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &i.Tags) + delete(rawMsg, key) + case "totalDiskReadOperationsPerSecond": + err = unpopulate(val, "TotalDiskReadOperationsPerSecond", &i.TotalDiskReadOperationsPerSecond) + delete(rawMsg, key) + case "totalDiskReadThroughput": + err = unpopulate(val, "TotalDiskReadThroughput", &i.TotalDiskReadThroughput) + delete(rawMsg, key) + case "totalDiskWriteOperationsPerSecond": + err = unpopulate(val, "TotalDiskWriteOperationsPerSecond", &i.TotalDiskWriteOperationsPerSecond) + delete(rawMsg, key) + case "totalDiskWriteThroughput": + err = unpopulate(val, "TotalDiskWriteThroughput", &i.TotalDiskWriteThroughput) + delete(rawMsg, key) + case "updatedTimestamp": + err = unpopulate(val, "UpdatedTimestamp", &i.UpdatedTimestamp) + delete(rawMsg, key) + case "vmFqdn": + err = unpopulate(val, "VMFqdn", &i.VMFqdn) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImportMachinesJob. +func (i ImportMachinesJob) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "displayName", i.DisplayName) + populate(objectMap, "endTime", i.EndTime) + populate(objectMap, "id", i.ID) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "startTime", i.StartTime) + populate(objectMap, "status", i.Status) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImportMachinesJob. +func (i *ImportMachinesJob) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "displayName": + err = unpopulate(val, "DisplayName", &i.DisplayName) + delete(rawMsg, key) + case "endTime": + err = unpopulate(val, "EndTime", &i.EndTime) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "startTime": + err = unpopulate(val, "StartTime", &i.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &i.Status) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImportMachinesJobProperties. +func (i ImportMachinesJobProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "blobCreationTimeStamp", i.BlobCreationTimeStamp) + populate(objectMap, "blobName", i.BlobName) + populate(objectMap, "blobSasUri", i.BlobSasURI) + populate(objectMap, "errorSummary", i.ErrorSummary) + populate(objectMap, "jobResult", i.JobResult) + populate(objectMap, "numberOfMachinesImported", i.NumberOfMachinesImported) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImportMachinesJobProperties. +func (i *ImportMachinesJobProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "blobCreationTimeStamp": + err = unpopulateDateTimeRFC3339(val, "BlobCreationTimeStamp", &i.BlobCreationTimeStamp) + delete(rawMsg, key) + case "blobName": + err = unpopulate(val, "BlobName", &i.BlobName) + delete(rawMsg, key) + case "blobSasUri": + err = unpopulate(val, "BlobSasURI", &i.BlobSasURI) + delete(rawMsg, key) + case "errorSummary": + err = unpopulate(val, "ErrorSummary", &i.ErrorSummary) + delete(rawMsg, key) + case "jobResult": + err = unpopulate(val, "JobResult", &i.JobResult) + delete(rawMsg, key) + case "numberOfMachinesImported": + err = unpopulate(val, "NumberOfMachinesImported", &i.NumberOfMachinesImported) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImportSite. +func (i ImportSite) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", i.ID) + populate(objectMap, "location", i.Location) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "systemData", i.SystemData) + populate(objectMap, "tags", i.Tags) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImportSite. +func (i *ImportSite) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &i.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &i.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &i.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImportSiteListResult. +func (i ImportSiteListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImportSiteListResult. +func (i *ImportSiteListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &i.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &i.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImportSiteProperties. +func (i ImportSiteProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "discoverySolutionId", i.DiscoverySolutionID) + populate(objectMap, "masterSiteId", i.MasterSiteID) + populate(objectMap, "provisioningState", i.ProvisioningState) + populate(objectMap, "serviceEndpoint", i.ServiceEndpoint) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImportSiteProperties. +func (i *ImportSiteProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "discoverySolutionId": + err = unpopulate(val, "DiscoverySolutionID", &i.DiscoverySolutionID) + delete(rawMsg, key) + case "masterSiteId": + err = unpopulate(val, "MasterSiteID", &i.MasterSiteID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &i.ProvisioningState) + delete(rawMsg, key) + case "serviceEndpoint": + err = unpopulate(val, "ServiceEndpoint", &i.ServiceEndpoint) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImportSiteUpdate. +func (i ImportSiteUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "tags", i.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImportSiteUpdate. +func (i *ImportSiteUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &i.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImportSiteUpdateProperties. +func (i ImportSiteUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "discoverySolutionId", i.DiscoverySolutionID) + populate(objectMap, "provisioningState", i.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImportSiteUpdateProperties. +func (i *ImportSiteUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "discoverySolutionId": + err = unpopulate(val, "DiscoverySolutionID", &i.DiscoverySolutionID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &i.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JobErrorSummary. +func (j JobErrorSummary) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "errorCount", j.ErrorCount) + populate(objectMap, "errors", j.Errors) + populate(objectMap, "warningCount", j.WarningCount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobErrorSummary. +func (j *JobErrorSummary) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "errorCount": + err = unpopulate(val, "ErrorCount", &j.ErrorCount) + delete(rawMsg, key) + case "errors": + err = unpopulate(val, "Errors", &j.Errors) + delete(rawMsg, key) + case "warningCount": + err = unpopulate(val, "WarningCount", &j.WarningCount) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JobProperties. +func (j JobProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "activityId", j.ActivityID) + populate(objectMap, "clientRequestId", j.ClientRequestID) + populate(objectMap, "displayName", j.DisplayName) + populate(objectMap, "endTime", j.EndTime) + populate(objectMap, "errors", j.Errors) + populate(objectMap, "provisioningState", j.ProvisioningState) + populate(objectMap, "startTime", j.StartTime) + populate(objectMap, "status", j.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobProperties. +func (j *JobProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "activityId": + err = unpopulate(val, "ActivityID", &j.ActivityID) + delete(rawMsg, key) + case "clientRequestId": + err = unpopulate(val, "ClientRequestID", &j.ClientRequestID) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &j.DisplayName) + delete(rawMsg, key) + case "endTime": + err = unpopulate(val, "EndTime", &j.EndTime) + delete(rawMsg, key) + case "errors": + err = unpopulate(val, "Errors", &j.Errors) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &j.ProvisioningState) + delete(rawMsg, key) + case "startTime": + err = unpopulate(val, "StartTime", &j.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &j.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MachineMetadata. +func (m MachineMetadata) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dependencyMapping", m.DependencyMapping) + populate(objectMap, "machineArmId", m.MachineArmID) + populate(objectMap, "tags", m.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineMetadata. +func (m *MachineMetadata) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dependencyMapping": + err = unpopulate(val, "DependencyMapping", &m.DependencyMapping) + delete(rawMsg, key) + case "machineArmId": + err = unpopulate(val, "MachineArmID", &m.MachineArmID) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &m.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MachineMetadataCollection. +func (m MachineMetadataCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineMetadataCollection. +func (m *MachineMetadataCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MachineResource. +func (m MachineResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", m.ID) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineResource. +func (m *MachineResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MachineResourceListResult. +func (m MachineResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineResourceListResult. +func (m *MachineResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MachineResourceUpdate. +func (m MachineResourceUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", m.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineResourceUpdate. +func (m *MachineResourceUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MachineResourceUpdateProperties. +func (m MachineResourceUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "allocatedMemoryInMb", m.AllocatedMemoryInMb) + populate(objectMap, "biosGuid", m.BiosGUID) + populate(objectMap, "biosSerialNumber", m.BiosSerialNumber) + populate(objectMap, "firmware", m.Firmware) + populate(objectMap, "numberOfProcessorCore", m.NumberOfProcessorCore) + populate(objectMap, "operatingSystemDetails", m.OperatingSystemDetails) + populate(objectMap, "productSupportStatus", m.ProductSupportStatus) + populate(objectMap, "runAsAccountId", m.RunAsAccountID) + populate(objectMap, "tags", m.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineResourceUpdateProperties. +func (m *MachineResourceUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allocatedMemoryInMb": + err = unpopulate(val, "AllocatedMemoryInMb", &m.AllocatedMemoryInMb) + delete(rawMsg, key) + case "biosGuid": + err = unpopulate(val, "BiosGUID", &m.BiosGUID) + delete(rawMsg, key) + case "biosSerialNumber": + err = unpopulate(val, "BiosSerialNumber", &m.BiosSerialNumber) + delete(rawMsg, key) + case "firmware": + err = unpopulate(val, "Firmware", &m.Firmware) + delete(rawMsg, key) + case "numberOfProcessorCore": + err = unpopulate(val, "NumberOfProcessorCore", &m.NumberOfProcessorCore) + delete(rawMsg, key) + case "operatingSystemDetails": + err = unpopulate(val, "OperatingSystemDetails", &m.OperatingSystemDetails) + delete(rawMsg, key) + case "productSupportStatus": + err = unpopulate(val, "ProductSupportStatus", &m.ProductSupportStatus) + delete(rawMsg, key) + case "runAsAccountId": + err = unpopulate(val, "RunAsAccountID", &m.RunAsAccountID) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &m.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MachineSoftwareInventoryProperties. +func (m MachineSoftwareInventoryProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "appsAndRoles", m.AppsAndRoles) + populate(objectMap, "provisioningState", m.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineSoftwareInventoryProperties. +func (m *MachineSoftwareInventoryProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "appsAndRoles": + err = unpopulate(val, "AppsAndRoles", &m.AppsAndRoles) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &m.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MasterSite. +func (m MasterSite) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", m.ID) + populate(objectMap, "location", m.Location) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "tags", m.Tags) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MasterSite. +func (m *MasterSite) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &m.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &m.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MasterSiteListResult. +func (m MasterSiteListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MasterSiteListResult. +func (m *MasterSiteListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MasterSiteProperties. +func (m MasterSiteProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "allowMultipleSites", m.AllowMultipleSites) + populate(objectMap, "customerStorageAccountArmId", m.CustomerStorageAccountArmID) + populate(objectMap, "nestedSites", m.NestedSites) + populate(objectMap, "privateEndpointConnections", m.PrivateEndpointConnections) + populate(objectMap, "provisioningState", m.ProvisioningState) + populate(objectMap, "publicNetworkAccess", m.PublicNetworkAccess) + populate(objectMap, "sites", m.Sites) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MasterSiteProperties. +func (m *MasterSiteProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allowMultipleSites": + err = unpopulate(val, "AllowMultipleSites", &m.AllowMultipleSites) + delete(rawMsg, key) + case "customerStorageAccountArmId": + err = unpopulate(val, "CustomerStorageAccountArmID", &m.CustomerStorageAccountArmID) + delete(rawMsg, key) + case "nestedSites": + err = unpopulate(val, "NestedSites", &m.NestedSites) + delete(rawMsg, key) + case "privateEndpointConnections": + err = unpopulate(val, "PrivateEndpointConnections", &m.PrivateEndpointConnections) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &m.ProvisioningState) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &m.PublicNetworkAccess) + delete(rawMsg, key) + case "sites": + err = unpopulate(val, "Sites", &m.Sites) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MasterSiteUpdate. +func (m MasterSiteUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "tags", m.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MasterSiteUpdate. +func (m *MasterSiteUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &m.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MasterSiteUpdateProperties. +func (m MasterSiteUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "allowMultipleSites", m.AllowMultipleSites) + populate(objectMap, "customerStorageAccountArmId", m.CustomerStorageAccountArmID) + populate(objectMap, "publicNetworkAccess", m.PublicNetworkAccess) + populate(objectMap, "sites", m.Sites) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MasterSiteUpdateProperties. +func (m *MasterSiteUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allowMultipleSites": + err = unpopulate(val, "AllowMultipleSites", &m.AllowMultipleSites) + delete(rawMsg, key) + case "customerStorageAccountArmId": + err = unpopulate(val, "CustomerStorageAccountArmID", &m.CustomerStorageAccountArmID) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &m.PublicNetworkAccess) + delete(rawMsg, key) + case "sites": + err = unpopulate(val, "Sites", &m.Sites) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperatingSystem. +func (o OperatingSystem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "osArchitecture", o.OSArchitecture) + populate(objectMap, "osName", o.OSName) + populate(objectMap, "osType", o.OSType) + populate(objectMap, "osVersion", o.OSVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperatingSystem. +func (o *OperatingSystem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "osArchitecture": + err = unpopulate(val, "OSArchitecture", &o.OSArchitecture) + delete(rawMsg, key) + case "osName": + err = unpopulate(val, "OSName", &o.OSName) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &o.OSType) + delete(rawMsg, key) + case "osVersion": + err = unpopulate(val, "OSVersion", &o.OSVersion) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionType", o.ActionType) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionType": + err = unpopulate(val, "ActionType", &o.ActionType) + delete(rawMsg, key) + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationStatus. +func (o OperationStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "endTime", o.EndTime) + populate(objectMap, "error", o.Error) + populate(objectMap, "id", o.ID) + populate(objectMap, "name", o.Name) + populate(objectMap, "properties", o.Properties) + populate(objectMap, "startTime", o.StartTime) + populate(objectMap, "status", o.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatus. +func (o *OperationStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endTime": + err = unpopulate(val, "EndTime", &o.EndTime) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &o.Error) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &o.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + case "startTime": + err = unpopulate(val, "StartTime", &o.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &o.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationStatusError. +func (o OperationStatusError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", o.Code) + populate(objectMap, "message", o.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatusError. +func (o *OperationStatusError) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &o.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &o.Message) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationStatusProperties. +func (o OperationStatusProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "result", o.Result) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatusProperties. +func (o *OperationStatusProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "result": + err = unpopulate(val, "Result", &o.Result) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OracleDiscovery. +func (o OracleDiscovery) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "discoveryScopeStatus", o.DiscoveryScopeStatus) + populate(objectMap, "shallowDiscoveryStatus", o.ShallowDiscoveryStatus) + populate(objectMap, "totalDatabaseCount", o.TotalDatabaseCount) + populate(objectMap, "totalInstanceCount", o.TotalInstanceCount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OracleDiscovery. +func (o *OracleDiscovery) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "discoveryScopeStatus": + err = unpopulate(val, "DiscoveryScopeStatus", &o.DiscoveryScopeStatus) + delete(rawMsg, key) + case "shallowDiscoveryStatus": + err = unpopulate(val, "ShallowDiscoveryStatus", &o.ShallowDiscoveryStatus) + delete(rawMsg, key) + case "totalDatabaseCount": + err = unpopulate(val, "TotalDatabaseCount", &o.TotalDatabaseCount) + delete(rawMsg, key) + case "totalInstanceCount": + err = unpopulate(val, "TotalInstanceCount", &o.TotalInstanceCount) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OtherDatabase. +func (o OtherDatabase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "databaseType", o.DatabaseType) + populate(objectMap, "instance", o.Instance) + populate(objectMap, "version", o.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OtherDatabase. +func (o *OtherDatabase) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "databaseType": + err = unpopulate(val, "DatabaseType", &o.DatabaseType) + delete(rawMsg, key) + case "instance": + err = unpopulate(val, "Instance", &o.Instance) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &o.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PagedDeleteImportMachinesJob. +func (p PagedDeleteImportMachinesJob) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PagedDeleteImportMachinesJob. +func (p *PagedDeleteImportMachinesJob) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PagedExportImportedMachinesJob. +func (p PagedExportImportedMachinesJob) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PagedExportImportedMachinesJob. +func (p *PagedExportImportedMachinesJob) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PagedImportMachinesJob. +func (p PagedImportMachinesJob) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PagedImportMachinesJob. +func (p *PagedImportMachinesJob) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. +func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection. +func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult. +func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionListResult. +func (p *PrivateEndpointConnectionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionPropertiesV2. +func (p PrivateEndpointConnectionPropertiesV2) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "groupIds", p.GroupIDs) + populate(objectMap, "privateEndpoint", p.PrivateEndpoint) + populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) + populate(objectMap, "provisioningState", p.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionPropertiesV2. +func (p *PrivateEndpointConnectionPropertiesV2) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupIds": + err = unpopulate(val, "GroupIDs", &p.GroupIDs) + delete(rawMsg, key) + case "privateEndpoint": + err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) + delete(rawMsg, key) + case "privateLinkServiceConnectionState": + err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource. +func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResource. +func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult. +func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceListResult. +func (p *PrivateLinkResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. +func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "groupId", p.GroupID) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "requiredMembers", p.RequiredMembers) + populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceProperties. func (p *PrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupId": + err = unpopulate(val, "GroupID", &p.GroupID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + case "requiredMembers": + err = unpopulate(val, "RequiredMembers", &p.RequiredMembers) + delete(rawMsg, key) + case "requiredZoneNames": + err = unpopulate(val, "RequiredZoneNames", &p.RequiredZoneNames) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionState. +func (p PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionsRequired", p.ActionsRequired) + populate(objectMap, "description", p.Description) + populate(objectMap, "status", p.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnectionState. +func (p *PrivateLinkServiceConnectionState) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionsRequired": + err = unpopulate(val, "ActionsRequired", &p.ActionsRequired) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &p.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProcessorInfo. +func (p ProcessorInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", p.Name) + populate(objectMap, "numberOfCoresPerSocket", p.NumberOfCoresPerSocket) + populate(objectMap, "numberOfSockets", p.NumberOfSockets) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProcessorInfo. +func (p *ProcessorInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "numberOfCoresPerSocket": + err = unpopulate(val, "NumberOfCoresPerSocket", &p.NumberOfCoresPerSocket) + delete(rawMsg, key) + case "numberOfSockets": + err = unpopulate(val, "NumberOfSockets", &p.NumberOfSockets) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProductSupportStatus. +func (p ProductSupportStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "currentVersion", p.CurrentVersion) + populate(objectMap, "esuStatus", p.EsuStatus) + populate(objectMap, "esuYear", p.EsuYear) + populateDateTimeRFC3339(objectMap, "supportEndDate", p.SupportEndDate) + populate(objectMap, "supportStatus", p.SupportStatus) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProductSupportStatus. +func (p *ProductSupportStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "currentVersion": + err = unpopulate(val, "CurrentVersion", &p.CurrentVersion) + delete(rawMsg, key) + case "esuStatus": + err = unpopulate(val, "EsuStatus", &p.EsuStatus) + delete(rawMsg, key) + case "esuYear": + err = unpopulate(val, "EsuYear", &p.EsuYear) + delete(rawMsg, key) + case "supportEndDate": + err = unpopulateDateTimeRFC3339(val, "SupportEndDate", &p.SupportEndDate) + delete(rawMsg, key) + case "supportStatus": + err = unpopulate(val, "SupportStatus", &p.SupportStatus) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProxyResource. +func (p ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource. +func (p *ProxyResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProxySiteRefreshBody. +func (p ProxySiteRefreshBody) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "applianceName", p.ApplianceName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProxySiteRefreshBody. +func (p *ProxySiteRefreshBody) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "applianceName": + err = unpopulate(val, "ApplianceName", &p.ApplianceName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RequestExportMachineErrorsProperties. +func (r RequestExportMachineErrorsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "discoveryScope", r.DiscoveryScope) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RequestExportMachineErrorsProperties. +func (r *RequestExportMachineErrorsProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "discoveryScope": + err = unpopulate(val, "DiscoveryScope", &r.DiscoveryScope) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. +func (r *Resource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceID. +func (r ResourceID) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceID. +func (r *ResourceID) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RunAsAccountMachineInput. +func (r RunAsAccountMachineInput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "machineId", r.MachineID) + populate(objectMap, "runAsAccountId", r.RunAsAccountID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RunAsAccountMachineInput. +func (r *RunAsAccountMachineInput) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "machineId": + err = unpopulate(val, "MachineID", &r.MachineID) + delete(rawMsg, key) + case "runAsAccountId": + err = unpopulate(val, "RunAsAccountID", &r.RunAsAccountID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RunAsAccountProperties. +func (r RunAsAccountProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "applianceName", r.ApplianceName) + populate(objectMap, "createdTimestamp", r.CreatedTimestamp) + populate(objectMap, "credentialType", r.CredentialType) + populate(objectMap, "displayName", r.DisplayName) + populate(objectMap, "provisioningState", r.ProvisioningState) + populate(objectMap, "updatedTimestamp", r.UpdatedTimestamp) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RunAsAccountProperties. +func (r *RunAsAccountProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "applianceName": + err = unpopulate(val, "ApplianceName", &r.ApplianceName) + delete(rawMsg, key) + case "createdTimestamp": + err = unpopulate(val, "CreatedTimestamp", &r.CreatedTimestamp) + delete(rawMsg, key) + case "credentialType": + err = unpopulate(val, "CredentialType", &r.CredentialType) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &r.DisplayName) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) + delete(rawMsg, key) + case "updatedTimestamp": + err = unpopulate(val, "UpdatedTimestamp", &r.UpdatedTimestamp) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLAvailabilityGroup. +func (s SQLAvailabilityGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLAvailabilityGroup. +func (s *SQLAvailabilityGroup) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLAvailabilityGroupListResult. +func (s SQLAvailabilityGroupListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLAvailabilityGroupListResult. +func (s *SQLAvailabilityGroupListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLAvailabilityGroupProperties. +func (s SQLAvailabilityGroupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "availabilityGroupName", s.AvailabilityGroupName) + populate(objectMap, "availabilityGroupType", s.AvailabilityGroupType) + populate(objectMap, "availabilityReplicas", s.AvailabilityReplicas) + populate(objectMap, "clusterName", s.ClusterName) + populate(objectMap, "createdTimestamp", s.CreatedTimestamp) + populate(objectMap, "isDeleted", s.IsDeleted) + populate(objectMap, "isMultiSubNet", s.IsMultiSubNet) + populate(objectMap, "isPartOfDistributedAvailabilityGroup", s.IsPartOfDistributedAvailabilityGroup) + populate(objectMap, "parentReplicaOverviewList", s.ParentReplicaOverviewList) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "updatedTimestamp", s.UpdatedTimestamp) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLAvailabilityGroupProperties. +func (s *SQLAvailabilityGroupProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "availabilityGroupName": + err = unpopulate(val, "AvailabilityGroupName", &s.AvailabilityGroupName) + delete(rawMsg, key) + case "availabilityGroupType": + err = unpopulate(val, "AvailabilityGroupType", &s.AvailabilityGroupType) + delete(rawMsg, key) + case "availabilityReplicas": + err = unpopulate(val, "AvailabilityReplicas", &s.AvailabilityReplicas) + delete(rawMsg, key) + case "clusterName": + err = unpopulate(val, "ClusterName", &s.ClusterName) + delete(rawMsg, key) + case "createdTimestamp": + err = unpopulate(val, "CreatedTimestamp", &s.CreatedTimestamp) + delete(rawMsg, key) + case "isDeleted": + err = unpopulate(val, "IsDeleted", &s.IsDeleted) + delete(rawMsg, key) + case "isMultiSubNet": + err = unpopulate(val, "IsMultiSubNet", &s.IsMultiSubNet) + delete(rawMsg, key) + case "isPartOfDistributedAvailabilityGroup": + err = unpopulate(val, "IsPartOfDistributedAvailabilityGroup", &s.IsPartOfDistributedAvailabilityGroup) + delete(rawMsg, key) + case "parentReplicaOverviewList": + err = unpopulate(val, "ParentReplicaOverviewList", &s.ParentReplicaOverviewList) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "updatedTimestamp": + err = unpopulate(val, "UpdatedTimestamp", &s.UpdatedTimestamp) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLAvailabilityGroupReplicaInfo. +func (s SQLAvailabilityGroupReplicaInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "availabilityGroupArmId", s.AvailabilityGroupArmID) + populate(objectMap, "availabilityGroupName", s.AvailabilityGroupName) + populate(objectMap, "clusterName", s.ClusterName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLAvailabilityGroupReplicaInfo. +func (s *SQLAvailabilityGroupReplicaInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "availabilityGroupArmId": + err = unpopulate(val, "AvailabilityGroupArmID", &s.AvailabilityGroupArmID) + delete(rawMsg, key) + case "availabilityGroupName": + err = unpopulate(val, "AvailabilityGroupName", &s.AvailabilityGroupName) + delete(rawMsg, key) + case "clusterName": + err = unpopulate(val, "ClusterName", &s.ClusterName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLAvailabilityReplicaOverview. +func (s SQLAvailabilityReplicaOverview) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "availabilityGroupArmId", s.AvailabilityGroupArmID) + populate(objectMap, "availabilityGroupName", s.AvailabilityGroupName) + populate(objectMap, "availabilityReplicaId", s.AvailabilityReplicaID) + populate(objectMap, "replicaState", s.ReplicaState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLAvailabilityReplicaOverview. +func (s *SQLAvailabilityReplicaOverview) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "availabilityGroupArmId": + err = unpopulate(val, "AvailabilityGroupArmID", &s.AvailabilityGroupArmID) + delete(rawMsg, key) + case "availabilityGroupName": + err = unpopulate(val, "AvailabilityGroupName", &s.AvailabilityGroupName) + delete(rawMsg, key) + case "availabilityReplicaId": + err = unpopulate(val, "AvailabilityReplicaID", &s.AvailabilityReplicaID) + delete(rawMsg, key) + case "replicaState": + err = unpopulate(val, "ReplicaState", &s.ReplicaState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLAvailabilityReplicaProperties. +func (s SQLAvailabilityReplicaProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "availabilityReplicaId", s.AvailabilityReplicaID) + populate(objectMap, "availabilityReplicaName", s.AvailabilityReplicaName) + populate(objectMap, "replicaCommitMode", s.ReplicaCommitMode) + populate(objectMap, "replicaReadMode", s.ReplicaReadMode) + populate(objectMap, "replicaSeedMode", s.ReplicaSeedMode) + populate(objectMap, "replicaState", s.ReplicaState) + populate(objectMap, "replicaSyncStatus", s.ReplicaSyncStatus) + populate(objectMap, "replicaType", s.ReplicaType) + populate(objectMap, "sqlAvailabilityGroupReplicaInfo", s.SQLAvailabilityGroupReplicaInfo) + populate(objectMap, "sqlDatabaseReplicaInfo", s.SQLDatabaseReplicaInfo) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLAvailabilityReplicaProperties. +func (s *SQLAvailabilityReplicaProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "availabilityReplicaId": + err = unpopulate(val, "AvailabilityReplicaID", &s.AvailabilityReplicaID) + delete(rawMsg, key) + case "availabilityReplicaName": + err = unpopulate(val, "AvailabilityReplicaName", &s.AvailabilityReplicaName) + delete(rawMsg, key) + case "replicaCommitMode": + err = unpopulate(val, "ReplicaCommitMode", &s.ReplicaCommitMode) + delete(rawMsg, key) + case "replicaReadMode": + err = unpopulate(val, "ReplicaReadMode", &s.ReplicaReadMode) + delete(rawMsg, key) + case "replicaSeedMode": + err = unpopulate(val, "ReplicaSeedMode", &s.ReplicaSeedMode) + delete(rawMsg, key) + case "replicaState": + err = unpopulate(val, "ReplicaState", &s.ReplicaState) + delete(rawMsg, key) + case "replicaSyncStatus": + err = unpopulate(val, "ReplicaSyncStatus", &s.ReplicaSyncStatus) + delete(rawMsg, key) + case "replicaType": + err = unpopulate(val, "ReplicaType", &s.ReplicaType) + delete(rawMsg, key) + case "sqlAvailabilityGroupReplicaInfo": + err = unpopulate(val, "SQLAvailabilityGroupReplicaInfo", &s.SQLAvailabilityGroupReplicaInfo) + delete(rawMsg, key) + case "sqlDatabaseReplicaInfo": + err = unpopulate(val, "SQLDatabaseReplicaInfo", &s.SQLDatabaseReplicaInfo) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLDatabasePropertiesV2. +func (s SQLDatabasePropertiesV2) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "compatibilityLevel", s.CompatibilityLevel) + populate(objectMap, "createdTimestamp", s.CreatedTimestamp) + populate(objectMap, "databaseName", s.DatabaseName) + populate(objectMap, "errors", s.Errors) + populate(objectMap, "fileMetadataList", s.FileMetadataList) + populate(objectMap, "hostname", s.Hostname) + populate(objectMap, "isDatabaseHighlyAvailable", s.IsDatabaseHighlyAvailable) + populate(objectMap, "isDeleted", s.IsDeleted) + populate(objectMap, "parentReplicaOverview", s.ParentReplicaOverview) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "sqlServerArmId", s.SQLServerArmID) + populate(objectMap, "sqlServerName", s.SQLServerName) + populate(objectMap, "sizeMb", s.SizeMb) + populate(objectMap, "status", s.Status) + populate(objectMap, "updatedTimestamp", s.UpdatedTimestamp) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLDatabasePropertiesV2. +func (s *SQLDatabasePropertiesV2) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "compatibilityLevel": + err = unpopulate(val, "CompatibilityLevel", &s.CompatibilityLevel) + delete(rawMsg, key) + case "createdTimestamp": + err = unpopulate(val, "CreatedTimestamp", &s.CreatedTimestamp) + delete(rawMsg, key) + case "databaseName": + err = unpopulate(val, "DatabaseName", &s.DatabaseName) + delete(rawMsg, key) + case "errors": + err = unpopulate(val, "Errors", &s.Errors) + delete(rawMsg, key) + case "fileMetadataList": + err = unpopulate(val, "FileMetadataList", &s.FileMetadataList) + delete(rawMsg, key) + case "hostname": + err = unpopulate(val, "Hostname", &s.Hostname) + delete(rawMsg, key) + case "isDatabaseHighlyAvailable": + err = unpopulate(val, "IsDatabaseHighlyAvailable", &s.IsDatabaseHighlyAvailable) + delete(rawMsg, key) + case "isDeleted": + err = unpopulate(val, "IsDeleted", &s.IsDeleted) + delete(rawMsg, key) + case "parentReplicaOverview": + err = unpopulate(val, "ParentReplicaOverview", &s.ParentReplicaOverview) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "sqlServerArmId": + err = unpopulate(val, "SQLServerArmID", &s.SQLServerArmID) + delete(rawMsg, key) + case "sqlServerName": + err = unpopulate(val, "SQLServerName", &s.SQLServerName) + delete(rawMsg, key) + case "sizeMb": + err = unpopulate(val, "SizeMb", &s.SizeMb) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &s.Status) + delete(rawMsg, key) + case "updatedTimestamp": + err = unpopulate(val, "UpdatedTimestamp", &s.UpdatedTimestamp) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLDatabaseReplicaInfo. +func (s SQLDatabaseReplicaInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "hostName", s.HostName) + populate(objectMap, "sqlServerArmId", s.SQLServerArmID) + populate(objectMap, "sqlServerName", s.SQLServerName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLDatabaseReplicaInfo. +func (s *SQLDatabaseReplicaInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "hostName": + err = unpopulate(val, "HostName", &s.HostName) + delete(rawMsg, key) + case "sqlServerArmId": + err = unpopulate(val, "SQLServerArmID", &s.SQLServerArmID) + delete(rawMsg, key) + case "sqlServerName": + err = unpopulate(val, "SQLServerName", &s.SQLServerName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLDatabaseV2. +func (s SQLDatabaseV2) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLDatabaseV2. +func (s *SQLDatabaseV2) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLDatabaseV2ListResult. +func (s SQLDatabaseV2ListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLDatabaseV2ListResult. +func (s *SQLDatabaseV2ListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLDiscovery. +func (s SQLDiscovery) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "discoveryScopeStatus", s.DiscoveryScopeStatus) + populate(objectMap, "sqlMetadataDiscoveryPipe", s.SQLMetadataDiscoveryPipe) + populate(objectMap, "sqlMetadataHydratedRunAsAccountId", s.SQLMetadataHydratedRunAsAccountID) + populate(objectMap, "successfullyDiscoveredServerCount", s.SuccessfullyDiscoveredServerCount) + populate(objectMap, "totalServerCount", s.TotalServerCount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLDiscovery. +func (s *SQLDiscovery) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "discoveryScopeStatus": + err = unpopulate(val, "DiscoveryScopeStatus", &s.DiscoveryScopeStatus) + delete(rawMsg, key) + case "sqlMetadataDiscoveryPipe": + err = unpopulate(val, "SQLMetadataDiscoveryPipe", &s.SQLMetadataDiscoveryPipe) + delete(rawMsg, key) + case "sqlMetadataHydratedRunAsAccountId": + err = unpopulate(val, "SQLMetadataHydratedRunAsAccountID", &s.SQLMetadataHydratedRunAsAccountID) + delete(rawMsg, key) + case "successfullyDiscoveredServerCount": + err = unpopulate(val, "SuccessfullyDiscoveredServerCount", &s.SuccessfullyDiscoveredServerCount) + delete(rawMsg, key) + case "totalServerCount": + err = unpopulate(val, "TotalServerCount", &s.TotalServerCount) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLDiscoverySiteDataSource. +func (s SQLDiscoverySiteDataSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLDiscoverySiteDataSource. +func (s *SQLDiscoverySiteDataSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLDiscoverySiteDataSourceListResult. +func (s SQLDiscoverySiteDataSourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLDiscoverySiteDataSourceListResult. +func (s *SQLDiscoverySiteDataSourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLDiscoverySiteDataSourceProperties. +func (s SQLDiscoverySiteDataSourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "discoverySiteId", s.DiscoverySiteID) + populate(objectMap, "provisioningState", s.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLDiscoverySiteDataSourceProperties. +func (s *SQLDiscoverySiteDataSourceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "discoverySiteId": + err = unpopulate(val, "DiscoverySiteID", &s.DiscoverySiteID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLFciProperties. +func (s SQLFciProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "isMultiSubnet", s.IsMultiSubnet) + populate(objectMap, "networkName", s.NetworkName) + populate(objectMap, "sharedDiskCount", s.SharedDiskCount) + populate(objectMap, "state", s.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLFciProperties. +func (s *SQLFciProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "isMultiSubnet": + err = unpopulate(val, "IsMultiSubnet", &s.IsMultiSubnet) + delete(rawMsg, key) + case "networkName": + err = unpopulate(val, "NetworkName", &s.NetworkName) + delete(rawMsg, key) + case "sharedDiskCount": + err = unpopulate(val, "SharedDiskCount", &s.SharedDiskCount) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &s.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLJob. +func (s SQLJob) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLJob. +func (s *SQLJob) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLJobListResult. +func (s SQLJobListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLJobListResult. +func (s *SQLJobListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLMachineOverview. +func (s SQLMachineOverview) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "displayName", s.DisplayName) + populate(objectMap, "fciRole", s.FciRole) + populate(objectMap, "machineArmId", s.MachineArmID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLMachineOverview. +func (s *SQLMachineOverview) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "displayName": + err = unpopulate(val, "DisplayName", &s.DisplayName) + delete(rawMsg, key) + case "fciRole": + err = unpopulate(val, "FciRole", &s.FciRole) + delete(rawMsg, key) + case "machineArmId": + err = unpopulate(val, "MachineArmID", &s.MachineArmID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLRunAsAccount. +func (s SQLRunAsAccount) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLRunAsAccount. +func (s *SQLRunAsAccount) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLRunAsAccountListResult. +func (s SQLRunAsAccountListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLRunAsAccountListResult. +func (s *SQLRunAsAccountListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLServerApplication. +func (s SQLServerApplication) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clusterName", s.ClusterName) + populate(objectMap, "clustered", s.Clustered) + populate(objectMap, "commaSeparatedIps", s.CommaSeparatedIPs) + populate(objectMap, "dnsHostName", s.DNSHostName) + populate(objectMap, "edition", s.Edition) + populate(objectMap, "isNamedPipeEnabled", s.IsNamedPipeEnabled) + populate(objectMap, "isTcpIpEnabled", s.IsTCPIPEnabled) + populate(objectMap, "name", s.Name) + populate(objectMap, "namedPipeName", s.NamedPipeName) + populate(objectMap, "port", s.Port) + populate(objectMap, "servicePack", s.ServicePack) + populate(objectMap, "status", s.Status) + populate(objectMap, "version", s.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLServerApplication. +func (s *SQLServerApplication) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clusterName": + err = unpopulate(val, "ClusterName", &s.ClusterName) + delete(rawMsg, key) + case "clustered": + err = unpopulate(val, "Clustered", &s.Clustered) + delete(rawMsg, key) + case "commaSeparatedIps": + err = unpopulate(val, "CommaSeparatedIPs", &s.CommaSeparatedIPs) + delete(rawMsg, key) + case "dnsHostName": + err = unpopulate(val, "DNSHostName", &s.DNSHostName) + delete(rawMsg, key) + case "edition": + err = unpopulate(val, "Edition", &s.Edition) + delete(rawMsg, key) + case "isNamedPipeEnabled": + err = unpopulate(val, "IsNamedPipeEnabled", &s.IsNamedPipeEnabled) + delete(rawMsg, key) + case "isTcpIpEnabled": + err = unpopulate(val, "IsTCPIPEnabled", &s.IsTCPIPEnabled) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "namedPipeName": + err = unpopulate(val, "NamedPipeName", &s.NamedPipeName) + delete(rawMsg, key) + case "port": + err = unpopulate(val, "Port", &s.Port) + delete(rawMsg, key) + case "servicePack": + err = unpopulate(val, "ServicePack", &s.ServicePack) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &s.Status) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &s.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLServerProperties. +func (s SQLServerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "createdTimestamp", s.CreatedTimestamp) + populate(objectMap, "edition", s.Edition) + populate(objectMap, "engineEdition", s.EngineEdition) + populate(objectMap, "errors", s.Errors) + populate(objectMap, "hostName", s.HostName) + populate(objectMap, "hydratedRunAsAccountId", s.HydratedRunAsAccountID) + populate(objectMap, "hyperthreadRatio", s.HyperthreadRatio) + populate(objectMap, "isClustered", s.IsClustered) + populate(objectMap, "isDeleted", s.IsDeleted) + populate(objectMap, "isHighAvailabilityEnabled", s.IsHighAvailabilityEnabled) + populate(objectMap, "logicalCpuCount", s.LogicalCPUCount) + populate(objectMap, "machineArmIds", s.MachineArmIDs) + populate(objectMap, "machineOverviewList", s.MachineOverviewList) + populate(objectMap, "maxServerMemoryInUseInMb", s.MaxServerMemoryInUseInMb) + populate(objectMap, "numOfLogins", s.NumOfLogins) + populate(objectMap, "numberOfAgDatabases", s.NumberOfAgDatabases) + populate(objectMap, "numberOfUserDatabases", s.NumberOfUserDatabases) + populate(objectMap, "physicalCpuCount", s.PhysicalCPUCount) + populate(objectMap, "portNumber", s.PortNumber) + populate(objectMap, "productSupportStatus", s.ProductSupportStatus) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "runAsAccountId", s.RunAsAccountID) + populate(objectMap, "sqlFciProperties", s.SQLFciProperties) + populate(objectMap, "sqlServerName", s.SQLServerName) + populateDateTimeRFC3339(objectMap, "sqlStartTime", s.SQLStartTime) + populate(objectMap, "status", s.Status) + populate(objectMap, "sumOfUserDatabasesSizeInMb", s.SumOfUserDatabasesSizeInMb) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "tempDbSizeInMb", s.TempDbSizeInMb) + populate(objectMap, "updatedTimestamp", s.UpdatedTimestamp) + populate(objectMap, "version", s.Version) + populate(objectMap, "visibleOnlineCoreCount", s.VisibleOnlineCoreCount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLServerProperties. +func (s *SQLServerProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdTimestamp": + err = unpopulate(val, "CreatedTimestamp", &s.CreatedTimestamp) + delete(rawMsg, key) + case "edition": + err = unpopulate(val, "Edition", &s.Edition) + delete(rawMsg, key) + case "engineEdition": + err = unpopulate(val, "EngineEdition", &s.EngineEdition) + delete(rawMsg, key) + case "errors": + err = unpopulate(val, "Errors", &s.Errors) + delete(rawMsg, key) + case "hostName": + err = unpopulate(val, "HostName", &s.HostName) + delete(rawMsg, key) + case "hydratedRunAsAccountId": + err = unpopulate(val, "HydratedRunAsAccountID", &s.HydratedRunAsAccountID) + delete(rawMsg, key) + case "hyperthreadRatio": + err = unpopulate(val, "HyperthreadRatio", &s.HyperthreadRatio) + delete(rawMsg, key) + case "isClustered": + err = unpopulate(val, "IsClustered", &s.IsClustered) + delete(rawMsg, key) + case "isDeleted": + err = unpopulate(val, "IsDeleted", &s.IsDeleted) + delete(rawMsg, key) + case "isHighAvailabilityEnabled": + err = unpopulate(val, "IsHighAvailabilityEnabled", &s.IsHighAvailabilityEnabled) + delete(rawMsg, key) + case "logicalCpuCount": + err = unpopulate(val, "LogicalCPUCount", &s.LogicalCPUCount) + delete(rawMsg, key) + case "machineArmIds": + err = unpopulate(val, "MachineArmIDs", &s.MachineArmIDs) + delete(rawMsg, key) + case "machineOverviewList": + err = unpopulate(val, "MachineOverviewList", &s.MachineOverviewList) + delete(rawMsg, key) + case "maxServerMemoryInUseInMb": + err = unpopulate(val, "MaxServerMemoryInUseInMb", &s.MaxServerMemoryInUseInMb) + delete(rawMsg, key) + case "numOfLogins": + err = unpopulate(val, "NumOfLogins", &s.NumOfLogins) + delete(rawMsg, key) + case "numberOfAgDatabases": + err = unpopulate(val, "NumberOfAgDatabases", &s.NumberOfAgDatabases) + delete(rawMsg, key) + case "numberOfUserDatabases": + err = unpopulate(val, "NumberOfUserDatabases", &s.NumberOfUserDatabases) + delete(rawMsg, key) + case "physicalCpuCount": + err = unpopulate(val, "PhysicalCPUCount", &s.PhysicalCPUCount) + delete(rawMsg, key) + case "portNumber": + err = unpopulate(val, "PortNumber", &s.PortNumber) + delete(rawMsg, key) + case "productSupportStatus": + err = unpopulate(val, "ProductSupportStatus", &s.ProductSupportStatus) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "runAsAccountId": + err = unpopulate(val, "RunAsAccountID", &s.RunAsAccountID) + delete(rawMsg, key) + case "sqlFciProperties": + err = unpopulate(val, "SQLFciProperties", &s.SQLFciProperties) + delete(rawMsg, key) + case "sqlServerName": + err = unpopulate(val, "SQLServerName", &s.SQLServerName) + delete(rawMsg, key) + case "sqlStartTime": + err = unpopulateDateTimeRFC3339(val, "SQLStartTime", &s.SQLStartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &s.Status) + delete(rawMsg, key) + case "sumOfUserDatabasesSizeInMb": + err = unpopulate(val, "SumOfUserDatabasesSizeInMb", &s.SumOfUserDatabasesSizeInMb) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) + case "tempDbSizeInMb": + err = unpopulate(val, "TempDbSizeInMb", &s.TempDbSizeInMb) + delete(rawMsg, key) + case "updatedTimestamp": + err = unpopulate(val, "UpdatedTimestamp", &s.UpdatedTimestamp) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &s.Version) + delete(rawMsg, key) + case "visibleOnlineCoreCount": + err = unpopulate(val, "VisibleOnlineCoreCount", &s.VisibleOnlineCoreCount) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLServerV2. +func (s SQLServerV2) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLServerV2. +func (s *SQLServerV2) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLServerV2ListResult. +func (s SQLServerV2ListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLServerV2ListResult. +func (s *SQLServerV2ListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLServerV2Update. +func (s SQLServerV2Update) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", s.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLServerV2Update. +func (s *SQLServerV2Update) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLServerV2UpdateProperties. +func (s SQLServerV2UpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "createdTimestamp", s.CreatedTimestamp) + populate(objectMap, "edition", s.Edition) + populate(objectMap, "engineEdition", s.EngineEdition) + populate(objectMap, "hostName", s.HostName) + populate(objectMap, "hydratedRunAsAccountId", s.HydratedRunAsAccountID) + populate(objectMap, "hyperthreadRatio", s.HyperthreadRatio) + populate(objectMap, "isClustered", s.IsClustered) + populate(objectMap, "isDeleted", s.IsDeleted) + populate(objectMap, "isHighAvailabilityEnabled", s.IsHighAvailabilityEnabled) + populate(objectMap, "logicalCpuCount", s.LogicalCPUCount) + populate(objectMap, "maxServerMemoryInUseInMb", s.MaxServerMemoryInUseInMb) + populate(objectMap, "numOfLogins", s.NumOfLogins) + populate(objectMap, "numberOfAgDatabases", s.NumberOfAgDatabases) + populate(objectMap, "numberOfUserDatabases", s.NumberOfUserDatabases) + populate(objectMap, "physicalCpuCount", s.PhysicalCPUCount) + populate(objectMap, "portNumber", s.PortNumber) + populate(objectMap, "productSupportStatus", s.ProductSupportStatus) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "runAsAccountId", s.RunAsAccountID) + populate(objectMap, "sqlFciProperties", s.SQLFciProperties) + populate(objectMap, "sqlServerName", s.SQLServerName) + populateDateTimeRFC3339(objectMap, "sqlStartTime", s.SQLStartTime) + populate(objectMap, "status", s.Status) + populate(objectMap, "sumOfUserDatabasesSizeInMb", s.SumOfUserDatabasesSizeInMb) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "tempDbSizeInMb", s.TempDbSizeInMb) + populate(objectMap, "updatedTimestamp", s.UpdatedTimestamp) + populate(objectMap, "version", s.Version) + populate(objectMap, "visibleOnlineCoreCount", s.VisibleOnlineCoreCount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLServerV2UpdateProperties. +func (s *SQLServerV2UpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdTimestamp": + err = unpopulate(val, "CreatedTimestamp", &s.CreatedTimestamp) + delete(rawMsg, key) + case "edition": + err = unpopulate(val, "Edition", &s.Edition) + delete(rawMsg, key) + case "engineEdition": + err = unpopulate(val, "EngineEdition", &s.EngineEdition) + delete(rawMsg, key) + case "hostName": + err = unpopulate(val, "HostName", &s.HostName) + delete(rawMsg, key) + case "hydratedRunAsAccountId": + err = unpopulate(val, "HydratedRunAsAccountID", &s.HydratedRunAsAccountID) + delete(rawMsg, key) + case "hyperthreadRatio": + err = unpopulate(val, "HyperthreadRatio", &s.HyperthreadRatio) + delete(rawMsg, key) + case "isClustered": + err = unpopulate(val, "IsClustered", &s.IsClustered) + delete(rawMsg, key) + case "isDeleted": + err = unpopulate(val, "IsDeleted", &s.IsDeleted) + delete(rawMsg, key) + case "isHighAvailabilityEnabled": + err = unpopulate(val, "IsHighAvailabilityEnabled", &s.IsHighAvailabilityEnabled) + delete(rawMsg, key) + case "logicalCpuCount": + err = unpopulate(val, "LogicalCPUCount", &s.LogicalCPUCount) + delete(rawMsg, key) + case "maxServerMemoryInUseInMb": + err = unpopulate(val, "MaxServerMemoryInUseInMb", &s.MaxServerMemoryInUseInMb) + delete(rawMsg, key) + case "numOfLogins": + err = unpopulate(val, "NumOfLogins", &s.NumOfLogins) + delete(rawMsg, key) + case "numberOfAgDatabases": + err = unpopulate(val, "NumberOfAgDatabases", &s.NumberOfAgDatabases) + delete(rawMsg, key) + case "numberOfUserDatabases": + err = unpopulate(val, "NumberOfUserDatabases", &s.NumberOfUserDatabases) + delete(rawMsg, key) + case "physicalCpuCount": + err = unpopulate(val, "PhysicalCPUCount", &s.PhysicalCPUCount) + delete(rawMsg, key) + case "portNumber": + err = unpopulate(val, "PortNumber", &s.PortNumber) + delete(rawMsg, key) + case "productSupportStatus": + err = unpopulate(val, "ProductSupportStatus", &s.ProductSupportStatus) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "runAsAccountId": + err = unpopulate(val, "RunAsAccountID", &s.RunAsAccountID) + delete(rawMsg, key) + case "sqlFciProperties": + err = unpopulate(val, "SQLFciProperties", &s.SQLFciProperties) + delete(rawMsg, key) + case "sqlServerName": + err = unpopulate(val, "SQLServerName", &s.SQLServerName) + delete(rawMsg, key) + case "sqlStartTime": + err = unpopulateDateTimeRFC3339(val, "SQLStartTime", &s.SQLStartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &s.Status) + delete(rawMsg, key) + case "sumOfUserDatabasesSizeInMb": + err = unpopulate(val, "SumOfUserDatabasesSizeInMb", &s.SumOfUserDatabasesSizeInMb) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) + case "tempDbSizeInMb": + err = unpopulate(val, "TempDbSizeInMb", &s.TempDbSizeInMb) + delete(rawMsg, key) + case "updatedTimestamp": + err = unpopulate(val, "UpdatedTimestamp", &s.UpdatedTimestamp) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &s.Version) + delete(rawMsg, key) + case "visibleOnlineCoreCount": + err = unpopulate(val, "VisibleOnlineCoreCount", &s.VisibleOnlineCoreCount) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLSite. +func (s SQLSite) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLSite. +func (s *SQLSite) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLSiteListResult. +func (s SQLSiteListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLSiteListResult. +func (s *SQLSiteListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLSiteProperties. +func (s SQLSiteProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "discoveryScenario", s.DiscoveryScenario) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "serviceEndpoint", s.ServiceEndpoint) + populate(objectMap, "siteAppliancePropertiesCollection", s.SiteAppliancePropertiesCollection) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLSiteProperties. +func (s *SQLSiteProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "discoveryScenario": + err = unpopulate(val, "DiscoveryScenario", &s.DiscoveryScenario) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "serviceEndpoint": + err = unpopulate(val, "ServiceEndpoint", &s.ServiceEndpoint) + delete(rawMsg, key) + case "siteAppliancePropertiesCollection": + err = unpopulate(val, "SiteAppliancePropertiesCollection", &s.SiteAppliancePropertiesCollection) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLSiteRefreshBody. +func (s SQLSiteRefreshBody) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "applianceName", s.ApplianceName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLSiteRefreshBody. +func (s *SQLSiteRefreshBody) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "applianceName": + err = unpopulate(val, "ApplianceName", &s.ApplianceName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLSiteUpdate. +func (s SQLSiteUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", s.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLSiteUpdate. +func (s *SQLSiteUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLSiteUpdateProperties. +func (s SQLSiteUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "discoveryScenario", s.DiscoveryScenario) + populate(objectMap, "siteAppliancePropertiesCollection", s.SiteAppliancePropertiesCollection) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLSiteUpdateProperties. +func (s *SQLSiteUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "discoveryScenario": + err = unpopulate(val, "DiscoveryScenario", &s.DiscoveryScenario) + delete(rawMsg, key) + case "siteAppliancePropertiesCollection": + err = unpopulate(val, "SiteAppliancePropertiesCollection", &s.SiteAppliancePropertiesCollection) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLSiteUsage. +func (s SQLSiteUsage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "databaseCount", s.DatabaseCount) + populate(objectMap, "runAsAccountCount", s.RunAsAccountCount) + populate(objectMap, "serverCount", s.ServerCount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLSiteUsage. +func (s *SQLSiteUsage) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "databaseCount": + err = unpopulate(val, "DatabaseCount", &s.DatabaseCount) + delete(rawMsg, key) + case "runAsAccountCount": + err = unpopulate(val, "RunAsAccountCount", &s.RunAsAccountCount) + delete(rawMsg, key) + case "serverCount": + err = unpopulate(val, "ServerCount", &s.ServerCount) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SasURIResponse. +func (s SasURIResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "importType", s.ImportType) + populate(objectMap, "jobArmId", s.JobArmID) + populate(objectMap, "uri", s.URI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SasURIResponse. +func (s *SasURIResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "importType": + err = unpopulate(val, "ImportType", &s.ImportType) + delete(rawMsg, key) + case "jobArmId": + err = unpopulate(val, "JobArmID", &s.JobArmID) + delete(rawMsg, key) + case "uri": + err = unpopulate(val, "URI", &s.URI) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Server. +func (s Server) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Server. +func (s *Server) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServerDisk. +func (s ServerDisk) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "diskType", s.DiskType) + populate(objectMap, "generatedId", s.GeneratedID) + populate(objectMap, "id", s.ID) + populate(objectMap, "lun", s.Lun) + populate(objectMap, "maxSizeInBytes", s.MaxSizeInBytes) + populate(objectMap, "name", s.Name) + populate(objectMap, "path", s.Path) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerDisk. +func (s *ServerDisk) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "diskType": + err = unpopulate(val, "DiskType", &s.DiskType) + delete(rawMsg, key) + case "generatedId": + err = unpopulate(val, "GeneratedID", &s.GeneratedID) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "lun": + err = unpopulate(val, "Lun", &s.Lun) + delete(rawMsg, key) + case "maxSizeInBytes": + err = unpopulate(val, "MaxSizeInBytes", &s.MaxSizeInBytes) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "path": + err = unpopulate(val, "Path", &s.Path) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServerJob. +func (s ServerJob) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerJob. +func (s *ServerJob) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServerJobListResult. +func (s ServerJobListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerJobListResult. +func (s *ServerJobListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServerListResult. +func (s ServerListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerListResult. +func (s *ServerListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServerNetworkAdapter. +func (s ServerNetworkAdapter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "ipAddressList", s.IPAddressList) + populate(objectMap, "ipAddressType", s.IPAddressType) + populate(objectMap, "macAddress", s.MacAddress) + populate(objectMap, "networkName", s.NetworkName) + populate(objectMap, "nicId", s.NicID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerNetworkAdapter. +func (s *ServerNetworkAdapter) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ipAddressList": + err = unpopulate(val, "IPAddressList", &s.IPAddressList) + delete(rawMsg, key) + case "ipAddressType": + err = unpopulate(val, "IPAddressType", &s.IPAddressType) + delete(rawMsg, key) + case "macAddress": + err = unpopulate(val, "MacAddress", &s.MacAddress) + delete(rawMsg, key) + case "networkName": + err = unpopulate(val, "NetworkName", &s.NetworkName) + delete(rawMsg, key) + case "nicId": + err = unpopulate(val, "NicID", &s.NicID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServerProperties. +func (s ServerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "allocatedMemoryInMb", s.AllocatedMemoryInMb) + populate(objectMap, "applianceNames", s.ApplianceNames) + populate(objectMap, "applicationDiscovery", s.ApplicationDiscovery) + populate(objectMap, "appsAndRoles", s.AppsAndRoles) + populate(objectMap, "biosGuid", s.BiosGUID) + populate(objectMap, "biosSerialNumber", s.BiosSerialNumber) + populate(objectMap, "createdTimestamp", s.CreatedTimestamp) + populate(objectMap, "dependencyMapDiscovery", s.DependencyMapDiscovery) + populate(objectMap, "dependencyMapping", s.DependencyMapping) + populate(objectMap, "dependencyMappingEndTime", s.DependencyMappingEndTime) + populateDateTimeRFC3339(objectMap, "dependencyMappingStartTime", s.DependencyMappingStartTime) + populate(objectMap, "disks", s.Disks) + populate(objectMap, "displayName", s.DisplayName) + populate(objectMap, "errors", s.Errors) + populate(objectMap, "firmware", s.Firmware) + populate(objectMap, "fqdn", s.Fqdn) + populateDateTimeRFC3339(objectMap, "guestDetailsDiscoveryTimestamp", s.GuestDetailsDiscoveryTimestamp) + populate(objectMap, "guestOsDetails", s.GuestOsDetails) + populate(objectMap, "hydratedFqdn", s.HydratedFqdn) + populate(objectMap, "iisDiscovery", s.IisDiscovery) + populate(objectMap, "isDeleted", s.IsDeleted) + populate(objectMap, "isGuestDetailsDiscoveryInProgress", s.IsGuestDetailsDiscoveryInProgress) + populate(objectMap, "networkAdapters", s.NetworkAdapters) + populate(objectMap, "numberOfApplications", s.NumberOfApplications) + populate(objectMap, "numberOfProcessorCore", s.NumberOfProcessorCore) + populate(objectMap, "operatingSystemDetails", s.OperatingSystemDetails) + populate(objectMap, "oracleDiscovery", s.OracleDiscovery) + populate(objectMap, "processorInfo", s.ProcessorInfo) + populate(objectMap, "productSupportStatus", s.ProductSupportStatus) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "runAsAccountId", s.RunAsAccountID) + populate(objectMap, "sqlDiscovery", s.SQLDiscovery) + populate(objectMap, "springBootDiscovery", s.SpringBootDiscovery) + populate(objectMap, "staticDiscovery", s.StaticDiscovery) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "tomcatDiscovery", s.TomcatDiscovery) + populate(objectMap, "updatedTimestamp", s.UpdatedTimestamp) + populate(objectMap, "validationRequired", s.ValidationRequired) + populate(objectMap, "webAppDiscovery", s.WebAppDiscovery) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerProperties. +func (s *ServerProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allocatedMemoryInMb": + err = unpopulate(val, "AllocatedMemoryInMb", &s.AllocatedMemoryInMb) + delete(rawMsg, key) + case "applianceNames": + err = unpopulate(val, "ApplianceNames", &s.ApplianceNames) + delete(rawMsg, key) + case "applicationDiscovery": + err = unpopulate(val, "ApplicationDiscovery", &s.ApplicationDiscovery) + delete(rawMsg, key) + case "appsAndRoles": + err = unpopulate(val, "AppsAndRoles", &s.AppsAndRoles) + delete(rawMsg, key) + case "biosGuid": + err = unpopulate(val, "BiosGUID", &s.BiosGUID) + delete(rawMsg, key) + case "biosSerialNumber": + err = unpopulate(val, "BiosSerialNumber", &s.BiosSerialNumber) + delete(rawMsg, key) + case "createdTimestamp": + err = unpopulate(val, "CreatedTimestamp", &s.CreatedTimestamp) + delete(rawMsg, key) + case "dependencyMapDiscovery": + err = unpopulate(val, "DependencyMapDiscovery", &s.DependencyMapDiscovery) + delete(rawMsg, key) + case "dependencyMapping": + err = unpopulate(val, "DependencyMapping", &s.DependencyMapping) + delete(rawMsg, key) + case "dependencyMappingEndTime": + err = unpopulate(val, "DependencyMappingEndTime", &s.DependencyMappingEndTime) + delete(rawMsg, key) + case "dependencyMappingStartTime": + err = unpopulateDateTimeRFC3339(val, "DependencyMappingStartTime", &s.DependencyMappingStartTime) + delete(rawMsg, key) + case "disks": + err = unpopulate(val, "Disks", &s.Disks) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &s.DisplayName) + delete(rawMsg, key) + case "errors": + err = unpopulate(val, "Errors", &s.Errors) + delete(rawMsg, key) + case "firmware": + err = unpopulate(val, "Firmware", &s.Firmware) + delete(rawMsg, key) + case "fqdn": + err = unpopulate(val, "Fqdn", &s.Fqdn) + delete(rawMsg, key) + case "guestDetailsDiscoveryTimestamp": + err = unpopulateDateTimeRFC3339(val, "GuestDetailsDiscoveryTimestamp", &s.GuestDetailsDiscoveryTimestamp) + delete(rawMsg, key) + case "guestOsDetails": + err = unpopulate(val, "GuestOsDetails", &s.GuestOsDetails) + delete(rawMsg, key) + case "hydratedFqdn": + err = unpopulate(val, "HydratedFqdn", &s.HydratedFqdn) + delete(rawMsg, key) + case "iisDiscovery": + err = unpopulate(val, "IisDiscovery", &s.IisDiscovery) + delete(rawMsg, key) + case "isDeleted": + err = unpopulate(val, "IsDeleted", &s.IsDeleted) + delete(rawMsg, key) + case "isGuestDetailsDiscoveryInProgress": + err = unpopulate(val, "IsGuestDetailsDiscoveryInProgress", &s.IsGuestDetailsDiscoveryInProgress) + delete(rawMsg, key) + case "networkAdapters": + err = unpopulate(val, "NetworkAdapters", &s.NetworkAdapters) + delete(rawMsg, key) + case "numberOfApplications": + err = unpopulate(val, "NumberOfApplications", &s.NumberOfApplications) + delete(rawMsg, key) + case "numberOfProcessorCore": + err = unpopulate(val, "NumberOfProcessorCore", &s.NumberOfProcessorCore) + delete(rawMsg, key) + case "operatingSystemDetails": + err = unpopulate(val, "OperatingSystemDetails", &s.OperatingSystemDetails) + delete(rawMsg, key) + case "oracleDiscovery": + err = unpopulate(val, "OracleDiscovery", &s.OracleDiscovery) + delete(rawMsg, key) + case "processorInfo": + err = unpopulate(val, "ProcessorInfo", &s.ProcessorInfo) + delete(rawMsg, key) + case "productSupportStatus": + err = unpopulate(val, "ProductSupportStatus", &s.ProductSupportStatus) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "runAsAccountId": + err = unpopulate(val, "RunAsAccountID", &s.RunAsAccountID) + delete(rawMsg, key) + case "sqlDiscovery": + err = unpopulate(val, "SQLDiscovery", &s.SQLDiscovery) + delete(rawMsg, key) + case "springBootDiscovery": + err = unpopulate(val, "SpringBootDiscovery", &s.SpringBootDiscovery) + delete(rawMsg, key) + case "staticDiscovery": + err = unpopulate(val, "StaticDiscovery", &s.StaticDiscovery) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) + case "tomcatDiscovery": + err = unpopulate(val, "TomcatDiscovery", &s.TomcatDiscovery) + delete(rawMsg, key) + case "updatedTimestamp": + err = unpopulate(val, "UpdatedTimestamp", &s.UpdatedTimestamp) + delete(rawMsg, key) + case "validationRequired": + err = unpopulate(val, "ValidationRequired", &s.ValidationRequired) + delete(rawMsg, key) + case "webAppDiscovery": + err = unpopulate(val, "WebAppDiscovery", &s.WebAppDiscovery) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServerRunAsAccount. +func (s ServerRunAsAccount) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerRunAsAccount. +func (s *ServerRunAsAccount) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServerRunAsAccountListResult. +func (s ServerRunAsAccountListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerRunAsAccountListResult. +func (s *ServerRunAsAccountListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServerSiteResource. +func (s ServerSiteResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerSiteResource. +func (s *ServerSiteResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &s.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServerSiteResourceListResult. +func (s ServerSiteResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerSiteResourceListResult. +func (s *ServerSiteResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServerSiteResourceUpdate. +func (s ServerSiteResourceUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "tags", s.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerSiteResourceUpdate. +func (s *ServerSiteResourceUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServerSiteResourceUpdateProperties. +func (s ServerSiteResourceUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "agentDetails", s.AgentDetails) + populate(objectMap, "applianceName", s.ApplianceName) + populate(objectMap, "discoverySolutionId", s.DiscoverySolutionID) + populate(objectMap, "servicePrincipalIdentityDetails", s.ServicePrincipalIdentityDetails) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerSiteResourceUpdateProperties. +func (s *ServerSiteResourceUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "agentDetails": + err = unpopulate(val, "AgentDetails", &s.AgentDetails) + delete(rawMsg, key) + case "applianceName": + err = unpopulate(val, "ApplianceName", &s.ApplianceName) + delete(rawMsg, key) + case "discoverySolutionId": + err = unpopulate(val, "DiscoverySolutionID", &s.DiscoverySolutionID) + delete(rawMsg, key) + case "servicePrincipalIdentityDetails": + err = unpopulate(val, "ServicePrincipalIdentityDetails", &s.ServicePrincipalIdentityDetails) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServerSiteUsage. +func (s ServerSiteUsage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "runAsAccountCount", s.RunAsAccountCount) + populate(objectMap, "serverCount", s.ServerCount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerSiteUsage. +func (s *ServerSiteUsage) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "runAsAccountCount": + err = unpopulate(val, "RunAsAccountCount", &s.RunAsAccountCount) + delete(rawMsg, key) + case "serverCount": + err = unpopulate(val, "ServerCount", &s.ServerCount) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServerSiteUsageResponse. +func (s ServerSiteUsageResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "runAsAccounts", s.RunAsAccounts) + populate(objectMap, "serverCount", s.ServerCount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerSiteUsageResponse. +func (s *ServerSiteUsageResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "runAsAccounts": + err = unpopulate(val, "RunAsAccounts", &s.RunAsAccounts) + delete(rawMsg, key) + case "serverCount": + err = unpopulate(val, "ServerCount", &s.ServerCount) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServerSoftwareInventory. +func (s ServerSoftwareInventory) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerSoftwareInventory. +func (s *ServerSoftwareInventory) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServerSoftwareInventoryListResult. +func (s ServerSoftwareInventoryListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerSoftwareInventoryListResult. +func (s *ServerSoftwareInventoryListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServerUpdate. +func (s ServerUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", s.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerUpdate. +func (s *ServerUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServerUpdateProperties. +func (s ServerUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "allocatedMemoryInMb", s.AllocatedMemoryInMb) + populate(objectMap, "biosGuid", s.BiosGUID) + populate(objectMap, "biosSerialNumber", s.BiosSerialNumber) + populate(objectMap, "disks", s.Disks) + populate(objectMap, "firmware", s.Firmware) + populate(objectMap, "fqdn", s.Fqdn) + populate(objectMap, "hydratedFqdn", s.HydratedFqdn) + populate(objectMap, "networkAdapters", s.NetworkAdapters) + populate(objectMap, "numberOfProcessorCore", s.NumberOfProcessorCore) + populate(objectMap, "operatingSystemDetails", s.OperatingSystemDetails) + populate(objectMap, "productSupportStatus", s.ProductSupportStatus) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "runAsAccountId", s.RunAsAccountID) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "validationRequired", s.ValidationRequired) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerUpdateProperties. +func (s *ServerUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allocatedMemoryInMb": + err = unpopulate(val, "AllocatedMemoryInMb", &s.AllocatedMemoryInMb) + delete(rawMsg, key) + case "biosGuid": + err = unpopulate(val, "BiosGUID", &s.BiosGUID) + delete(rawMsg, key) + case "biosSerialNumber": + err = unpopulate(val, "BiosSerialNumber", &s.BiosSerialNumber) + delete(rawMsg, key) + case "disks": + err = unpopulate(val, "Disks", &s.Disks) + delete(rawMsg, key) + case "firmware": + err = unpopulate(val, "Firmware", &s.Firmware) + delete(rawMsg, key) + case "fqdn": + err = unpopulate(val, "Fqdn", &s.Fqdn) + delete(rawMsg, key) + case "hydratedFqdn": + err = unpopulate(val, "HydratedFqdn", &s.HydratedFqdn) + delete(rawMsg, key) + case "networkAdapters": + err = unpopulate(val, "NetworkAdapters", &s.NetworkAdapters) + delete(rawMsg, key) + case "numberOfProcessorCore": + err = unpopulate(val, "NumberOfProcessorCore", &s.NumberOfProcessorCore) + delete(rawMsg, key) + case "operatingSystemDetails": + err = unpopulate(val, "OperatingSystemDetails", &s.OperatingSystemDetails) + delete(rawMsg, key) + case "productSupportStatus": + err = unpopulate(val, "ProductSupportStatus", &s.ProductSupportStatus) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "runAsAccountId": + err = unpopulate(val, "RunAsAccountID", &s.RunAsAccountID) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) + case "validationRequired": + err = unpopulate(val, "ValidationRequired", &s.ValidationRequired) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SharePointServer. +func (s SharePointServer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "isEnterprise", s.IsEnterprise) + populate(objectMap, "productName", s.ProductName) + populate(objectMap, "status", s.Status) + populate(objectMap, "version", s.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SharePointServer. +func (s *SharePointServer) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "isEnterprise": + err = unpopulate(val, "IsEnterprise", &s.IsEnterprise) + delete(rawMsg, key) + case "productName": + err = unpopulate(val, "ProductName", &s.ProductName) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &s.Status) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &s.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SiteAgentProperties. +func (s SiteAgentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "keyVaultId", s.KeyVaultID) + populate(objectMap, "keyVaultUri", s.KeyVaultURI) + populateDateTimeRFC3339(objectMap, "lastHeartBeatUtc", s.LastHeartBeatUTC) + populate(objectMap, "version", s.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SiteAgentProperties. +func (s *SiteAgentProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "keyVaultId": + err = unpopulate(val, "KeyVaultID", &s.KeyVaultID) + delete(rawMsg, key) + case "keyVaultUri": + err = unpopulate(val, "KeyVaultURI", &s.KeyVaultURI) + delete(rawMsg, key) + case "lastHeartBeatUtc": + err = unpopulateDateTimeRFC3339(val, "LastHeartBeatUTC", &s.LastHeartBeatUTC) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &s.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SiteApplianceProperties. +func (s SiteApplianceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "agentDetails", s.AgentDetails) + populate(objectMap, "applianceName", s.ApplianceName) + populate(objectMap, "servicePrincipalIdentityDetails", s.ServicePrincipalIdentityDetails) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SiteApplianceProperties. +func (s *SiteApplianceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "agentDetails": + err = unpopulate(val, "AgentDetails", &s.AgentDetails) + delete(rawMsg, key) + case "applianceName": + err = unpopulate(val, "ApplianceName", &s.ApplianceName) + delete(rawMsg, key) + case "servicePrincipalIdentityDetails": + err = unpopulate(val, "ServicePrincipalIdentityDetails", &s.ServicePrincipalIdentityDetails) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SiteErrorSummary. +func (s SiteErrorSummary) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "applianceName", s.ApplianceName) + populate(objectMap, "discoveryScopeErrorSummaries", s.DiscoveryScopeErrorSummaries) + populate(objectMap, "nextLink", s.NextLink) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SiteErrorSummary. +func (s *SiteErrorSummary) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "applianceName": + err = unpopulate(val, "ApplianceName", &s.ApplianceName) + delete(rawMsg, key) + case "discoveryScopeErrorSummaries": + err = unpopulate(val, "DiscoveryScopeErrorSummaries", &s.DiscoveryScopeErrorSummaries) + delete(rawMsg, key) + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SiteHealthSummary. +func (s SiteHealthSummary) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "affectedObjectsCount", s.AffectedObjectsCount) + populate(objectMap, "affectedResourceType", s.AffectedResourceType) + populate(objectMap, "affectedResources", s.AffectedResources) + populate(objectMap, "applianceName", s.ApplianceName) + populate(objectMap, "errorCode", s.ErrorCode) + populate(objectMap, "errorId", s.ErrorID) + populate(objectMap, "errorMessage", s.ErrorMessage) + populate(objectMap, "fabricLayoutUpdateSources", s.FabricLayoutUpdateSources) + populate(objectMap, "hitCount", s.HitCount) + populate(objectMap, "remediationGuidance", s.RemediationGuidance) + populate(objectMap, "severity", s.Severity) + populate(objectMap, "summaryMessage", s.SummaryMessage) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SiteHealthSummary. +func (s *SiteHealthSummary) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "affectedObjectsCount": + err = unpopulate(val, "AffectedObjectsCount", &s.AffectedObjectsCount) + delete(rawMsg, key) + case "affectedResourceType": + err = unpopulate(val, "AffectedResourceType", &s.AffectedResourceType) + delete(rawMsg, key) + case "affectedResources": + err = unpopulate(val, "AffectedResources", &s.AffectedResources) + delete(rawMsg, key) + case "applianceName": + err = unpopulate(val, "ApplianceName", &s.ApplianceName) + delete(rawMsg, key) + case "errorCode": + err = unpopulate(val, "ErrorCode", &s.ErrorCode) + delete(rawMsg, key) + case "errorId": + err = unpopulate(val, "ErrorID", &s.ErrorID) + delete(rawMsg, key) + case "errorMessage": + err = unpopulate(val, "ErrorMessage", &s.ErrorMessage) + delete(rawMsg, key) + case "fabricLayoutUpdateSources": + err = unpopulate(val, "FabricLayoutUpdateSources", &s.FabricLayoutUpdateSources) + delete(rawMsg, key) + case "hitCount": + err = unpopulate(val, "HitCount", &s.HitCount) + delete(rawMsg, key) + case "remediationGuidance": + err = unpopulate(val, "RemediationGuidance", &s.RemediationGuidance) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &s.Severity) + delete(rawMsg, key) + case "summaryMessage": + err = unpopulate(val, "SummaryMessage", &s.SummaryMessage) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SiteHealthSummaryCollection. +func (s SiteHealthSummaryCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SiteHealthSummaryCollection. +func (s *SiteHealthSummaryCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SiteProperties. +func (s SiteProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "agentDetails", s.AgentDetails) + populate(objectMap, "applianceName", s.ApplianceName) + populate(objectMap, "discoverySolutionId", s.DiscoverySolutionID) + populate(objectMap, "masterSiteId", s.MasterSiteID) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "serviceEndpoint", s.ServiceEndpoint) + populate(objectMap, "servicePrincipalIdentityDetails", s.ServicePrincipalIdentityDetails) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SiteProperties. +func (s *SiteProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "agentDetails": + err = unpopulate(val, "AgentDetails", &s.AgentDetails) + delete(rawMsg, key) + case "applianceName": + err = unpopulate(val, "ApplianceName", &s.ApplianceName) + delete(rawMsg, key) + case "discoverySolutionId": + err = unpopulate(val, "DiscoverySolutionID", &s.DiscoverySolutionID) + delete(rawMsg, key) + case "masterSiteId": + err = unpopulate(val, "MasterSiteID", &s.MasterSiteID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "serviceEndpoint": + err = unpopulate(val, "ServiceEndpoint", &s.ServiceEndpoint) + delete(rawMsg, key) + case "servicePrincipalIdentityDetails": + err = unpopulate(val, "ServicePrincipalIdentityDetails", &s.ServicePrincipalIdentityDetails) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SiteSpnProperties. +func (s SiteSpnProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "aadAuthority", s.AADAuthority) + populate(objectMap, "applicationId", s.ApplicationID) + populate(objectMap, "audience", s.Audience) + populate(objectMap, "objectId", s.ObjectID) + populate(objectMap, "rawCertData", s.RawCertData) + populate(objectMap, "tenantId", s.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SiteSpnProperties. +func (s *SiteSpnProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "aadAuthority": + err = unpopulate(val, "AADAuthority", &s.AADAuthority) + delete(rawMsg, key) + case "applicationId": + err = unpopulate(val, "ApplicationID", &s.ApplicationID) + delete(rawMsg, key) + case "audience": + err = unpopulate(val, "Audience", &s.Audience) + delete(rawMsg, key) + case "objectId": + err = unpopulate(val, "ObjectID", &s.ObjectID) + delete(rawMsg, key) + case "rawCertData": + err = unpopulate(val, "RawCertData", &s.RawCertData) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &s.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SitesProperties. +func (s SitesProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "agentDetails", s.AgentDetails) + populate(objectMap, "applianceName", s.ApplianceName) + populate(objectMap, "discoverySolutionId", s.DiscoverySolutionID) + populate(objectMap, "masterSiteId", s.MasterSiteID) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "serviceEndpoint", s.ServiceEndpoint) + populate(objectMap, "servicePrincipalIdentityDetails", s.ServicePrincipalIdentityDetails) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SitesProperties. +func (s *SitesProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "agentDetails": + err = unpopulate(val, "AgentDetails", &s.AgentDetails) + delete(rawMsg, key) + case "applianceName": + err = unpopulate(val, "ApplianceName", &s.ApplianceName) + delete(rawMsg, key) + case "discoverySolutionId": + err = unpopulate(val, "DiscoverySolutionID", &s.DiscoverySolutionID) + delete(rawMsg, key) + case "masterSiteId": + err = unpopulate(val, "MasterSiteID", &s.MasterSiteID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "serviceEndpoint": + err = unpopulate(val, "ServiceEndpoint", &s.ServiceEndpoint) + delete(rawMsg, key) + case "servicePrincipalIdentityDetails": + err = unpopulate(val, "ServicePrincipalIdentityDetails", &s.ServicePrincipalIdentityDetails) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SpringBootDiscovery. +func (s SpringBootDiscovery) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "discoveryScopeStatus", s.DiscoveryScopeStatus) + populate(objectMap, "shallowDiscoveryStatus", s.ShallowDiscoveryStatus) + populate(objectMap, "totalApplicationCount", s.TotalApplicationCount) + populate(objectMap, "totalInstanceCount", s.TotalInstanceCount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SpringBootDiscovery. +func (s *SpringBootDiscovery) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "discoveryScopeStatus": + err = unpopulate(val, "DiscoveryScopeStatus", &s.DiscoveryScopeStatus) + delete(rawMsg, key) + case "shallowDiscoveryStatus": + err = unpopulate(val, "ShallowDiscoveryStatus", &s.ShallowDiscoveryStatus) + delete(rawMsg, key) + case "totalApplicationCount": + err = unpopulate(val, "TotalApplicationCount", &s.TotalApplicationCount) + delete(rawMsg, key) + case "totalInstanceCount": + err = unpopulate(val, "TotalInstanceCount", &s.TotalInstanceCount) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type StaticDiscovery. +func (s StaticDiscovery) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "discoveryScopeStatus", s.DiscoveryScopeStatus) + populate(objectMap, "errors", s.Errors) + populate(objectMap, "hydratedRunAsAccountId", s.HydratedRunAsAccountID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StaticDiscovery. +func (s *StaticDiscovery) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "discoveryScopeStatus": + err = unpopulate(val, "DiscoveryScopeStatus", &s.DiscoveryScopeStatus) + delete(rawMsg, key) + case "errors": + err = unpopulate(val, "Errors", &s.Errors) + delete(rawMsg, key) + case "hydratedRunAsAccountId": + err = unpopulate(val, "HydratedRunAsAccountID", &s.HydratedRunAsAccountID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemCenter. +func (s SystemCenter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "productName", s.ProductName) + populate(objectMap, "status", s.Status) + populate(objectMap, "version", s.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemCenter. +func (s *SystemCenter) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "productName": + err = unpopulate(val, "ProductName", &s.ProductName) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &s.Status) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &s.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TagsMachineInput. +func (t TagsMachineInput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "machineId", t.MachineID) + populate(objectMap, "tags", t.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TagsMachineInput. +func (t *TagsMachineInput) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "machineId": + err = unpopulate(val, "MachineID", &t.MachineID) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &t.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TomcatEngineUnit. +func (t TomcatEngineUnit) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "hosts", t.Hosts) + populate(objectMap, "name", t.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TomcatEngineUnit. +func (t *TomcatEngineUnit) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "hosts": + err = unpopulate(val, "Hosts", &t.Hosts) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TomcatHostUnit. +func (t TomcatHostUnit) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "appBase", t.AppBase) + populate(objectMap, "appBasePath", t.AppBasePath) + populate(objectMap, "name", t.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TomcatHostUnit. +func (t *TomcatHostUnit) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "appBase": + err = unpopulate(val, "AppBase", &t.AppBase) + delete(rawMsg, key) + case "appBasePath": + err = unpopulate(val, "AppBasePath", &t.AppBasePath) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TomcatServiceUnit. +func (t TomcatServiceUnit) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "connectors", t.Connectors) + populate(objectMap, "engine", t.Engine) + populate(objectMap, "name", t.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TomcatServiceUnit. +func (t *TomcatServiceUnit) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "connectors": + err = unpopulate(val, "Connectors", &t.Connectors) + delete(rawMsg, key) + case "engine": + err = unpopulate(val, "Engine", &t.Engine) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TomcatWebApplicationProperties. +func (t TomcatWebApplicationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "applianceNames", t.ApplianceNames) + populate(objectMap, "bindings", t.Bindings) + populate(objectMap, "configurations", t.Configurations) + populate(objectMap, "createdTimestamp", t.CreatedTimestamp) + populate(objectMap, "directories", t.Directories) + populate(objectMap, "displayName", t.DisplayName) + populate(objectMap, "errors", t.Errors) + populate(objectMap, "frameworks", t.Frameworks) + populate(objectMap, "hasDatabaseDependency", t.HasDatabaseDependency) + populate(objectMap, "hasErrors", t.HasErrors) + populate(objectMap, "isDeleted", t.IsDeleted) + populate(objectMap, "isExternalLoggingConfigured", t.IsExternalLoggingConfigured) + populate(objectMap, "machineArmIds", t.MachineArmIDs) + populate(objectMap, "machineDisplayName", t.MachineDisplayName) + populate(objectMap, "physicalPath", t.PhysicalPath) + populate(objectMap, "provisioningState", t.ProvisioningState) + populate(objectMap, "serverType", t.ServerType) + populate(objectMap, "staticFolders", t.StaticFolders) + populate(objectMap, "tags", t.Tags) + populate(objectMap, "updatedTimestamp", t.UpdatedTimestamp) + populate(objectMap, "virtualPath", t.VirtualPath) + populate(objectMap, "webServerId", t.WebServerID) + populate(objectMap, "webServerName", t.WebServerName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TomcatWebApplicationProperties. +func (t *TomcatWebApplicationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "applianceNames": + err = unpopulate(val, "ApplianceNames", &t.ApplianceNames) + delete(rawMsg, key) + case "bindings": + err = unpopulate(val, "Bindings", &t.Bindings) + delete(rawMsg, key) + case "configurations": + err = unpopulate(val, "Configurations", &t.Configurations) + delete(rawMsg, key) + case "createdTimestamp": + err = unpopulate(val, "CreatedTimestamp", &t.CreatedTimestamp) + delete(rawMsg, key) + case "directories": + err = unpopulate(val, "Directories", &t.Directories) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &t.DisplayName) + delete(rawMsg, key) + case "errors": + err = unpopulate(val, "Errors", &t.Errors) + delete(rawMsg, key) + case "frameworks": + err = unpopulate(val, "Frameworks", &t.Frameworks) + delete(rawMsg, key) + case "hasDatabaseDependency": + err = unpopulate(val, "HasDatabaseDependency", &t.HasDatabaseDependency) + delete(rawMsg, key) + case "hasErrors": + err = unpopulate(val, "HasErrors", &t.HasErrors) + delete(rawMsg, key) + case "isDeleted": + err = unpopulate(val, "IsDeleted", &t.IsDeleted) + delete(rawMsg, key) + case "isExternalLoggingConfigured": + err = unpopulate(val, "IsExternalLoggingConfigured", &t.IsExternalLoggingConfigured) + delete(rawMsg, key) + case "machineArmIds": + err = unpopulate(val, "MachineArmIDs", &t.MachineArmIDs) + delete(rawMsg, key) + case "machineDisplayName": + err = unpopulate(val, "MachineDisplayName", &t.MachineDisplayName) + delete(rawMsg, key) + case "physicalPath": + err = unpopulate(val, "PhysicalPath", &t.PhysicalPath) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &t.ProvisioningState) + delete(rawMsg, key) + case "serverType": + err = unpopulate(val, "ServerType", &t.ServerType) + delete(rawMsg, key) + case "staticFolders": + err = unpopulate(val, "StaticFolders", &t.StaticFolders) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &t.Tags) + delete(rawMsg, key) + case "updatedTimestamp": + err = unpopulate(val, "UpdatedTimestamp", &t.UpdatedTimestamp) + delete(rawMsg, key) + case "virtualPath": + err = unpopulate(val, "VirtualPath", &t.VirtualPath) + delete(rawMsg, key) + case "webServerId": + err = unpopulate(val, "WebServerID", &t.WebServerID) + delete(rawMsg, key) + case "webServerName": + err = unpopulate(val, "WebServerName", &t.WebServerName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TomcatWebApplications. +func (t TomcatWebApplications) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", t.ID) + populate(objectMap, "name", t.Name) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "systemData", t.SystemData) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TomcatWebApplications. +func (t *TomcatWebApplications) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TomcatWebApplicationsListResult. +func (t TomcatWebApplicationsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", t.NextLink) + populate(objectMap, "value", t.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TomcatWebApplicationsListResult. +func (t *TomcatWebApplicationsListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &t.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &t.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TomcatWebServerProperties. +func (t TomcatWebServerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "applianceNames", t.ApplianceNames) + populate(objectMap, "catalinaHome", t.CatalinaHome) + populate(objectMap, "configurationLocation", t.ConfigurationLocation) + populate(objectMap, "createdTimestamp", t.CreatedTimestamp) + populate(objectMap, "displayName", t.DisplayName) + populate(objectMap, "errors", t.Errors) + populate(objectMap, "hasErrors", t.HasErrors) + populate(objectMap, "isAccessLogValvePresent", t.IsAccessLogValvePresent) + populate(objectMap, "isClusteringPresent", t.IsClusteringPresent) + populate(objectMap, "isDeleted", t.IsDeleted) + populate(objectMap, "isMemoryRealmPresent", t.IsMemoryRealmPresent) + populate(objectMap, "isSessionTrackingPresent", t.IsSessionTrackingPresent) + populate(objectMap, "jvmVersion", t.JvmVersion) + populate(objectMap, "machineIds", t.MachineIDs) + populate(objectMap, "maxMemoryUsageInMb", t.MaxMemoryUsageInMb) + populate(objectMap, "operatingSystemDetails", t.OperatingSystemDetails) + populate(objectMap, "provisioningState", t.ProvisioningState) + populate(objectMap, "runAsAccountId", t.RunAsAccountID) + populate(objectMap, "serverFqdn", t.ServerFqdn) + populate(objectMap, "serverType", t.ServerType) + populate(objectMap, "services", t.Services) + populate(objectMap, "sessionPersistenceMechanism", t.SessionPersistenceMechanism) + populate(objectMap, "updatedTimestamp", t.UpdatedTimestamp) + populate(objectMap, "version", t.Version) + populate(objectMap, "webApplications", t.WebApplications) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TomcatWebServerProperties. +func (t *TomcatWebServerProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "applianceNames": + err = unpopulate(val, "ApplianceNames", &t.ApplianceNames) + delete(rawMsg, key) + case "catalinaHome": + err = unpopulate(val, "CatalinaHome", &t.CatalinaHome) + delete(rawMsg, key) + case "configurationLocation": + err = unpopulate(val, "ConfigurationLocation", &t.ConfigurationLocation) + delete(rawMsg, key) + case "createdTimestamp": + err = unpopulate(val, "CreatedTimestamp", &t.CreatedTimestamp) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &t.DisplayName) + delete(rawMsg, key) + case "errors": + err = unpopulate(val, "Errors", &t.Errors) + delete(rawMsg, key) + case "hasErrors": + err = unpopulate(val, "HasErrors", &t.HasErrors) + delete(rawMsg, key) + case "isAccessLogValvePresent": + err = unpopulate(val, "IsAccessLogValvePresent", &t.IsAccessLogValvePresent) + delete(rawMsg, key) + case "isClusteringPresent": + err = unpopulate(val, "IsClusteringPresent", &t.IsClusteringPresent) + delete(rawMsg, key) + case "isDeleted": + err = unpopulate(val, "IsDeleted", &t.IsDeleted) + delete(rawMsg, key) + case "isMemoryRealmPresent": + err = unpopulate(val, "IsMemoryRealmPresent", &t.IsMemoryRealmPresent) + delete(rawMsg, key) + case "isSessionTrackingPresent": + err = unpopulate(val, "IsSessionTrackingPresent", &t.IsSessionTrackingPresent) + delete(rawMsg, key) + case "jvmVersion": + err = unpopulate(val, "JvmVersion", &t.JvmVersion) + delete(rawMsg, key) + case "machineIds": + err = unpopulate(val, "MachineIDs", &t.MachineIDs) + delete(rawMsg, key) + case "maxMemoryUsageInMb": + err = unpopulate(val, "MaxMemoryUsageInMb", &t.MaxMemoryUsageInMb) + delete(rawMsg, key) + case "operatingSystemDetails": + err = unpopulate(val, "OperatingSystemDetails", &t.OperatingSystemDetails) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &t.ProvisioningState) + delete(rawMsg, key) + case "runAsAccountId": + err = unpopulate(val, "RunAsAccountID", &t.RunAsAccountID) + delete(rawMsg, key) + case "serverFqdn": + err = unpopulate(val, "ServerFqdn", &t.ServerFqdn) + delete(rawMsg, key) + case "serverType": + err = unpopulate(val, "ServerType", &t.ServerType) + delete(rawMsg, key) + case "services": + err = unpopulate(val, "Services", &t.Services) + delete(rawMsg, key) + case "sessionPersistenceMechanism": + err = unpopulate(val, "SessionPersistenceMechanism", &t.SessionPersistenceMechanism) + delete(rawMsg, key) + case "updatedTimestamp": + err = unpopulate(val, "UpdatedTimestamp", &t.UpdatedTimestamp) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &t.Version) + delete(rawMsg, key) + case "webApplications": + err = unpopulate(val, "WebApplications", &t.WebApplications) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TomcatWebServers. +func (t TomcatWebServers) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", t.ID) + populate(objectMap, "name", t.Name) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "systemData", t.SystemData) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TomcatWebServers. +func (t *TomcatWebServers) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TomcatWebServersListResult. +func (t TomcatWebServersListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", t.NextLink) + populate(objectMap, "value", t.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TomcatWebServersListResult. +func (t *TomcatWebServersListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &t.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &t.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TrackedResource. +func (t TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", t.ID) + populate(objectMap, "location", t.Location) + populate(objectMap, "name", t.Name) + populate(objectMap, "systemData", t.SystemData) + populate(objectMap, "tags", t.Tags) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrackedResource. +func (t *TrackedResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &t.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &t.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UpdateMachineDepMapStatus. +func (u UpdateMachineDepMapStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "machines", u.Machines) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateMachineDepMapStatus. +func (u *UpdateMachineDepMapStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "machines": + err = unpopulate(val, "Machines", &u.Machines) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UpdateMachineRunAsAccount. +func (u UpdateMachineRunAsAccount) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "machines", u.Machines) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateMachineRunAsAccount. +func (u *UpdateMachineRunAsAccount) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "machines": + err = unpopulate(val, "Machines", &u.Machines) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UpdateMachineTags. +func (u UpdateMachineTags) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "machines", u.Machines) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateMachineTags. +func (u *UpdateMachineTags) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "machines": + err = unpopulate(val, "Machines", &u.Machines) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type V20180501PreviewVmwareRunAsAccount. +func (v V20180501PreviewVmwareRunAsAccount) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type V20180501PreviewVmwareRunAsAccount. +func (v *V20180501PreviewVmwareRunAsAccount) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type V20180501PreviewVmwareRunAsAccountVmwareRunAsAccountCollection. +func (v V20180501PreviewVmwareRunAsAccountVmwareRunAsAccountCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type V20180501PreviewVmwareRunAsAccountVmwareRunAsAccountCollection. +func (v *V20180501PreviewVmwareRunAsAccountVmwareRunAsAccountCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Vcenter. +func (v Vcenter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "systemData", v.SystemData) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Vcenter. +func (v *Vcenter) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &v.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VcenterListResult. +func (v VcenterListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VcenterListResult. +func (v *VcenterListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VcenterProperties. +func (v VcenterProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "createdTimestamp", v.CreatedTimestamp) + populate(objectMap, "errors", v.Errors) + populate(objectMap, "fqdn", v.Fqdn) + populate(objectMap, "friendlyName", v.FriendlyName) + populate(objectMap, "instanceUuid", v.InstanceUUID) + populate(objectMap, "perfStatisticsLevel", v.PerfStatisticsLevel) + populate(objectMap, "port", v.Port) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "runAsAccountId", v.RunAsAccountID) + populate(objectMap, "updatedTimestamp", v.UpdatedTimestamp) + populate(objectMap, "version", v.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VcenterProperties. +func (v *VcenterProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdTimestamp": + err = unpopulate(val, "CreatedTimestamp", &v.CreatedTimestamp) + delete(rawMsg, key) + case "errors": + err = unpopulate(val, "Errors", &v.Errors) + delete(rawMsg, key) + case "fqdn": + err = unpopulate(val, "Fqdn", &v.Fqdn) + delete(rawMsg, key) + case "friendlyName": + err = unpopulate(val, "FriendlyName", &v.FriendlyName) + delete(rawMsg, key) + case "instanceUuid": + err = unpopulate(val, "InstanceUUID", &v.InstanceUUID) + delete(rawMsg, key) + case "perfStatisticsLevel": + err = unpopulate(val, "PerfStatisticsLevel", &v.PerfStatisticsLevel) + delete(rawMsg, key) + case "port": + err = unpopulate(val, "Port", &v.Port) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "runAsAccountId": + err = unpopulate(val, "RunAsAccountID", &v.RunAsAccountID) + delete(rawMsg, key) + case "updatedTimestamp": + err = unpopulate(val, "UpdatedTimestamp", &v.UpdatedTimestamp) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &v.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VmwareDatastore. +func (v VmwareDatastore) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "capacityInGb", v.CapacityInGb) + populate(objectMap, "freeSpaceInGb", v.FreeSpaceInGb) + populate(objectMap, "symbolicName", v.SymbolicName) + populate(objectMap, "type", v.Type) + populate(objectMap, "uuid", v.UUID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VmwareDatastore. +func (v *VmwareDatastore) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "capacityInGb": + err = unpopulate(val, "CapacityInGb", &v.CapacityInGb) + delete(rawMsg, key) + case "freeSpaceInGb": + err = unpopulate(val, "FreeSpaceInGb", &v.FreeSpaceInGb) + delete(rawMsg, key) + case "symbolicName": + err = unpopulate(val, "SymbolicName", &v.SymbolicName) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + case "uuid": + err = unpopulate(val, "UUID", &v.UUID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VmwareDisk. +func (v VmwareDisk) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "controllerType", v.ControllerType) + populate(objectMap, "diskMode", v.DiskMode) + populate(objectMap, "diskProvisioningPolicy", v.DiskProvisioningPolicy) + populate(objectMap, "diskScrubbingPolicy", v.DiskScrubbingPolicy) + populate(objectMap, "diskType", v.DiskType) + populate(objectMap, "label", v.Label) + populate(objectMap, "lun", v.Lun) + populate(objectMap, "maxSizeInBytes", v.MaxSizeInBytes) + populate(objectMap, "name", v.Name) + populate(objectMap, "path", v.Path) + populate(objectMap, "uuid", v.UUID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VmwareDisk. +func (v *VmwareDisk) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "controllerType": + err = unpopulate(val, "ControllerType", &v.ControllerType) + delete(rawMsg, key) + case "diskMode": + err = unpopulate(val, "DiskMode", &v.DiskMode) + delete(rawMsg, key) + case "diskProvisioningPolicy": + err = unpopulate(val, "DiskProvisioningPolicy", &v.DiskProvisioningPolicy) + delete(rawMsg, key) + case "diskScrubbingPolicy": + err = unpopulate(val, "DiskScrubbingPolicy", &v.DiskScrubbingPolicy) + delete(rawMsg, key) + case "diskType": + err = unpopulate(val, "DiskType", &v.DiskType) + delete(rawMsg, key) + case "label": + err = unpopulate(val, "Label", &v.Label) + delete(rawMsg, key) + case "lun": + err = unpopulate(val, "Lun", &v.Lun) + delete(rawMsg, key) + case "maxSizeInBytes": + err = unpopulate(val, "MaxSizeInBytes", &v.MaxSizeInBytes) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "path": + err = unpopulate(val, "Path", &v.Path) + delete(rawMsg, key) + case "uuid": + err = unpopulate(val, "UUID", &v.UUID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VmwareHost. +func (v VmwareHost) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "systemData", v.SystemData) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VmwareHost. +func (v *VmwareHost) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &v.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VmwareHostListResult. +func (v VmwareHostListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VmwareHostListResult. +func (v *VmwareHostListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VmwareHostProperties. +func (v VmwareHostProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "applianceNames", v.ApplianceNames) + populate(objectMap, "createdTimestamp", v.CreatedTimestamp) + populate(objectMap, "datastores", v.Datastores) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "uuid", v.UUID) + populate(objectMap, "updatedTimestamp", v.UpdatedTimestamp) + populate(objectMap, "vcenterId", v.VcenterID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VmwareHostProperties. +func (v *VmwareHostProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "applianceNames": + err = unpopulate(val, "ApplianceNames", &v.ApplianceNames) + delete(rawMsg, key) + case "createdTimestamp": + err = unpopulate(val, "CreatedTimestamp", &v.CreatedTimestamp) + delete(rawMsg, key) + case "datastores": + err = unpopulate(val, "Datastores", &v.Datastores) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "uuid": + err = unpopulate(val, "UUID", &v.UUID) + delete(rawMsg, key) + case "updatedTimestamp": + err = unpopulate(val, "UpdatedTimestamp", &v.UpdatedTimestamp) + delete(rawMsg, key) + case "vcenterId": + err = unpopulate(val, "VcenterID", &v.VcenterID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VmwareJob. +func (v VmwareJob) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "systemData", v.SystemData) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VmwareJob. +func (v *VmwareJob) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &v.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VmwareJobListResult. +func (v VmwareJobListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VmwareJobListResult. +func (v *VmwareJobListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VmwareMachineProperties. +func (v VmwareMachineProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "allocatedMemoryInMb", v.AllocatedMemoryInMb) + populate(objectMap, "altGuestName", v.AltGuestName) + populate(objectMap, "applianceNames", v.ApplianceNames) + populate(objectMap, "applicationDiscovery", v.ApplicationDiscovery) + populate(objectMap, "appsAndRoles", v.AppsAndRoles) + populate(objectMap, "biosGuid", v.BiosGUID) + populate(objectMap, "biosSerialNumber", v.BiosSerialNumber) + populate(objectMap, "changeTrackingEnabled", v.ChangeTrackingEnabled) + populate(objectMap, "changeTrackingSupported", v.ChangeTrackingSupported) + populate(objectMap, "createdTimestamp", v.CreatedTimestamp) + populate(objectMap, "dataCenterScope", v.DataCenterScope) + populate(objectMap, "dependencyMapDiscovery", v.DependencyMapDiscovery) + populate(objectMap, "dependencyMapping", v.DependencyMapping) + populate(objectMap, "dependencyMappingEndTime", v.DependencyMappingEndTime) + populateDateTimeRFC3339(objectMap, "dependencyMappingStartTime", v.DependencyMappingStartTime) + populate(objectMap, "description", v.Description) + populate(objectMap, "diskEnabledUuid", v.DiskEnabledUUID) + populate(objectMap, "disks", v.Disks) + populate(objectMap, "displayName", v.DisplayName) + populate(objectMap, "errors", v.Errors) + populate(objectMap, "firmware", v.Firmware) + populateDateTimeRFC3339(objectMap, "guestDetailsDiscoveryTimestamp", v.GuestDetailsDiscoveryTimestamp) + populate(objectMap, "guestOsDetails", v.GuestOsDetails) + populate(objectMap, "hostInMaintenanceMode", v.HostInMaintenanceMode) + populate(objectMap, "hostName", v.HostName) + populate(objectMap, "hostPowerState", v.HostPowerState) + populate(objectMap, "hostVersion", v.HostVersion) + populate(objectMap, "iisDiscovery", v.IisDiscovery) + populate(objectMap, "instanceUuid", v.InstanceUUID) + populate(objectMap, "isDeleted", v.IsDeleted) + populate(objectMap, "isGuestDetailsDiscoveryInProgress", v.IsGuestDetailsDiscoveryInProgress) + populate(objectMap, "maxSnapshots", v.MaxSnapshots) + populate(objectMap, "networkAdapters", v.NetworkAdapters) + populate(objectMap, "numberOfApplications", v.NumberOfApplications) + populate(objectMap, "numberOfProcessorCore", v.NumberOfProcessorCore) + populate(objectMap, "numberOfSnapshots", v.NumberOfSnapshots) + populate(objectMap, "operatingSystemDetails", v.OperatingSystemDetails) + populate(objectMap, "oracleDiscovery", v.OracleDiscovery) + populate(objectMap, "powerStatus", v.PowerStatus) + populate(objectMap, "productSupportStatus", v.ProductSupportStatus) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "runAsAccountId", v.RunAsAccountID) + populate(objectMap, "sqlDiscovery", v.SQLDiscovery) + populate(objectMap, "springBootDiscovery", v.SpringBootDiscovery) + populate(objectMap, "staticDiscovery", v.StaticDiscovery) + populate(objectMap, "tags", v.Tags) + populate(objectMap, "tomcatDiscovery", v.TomcatDiscovery) + populate(objectMap, "updatedTimestamp", v.UpdatedTimestamp) + populate(objectMap, "vCenterFqdn", v.VCenterFqdn) + populate(objectMap, "vCenterId", v.VCenterID) + populate(objectMap, "vmConfigurationFileLocation", v.VMConfigurationFileLocation) + populate(objectMap, "vmFqdn", v.VMFqdn) + populate(objectMap, "vMwareToolsStatus", v.VMwareToolsStatus) + populate(objectMap, "vMwareToolsVersion", v.VMwareToolsVersion) + populate(objectMap, "webAppDiscovery", v.WebAppDiscovery) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VmwareMachineProperties. +func (v *VmwareMachineProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allocatedMemoryInMb": + err = unpopulate(val, "AllocatedMemoryInMb", &v.AllocatedMemoryInMb) + delete(rawMsg, key) + case "altGuestName": + err = unpopulate(val, "AltGuestName", &v.AltGuestName) + delete(rawMsg, key) + case "applianceNames": + err = unpopulate(val, "ApplianceNames", &v.ApplianceNames) + delete(rawMsg, key) + case "applicationDiscovery": + err = unpopulate(val, "ApplicationDiscovery", &v.ApplicationDiscovery) + delete(rawMsg, key) + case "appsAndRoles": + err = unpopulate(val, "AppsAndRoles", &v.AppsAndRoles) + delete(rawMsg, key) + case "biosGuid": + err = unpopulate(val, "BiosGUID", &v.BiosGUID) + delete(rawMsg, key) + case "biosSerialNumber": + err = unpopulate(val, "BiosSerialNumber", &v.BiosSerialNumber) + delete(rawMsg, key) + case "changeTrackingEnabled": + err = unpopulate(val, "ChangeTrackingEnabled", &v.ChangeTrackingEnabled) + delete(rawMsg, key) + case "changeTrackingSupported": + err = unpopulate(val, "ChangeTrackingSupported", &v.ChangeTrackingSupported) + delete(rawMsg, key) + case "createdTimestamp": + err = unpopulate(val, "CreatedTimestamp", &v.CreatedTimestamp) + delete(rawMsg, key) + case "dataCenterScope": + err = unpopulate(val, "DataCenterScope", &v.DataCenterScope) + delete(rawMsg, key) + case "dependencyMapDiscovery": + err = unpopulate(val, "DependencyMapDiscovery", &v.DependencyMapDiscovery) + delete(rawMsg, key) + case "dependencyMapping": + err = unpopulate(val, "DependencyMapping", &v.DependencyMapping) + delete(rawMsg, key) + case "dependencyMappingEndTime": + err = unpopulate(val, "DependencyMappingEndTime", &v.DependencyMappingEndTime) + delete(rawMsg, key) + case "dependencyMappingStartTime": + err = unpopulateDateTimeRFC3339(val, "DependencyMappingStartTime", &v.DependencyMappingStartTime) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &v.Description) + delete(rawMsg, key) + case "diskEnabledUuid": + err = unpopulate(val, "DiskEnabledUUID", &v.DiskEnabledUUID) + delete(rawMsg, key) + case "disks": + err = unpopulate(val, "Disks", &v.Disks) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &v.DisplayName) + delete(rawMsg, key) + case "errors": + err = unpopulate(val, "Errors", &v.Errors) + delete(rawMsg, key) + case "firmware": + err = unpopulate(val, "Firmware", &v.Firmware) + delete(rawMsg, key) + case "guestDetailsDiscoveryTimestamp": + err = unpopulateDateTimeRFC3339(val, "GuestDetailsDiscoveryTimestamp", &v.GuestDetailsDiscoveryTimestamp) + delete(rawMsg, key) + case "guestOsDetails": + err = unpopulate(val, "GuestOsDetails", &v.GuestOsDetails) + delete(rawMsg, key) + case "hostInMaintenanceMode": + err = unpopulate(val, "HostInMaintenanceMode", &v.HostInMaintenanceMode) + delete(rawMsg, key) + case "hostName": + err = unpopulate(val, "HostName", &v.HostName) + delete(rawMsg, key) + case "hostPowerState": + err = unpopulate(val, "HostPowerState", &v.HostPowerState) + delete(rawMsg, key) + case "hostVersion": + err = unpopulate(val, "HostVersion", &v.HostVersion) + delete(rawMsg, key) + case "iisDiscovery": + err = unpopulate(val, "IisDiscovery", &v.IisDiscovery) + delete(rawMsg, key) + case "instanceUuid": + err = unpopulate(val, "InstanceUUID", &v.InstanceUUID) + delete(rawMsg, key) + case "isDeleted": + err = unpopulate(val, "IsDeleted", &v.IsDeleted) + delete(rawMsg, key) + case "isGuestDetailsDiscoveryInProgress": + err = unpopulate(val, "IsGuestDetailsDiscoveryInProgress", &v.IsGuestDetailsDiscoveryInProgress) + delete(rawMsg, key) + case "maxSnapshots": + err = unpopulate(val, "MaxSnapshots", &v.MaxSnapshots) + delete(rawMsg, key) + case "networkAdapters": + err = unpopulate(val, "NetworkAdapters", &v.NetworkAdapters) + delete(rawMsg, key) + case "numberOfApplications": + err = unpopulate(val, "NumberOfApplications", &v.NumberOfApplications) + delete(rawMsg, key) + case "numberOfProcessorCore": + err = unpopulate(val, "NumberOfProcessorCore", &v.NumberOfProcessorCore) + delete(rawMsg, key) + case "numberOfSnapshots": + err = unpopulate(val, "NumberOfSnapshots", &v.NumberOfSnapshots) + delete(rawMsg, key) + case "operatingSystemDetails": + err = unpopulate(val, "OperatingSystemDetails", &v.OperatingSystemDetails) + delete(rawMsg, key) + case "oracleDiscovery": + err = unpopulate(val, "OracleDiscovery", &v.OracleDiscovery) + delete(rawMsg, key) + case "powerStatus": + err = unpopulate(val, "PowerStatus", &v.PowerStatus) + delete(rawMsg, key) + case "productSupportStatus": + err = unpopulate(val, "ProductSupportStatus", &v.ProductSupportStatus) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "runAsAccountId": + err = unpopulate(val, "RunAsAccountID", &v.RunAsAccountID) + delete(rawMsg, key) + case "sqlDiscovery": + err = unpopulate(val, "SQLDiscovery", &v.SQLDiscovery) + delete(rawMsg, key) + case "springBootDiscovery": + err = unpopulate(val, "SpringBootDiscovery", &v.SpringBootDiscovery) + delete(rawMsg, key) + case "staticDiscovery": + err = unpopulate(val, "StaticDiscovery", &v.StaticDiscovery) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &v.Tags) + delete(rawMsg, key) + case "tomcatDiscovery": + err = unpopulate(val, "TomcatDiscovery", &v.TomcatDiscovery) + delete(rawMsg, key) + case "updatedTimestamp": + err = unpopulate(val, "UpdatedTimestamp", &v.UpdatedTimestamp) + delete(rawMsg, key) + case "vCenterFqdn": + err = unpopulate(val, "VCenterFqdn", &v.VCenterFqdn) + delete(rawMsg, key) + case "vCenterId": + err = unpopulate(val, "VCenterID", &v.VCenterID) + delete(rawMsg, key) + case "vmConfigurationFileLocation": + err = unpopulate(val, "VMConfigurationFileLocation", &v.VMConfigurationFileLocation) + delete(rawMsg, key) + case "vmFqdn": + err = unpopulate(val, "VMFqdn", &v.VMFqdn) + delete(rawMsg, key) + case "vMwareToolsStatus": + err = unpopulate(val, "VMwareToolsStatus", &v.VMwareToolsStatus) + delete(rawMsg, key) + case "vMwareToolsVersion": + err = unpopulate(val, "VMwareToolsVersion", &v.VMwareToolsVersion) + delete(rawMsg, key) + case "webAppDiscovery": + err = unpopulate(val, "WebAppDiscovery", &v.WebAppDiscovery) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VmwareMachineSoftwareInventory. +func (v VmwareMachineSoftwareInventory) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "systemData", v.SystemData) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VmwareMachineSoftwareInventory. +func (v *VmwareMachineSoftwareInventory) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &v.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VmwareMachineSoftwareInventoryListResult. +func (v VmwareMachineSoftwareInventoryListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VmwareMachineSoftwareInventoryListResult. +func (v *VmwareMachineSoftwareInventoryListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VmwareNetworkAdapter. +func (v VmwareNetworkAdapter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "adapterType", v.AdapterType) + populate(objectMap, "ipAddressList", v.IPAddressList) + populate(objectMap, "ipAddressType", v.IPAddressType) + populate(objectMap, "label", v.Label) + populate(objectMap, "macAddress", v.MacAddress) + populate(objectMap, "networkName", v.NetworkName) + populate(objectMap, "nicId", v.NicID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VmwareNetworkAdapter. +func (v *VmwareNetworkAdapter) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "adapterType": + err = unpopulate(val, "AdapterType", &v.AdapterType) + delete(rawMsg, key) + case "ipAddressList": + err = unpopulate(val, "IPAddressList", &v.IPAddressList) + delete(rawMsg, key) + case "ipAddressType": + err = unpopulate(val, "IPAddressType", &v.IPAddressType) + delete(rawMsg, key) + case "label": + err = unpopulate(val, "Label", &v.Label) + delete(rawMsg, key) + case "macAddress": + err = unpopulate(val, "MacAddress", &v.MacAddress) + delete(rawMsg, key) + case "networkName": + err = unpopulate(val, "NetworkName", &v.NetworkName) + delete(rawMsg, key) + case "nicId": + err = unpopulate(val, "NicID", &v.NicID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VmwareRunAsAccountResource. +func (v VmwareRunAsAccountResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "systemData", v.SystemData) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VmwareRunAsAccountResource. +func (v *VmwareRunAsAccountResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &v.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VmwareRunAsAccountResourceListResult. +func (v VmwareRunAsAccountResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VmwareRunAsAccountResourceListResult. +func (v *VmwareRunAsAccountResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VmwareSite. +func (v VmwareSite) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "eTag", v.ETag) + populate(objectMap, "id", v.ID) + populate(objectMap, "location", v.Location) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "systemData", v.SystemData) + populate(objectMap, "tags", v.Tags) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VmwareSite. +func (v *VmwareSite) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "eTag": + err = unpopulate(val, "ETag", &v.ETag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &v.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &v.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &v.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VmwareSiteListResult. +func (v VmwareSiteListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VmwareSiteListResult. +func (v *VmwareSiteListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VmwareSiteUpdate. +func (v VmwareSiteUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "tags", v.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VmwareSiteUpdate. +func (v *VmwareSiteUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &v.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VmwareSiteUpdateProperties. +func (v VmwareSiteUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "agentDetails", v.AgentDetails) + populate(objectMap, "applianceName", v.ApplianceName) + populate(objectMap, "discoverySolutionId", v.DiscoverySolutionID) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "servicePrincipalIdentityDetails", v.ServicePrincipalIdentityDetails) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VmwareSiteUpdateProperties. +func (v *VmwareSiteUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "agentDetails": + err = unpopulate(val, "AgentDetails", &v.AgentDetails) + delete(rawMsg, key) + case "applianceName": + err = unpopulate(val, "ApplianceName", &v.ApplianceName) + delete(rawMsg, key) + case "discoverySolutionId": + err = unpopulate(val, "DiscoverySolutionID", &v.DiscoverySolutionID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "servicePrincipalIdentityDetails": + err = unpopulate(val, "ServicePrincipalIdentityDetails", &v.ServicePrincipalIdentityDetails) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VmwareSiteUsage. +func (v VmwareSiteUsage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "machineCount", v.MachineCount) + populate(objectMap, "runAsAccountCount", v.RunAsAccountCount) + populate(objectMap, "vCenterCount", v.VCenterCount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VmwareSiteUsage. +func (v *VmwareSiteUsage) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "machineCount": + err = unpopulate(val, "MachineCount", &v.MachineCount) + delete(rawMsg, key) + case "runAsAccountCount": + err = unpopulate(val, "RunAsAccountCount", &v.RunAsAccountCount) + delete(rawMsg, key) + case "vCenterCount": + err = unpopulate(val, "VCenterCount", &v.VCenterCount) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebAppDiscovery. +func (w WebAppDiscovery) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "discoveryScopeStatus", w.DiscoveryScopeStatus) + populate(objectMap, "totalWebApplicationCount", w.TotalWebApplicationCount) + populate(objectMap, "totalWebServerCount", w.TotalWebServerCount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebAppDiscovery. +func (w *WebAppDiscovery) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "discoveryScopeStatus": + err = unpopulate(val, "DiscoveryScopeStatus", &w.DiscoveryScopeStatus) + delete(rawMsg, key) + case "totalWebApplicationCount": + err = unpopulate(val, "TotalWebApplicationCount", &w.TotalWebApplicationCount) + delete(rawMsg, key) + case "totalWebServerCount": + err = unpopulate(val, "TotalWebServerCount", &w.TotalWebServerCount) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebAppExtendedMachine. +func (w WebAppExtendedMachine) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", w.ID) + populate(objectMap, "name", w.Name) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "systemData", w.SystemData) + populate(objectMap, "type", w.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebAppExtendedMachine. +func (w *WebAppExtendedMachine) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &w.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &w.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &w.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &w.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &w.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebAppExtendedMachineListResult. +func (w WebAppExtendedMachineListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", w.NextLink) + populate(objectMap, "value", w.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebAppExtendedMachineListResult. +func (w *WebAppExtendedMachineListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &w.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &w.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebAppExtendedMachineProperties. +func (w WebAppExtendedMachineProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "createdTimestamp", w.CreatedTimestamp) + populate(objectMap, "errors", w.Errors) + populate(objectMap, "hostName", w.HostName) + populate(objectMap, "hydratedRunAsAccountId", w.HydratedRunAsAccountID) + populate(objectMap, "isDeleted", w.IsDeleted) + populate(objectMap, "machineDisplayName", w.MachineDisplayName) + populate(objectMap, "machineId", w.MachineID) + populate(objectMap, "provisioningState", w.ProvisioningState) + populate(objectMap, "runAsAccountId", w.RunAsAccountID) + populate(objectMap, "updatedTimestamp", w.UpdatedTimestamp) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebAppExtendedMachineProperties. +func (w *WebAppExtendedMachineProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdTimestamp": + err = unpopulate(val, "CreatedTimestamp", &w.CreatedTimestamp) + delete(rawMsg, key) + case "errors": + err = unpopulate(val, "Errors", &w.Errors) + delete(rawMsg, key) + case "hostName": + err = unpopulate(val, "HostName", &w.HostName) + delete(rawMsg, key) + case "hydratedRunAsAccountId": + err = unpopulate(val, "HydratedRunAsAccountID", &w.HydratedRunAsAccountID) + delete(rawMsg, key) + case "isDeleted": + err = unpopulate(val, "IsDeleted", &w.IsDeleted) + delete(rawMsg, key) + case "machineDisplayName": + err = unpopulate(val, "MachineDisplayName", &w.MachineDisplayName) + delete(rawMsg, key) + case "machineId": + err = unpopulate(val, "MachineID", &w.MachineID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &w.ProvisioningState) + delete(rawMsg, key) + case "runAsAccountId": + err = unpopulate(val, "RunAsAccountID", &w.RunAsAccountID) + delete(rawMsg, key) + case "updatedTimestamp": + err = unpopulate(val, "UpdatedTimestamp", &w.UpdatedTimestamp) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebAppProperties. +func (w WebAppProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tags", w.Tags) + populate(objectMap, "webAppArmId", w.WebAppArmID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebAppProperties. +func (w *WebAppProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tags": + err = unpopulate(val, "Tags", &w.Tags) + delete(rawMsg, key) + case "webAppArmId": + err = unpopulate(val, "WebAppArmID", &w.WebAppArmID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebAppPropertiesCollection. +func (w WebAppPropertiesCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "webApps", w.WebApps) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebAppPropertiesCollection. +func (w *WebAppPropertiesCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "webApps": + err = unpopulate(val, "WebApps", &w.WebApps) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebAppRunAsAccount. +func (w WebAppRunAsAccount) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", w.ID) + populate(objectMap, "name", w.Name) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "systemData", w.SystemData) + populate(objectMap, "type", w.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebAppRunAsAccount. +func (w *WebAppRunAsAccount) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &w.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &w.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &w.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &w.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &w.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebAppRunAsAccountListResult. +func (w WebAppRunAsAccountListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", w.NextLink) + populate(objectMap, "value", w.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebAppRunAsAccountListResult. +func (w *WebAppRunAsAccountListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &w.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &w.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebAppSite. +func (w WebAppSite) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", w.ID) + populate(objectMap, "name", w.Name) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "systemData", w.SystemData) + populate(objectMap, "type", w.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebAppSite. +func (w *WebAppSite) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &w.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &w.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &w.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &w.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &w.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebAppSiteListResult. +func (w WebAppSiteListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", w.NextLink) + populate(objectMap, "value", w.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebAppSiteListResult. +func (w *WebAppSiteListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &w.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &w.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebAppSiteProperties. +func (w WebAppSiteProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "discoveryScenario", w.DiscoveryScenario) + populate(objectMap, "provisioningState", w.ProvisioningState) + populate(objectMap, "serviceEndpoint", w.ServiceEndpoint) + populate(objectMap, "siteAppliancePropertiesCollection", w.SiteAppliancePropertiesCollection) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebAppSiteProperties. +func (w *WebAppSiteProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) } for key, val := range rawMsg { var err error switch key { - case "groupId": - err = unpopulate(val, "GroupID", &p.GroupID) + case "discoveryScenario": + err = unpopulate(val, "DiscoveryScenario", &w.DiscoveryScenario) delete(rawMsg, key) - case "requiredMembers": - err = unpopulate(val, "RequiredMembers", &p.RequiredMembers) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &w.ProvisioningState) delete(rawMsg, key) - case "requiredZoneNames": - err = unpopulate(val, "RequiredZoneNames", &p.RequiredZoneNames) + case "serviceEndpoint": + err = unpopulate(val, "ServiceEndpoint", &w.ServiceEndpoint) + delete(rawMsg, key) + case "siteAppliancePropertiesCollection": + err = unpopulate(val, "SiteAppliancePropertiesCollection", &w.SiteAppliancePropertiesCollection) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", w, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionState. -func (p PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type WebAppSiteUpdate. +func (w WebAppSiteUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "actionsRequired", p.ActionsRequired) - populate(objectMap, "description", p.Description) - populate(objectMap, "status", p.Status) + populate(objectMap, "properties", w.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnectionState. -func (p *PrivateLinkServiceConnectionState) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type WebAppSiteUpdate. +func (w *WebAppSiteUpdate) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", w, err) } for key, val := range rawMsg { var err error switch key { - case "actionsRequired": - err = unpopulate(val, "ActionsRequired", &p.ActionsRequired) + case "properties": + err = unpopulate(val, "Properties", &w.Properties) delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &p.Description) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebAppSiteUpdateProperties. +func (w WebAppSiteUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "discoveryScenario", w.DiscoveryScenario) + populate(objectMap, "siteAppliancePropertiesCollection", w.SiteAppliancePropertiesCollection) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebAppSiteUpdateProperties. +func (w *WebAppSiteUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "discoveryScenario": + err = unpopulate(val, "DiscoveryScenario", &w.DiscoveryScenario) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &p.Status) + case "siteAppliancePropertiesCollection": + err = unpopulate(val, "SiteAppliancePropertiesCollection", &w.SiteAppliancePropertiesCollection) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", w, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Project. -func (p Project) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type WebAppSiteUsage. +func (w WebAppSiteUsage) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "eTag", p.ETag) - populate(objectMap, "id", p.ID) - populate(objectMap, "location", p.Location) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populateAny(objectMap, "tags", p.Tags) - populate(objectMap, "type", p.Type) + populate(objectMap, "runAsAccountCount", w.RunAsAccountCount) + populate(objectMap, "webApplicationCount", w.WebApplicationCount) + populate(objectMap, "webServerCount", w.WebServerCount) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Project. -func (p *Project) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type WebAppSiteUsage. +func (w *WebAppSiteUsage) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", w, err) } for key, val := range rawMsg { var err error switch key { - case "eTag": - err = unpopulate(val, "ETag", &p.ETag) + case "runAsAccountCount": + err = unpopulate(val, "RunAsAccountCount", &w.RunAsAccountCount) delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &p.ID) + case "webApplicationCount": + err = unpopulate(val, "WebApplicationCount", &w.WebApplicationCount) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &p.Location) + case "webServerCount": + err = unpopulate(val, "WebServerCount", &w.WebServerCount) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebApplication. +func (w WebApplication) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", w.ID) + populate(objectMap, "name", w.Name) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "systemData", w.SystemData) + populate(objectMap, "type", w.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebApplication. +func (w *WebApplication) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &w.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &p.Name) + err = unpopulate(val, "Name", &w.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &p.Properties) + err = unpopulate(val, "Properties", &w.Properties) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &p.Tags) + case "systemData": + err = unpopulate(val, "SystemData", &w.SystemData) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &p.Type) + err = unpopulate(val, "Type", &w.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", w, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ProjectProperties. -func (p ProjectProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type WebApplicationAppsAndRolesModel. +func (w WebApplicationAppsAndRolesModel) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "assessmentSolutionId", p.AssessmentSolutionID) - populateDateTimeRFC3339(objectMap, "createdTimestamp", p.CreatedTimestamp) - populate(objectMap, "customerStorageAccountArmId", p.CustomerStorageAccountArmID) - populate(objectMap, "customerWorkspaceId", p.CustomerWorkspaceID) - populate(objectMap, "customerWorkspaceLocation", p.CustomerWorkspaceLocation) - populateDateTimeRFC3339(objectMap, "lastAssessmentTimestamp", p.LastAssessmentTimestamp) - populate(objectMap, "numberOfAssessments", p.NumberOfAssessments) - populate(objectMap, "numberOfGroups", p.NumberOfGroups) - populate(objectMap, "numberOfMachines", p.NumberOfMachines) - populate(objectMap, "privateEndpointConnections", p.PrivateEndpointConnections) - populate(objectMap, "projectStatus", p.ProjectStatus) - populate(objectMap, "provisioningState", p.ProvisioningState) - populate(objectMap, "publicNetworkAccess", p.PublicNetworkAccess) - populate(objectMap, "serviceEndpoint", p.ServiceEndpoint) - populateDateTimeRFC3339(objectMap, "updatedTimestamp", p.UpdatedTimestamp) + populate(objectMap, "applicationPool", w.ApplicationPool) + populate(objectMap, "groupName", w.GroupName) + populate(objectMap, "name", w.Name) + populate(objectMap, "platform", w.Platform) + populate(objectMap, "status", w.Status) + populate(objectMap, "webServer", w.WebServer) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProjectProperties. -func (p *ProjectProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type WebApplicationAppsAndRolesModel. +func (w *WebApplicationAppsAndRolesModel) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", w, err) } for key, val := range rawMsg { var err error switch key { - case "assessmentSolutionId": - err = unpopulate(val, "AssessmentSolutionID", &p.AssessmentSolutionID) + case "applicationPool": + err = unpopulate(val, "ApplicationPool", &w.ApplicationPool) delete(rawMsg, key) - case "createdTimestamp": - err = unpopulateDateTimeRFC3339(val, "CreatedTimestamp", &p.CreatedTimestamp) - delete(rawMsg, key) - case "customerStorageAccountArmId": - err = unpopulate(val, "CustomerStorageAccountArmID", &p.CustomerStorageAccountArmID) - delete(rawMsg, key) - case "customerWorkspaceId": - err = unpopulate(val, "CustomerWorkspaceID", &p.CustomerWorkspaceID) - delete(rawMsg, key) - case "customerWorkspaceLocation": - err = unpopulate(val, "CustomerWorkspaceLocation", &p.CustomerWorkspaceLocation) - delete(rawMsg, key) - case "lastAssessmentTimestamp": - err = unpopulateDateTimeRFC3339(val, "LastAssessmentTimestamp", &p.LastAssessmentTimestamp) - delete(rawMsg, key) - case "numberOfAssessments": - err = unpopulate(val, "NumberOfAssessments", &p.NumberOfAssessments) - delete(rawMsg, key) - case "numberOfGroups": - err = unpopulate(val, "NumberOfGroups", &p.NumberOfGroups) + case "groupName": + err = unpopulate(val, "GroupName", &w.GroupName) delete(rawMsg, key) - case "numberOfMachines": - err = unpopulate(val, "NumberOfMachines", &p.NumberOfMachines) - delete(rawMsg, key) - case "privateEndpointConnections": - err = unpopulate(val, "PrivateEndpointConnections", &p.PrivateEndpointConnections) - delete(rawMsg, key) - case "projectStatus": - err = unpopulate(val, "ProjectStatus", &p.ProjectStatus) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + case "name": + err = unpopulate(val, "Name", &w.Name) delete(rawMsg, key) - case "publicNetworkAccess": - err = unpopulate(val, "PublicNetworkAccess", &p.PublicNetworkAccess) + case "platform": + err = unpopulate(val, "Platform", &w.Platform) delete(rawMsg, key) - case "serviceEndpoint": - err = unpopulate(val, "ServiceEndpoint", &p.ServiceEndpoint) + case "status": + err = unpopulate(val, "Status", &w.Status) delete(rawMsg, key) - case "updatedTimestamp": - err = unpopulateDateTimeRFC3339(val, "UpdatedTimestamp", &p.UpdatedTimestamp) + case "webServer": + err = unpopulate(val, "WebServer", &w.WebServer) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", w, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ProjectResultList. -func (p ProjectResultList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type WebApplicationConfigurationUnit. +func (w WebApplicationConfigurationUnit) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) + populate(objectMap, "filePath", w.FilePath) + populate(objectMap, "identifier", w.Identifier) + populate(objectMap, "isDeploymentTimeEditable", w.IsDeploymentTimeEditable) + populate(objectMap, "localFilePath", w.LocalFilePath) + populate(objectMap, "name", w.Name) + populate(objectMap, "section", w.Section) + populate(objectMap, "targetFilePath", w.TargetFilePath) + populate(objectMap, "type", w.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProjectResultList. -func (p *ProjectResultList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type WebApplicationConfigurationUnit. +func (w *WebApplicationConfigurationUnit) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", w, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &p.NextLink) + case "filePath": + err = unpopulate(val, "FilePath", &w.FilePath) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &p.Value) + case "identifier": + err = unpopulate(val, "Identifier", &w.Identifier) + delete(rawMsg, key) + case "isDeploymentTimeEditable": + err = unpopulate(val, "IsDeploymentTimeEditable", &w.IsDeploymentTimeEditable) + delete(rawMsg, key) + case "localFilePath": + err = unpopulate(val, "LocalFilePath", &w.LocalFilePath) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &w.Name) + delete(rawMsg, key) + case "section": + err = unpopulate(val, "Section", &w.Section) + delete(rawMsg, key) + case "targetFilePath": + err = unpopulate(val, "TargetFilePath", &w.TargetFilePath) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &w.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", w, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourceID. -func (r ResourceID) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type WebApplicationDirectoryUnit. +func (w WebApplicationDirectoryUnit) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) + populate(objectMap, "id", w.ID) + populate(objectMap, "isEditable", w.IsEditable) + populate(objectMap, "localScratchPath", w.LocalScratchPath) + populate(objectMap, "mountPath", w.MountPath) + populate(objectMap, "sourcePaths", w.SourcePaths) + populate(objectMap, "sourceSize", w.SourceSize) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceID. -func (r *ResourceID) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type WebApplicationDirectoryUnit. +func (w *WebApplicationDirectoryUnit) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", w, err) } for key, val := range rawMsg { var err error switch key { case "id": - err = unpopulate(val, "ID", &r.ID) + err = unpopulate(val, "ID", &w.ID) + delete(rawMsg, key) + case "isEditable": + err = unpopulate(val, "IsEditable", &w.IsEditable) + delete(rawMsg, key) + case "localScratchPath": + err = unpopulate(val, "LocalScratchPath", &w.LocalScratchPath) + delete(rawMsg, key) + case "mountPath": + err = unpopulate(val, "MountPath", &w.MountPath) + delete(rawMsg, key) + case "sourcePaths": + err = unpopulate(val, "SourcePaths", &w.SourcePaths) + delete(rawMsg, key) + case "sourceSize": + err = unpopulate(val, "SourceSize", &w.SourceSize) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", w, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerCollector. -func (s ServerCollector) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type WebApplicationFramework. +func (w WebApplicationFramework) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "eTag", s.ETag) - populate(objectMap, "id", s.ID) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "type", s.Type) + populate(objectMap, "name", w.Name) + populate(objectMap, "version", w.Version) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerCollector. -func (s *ServerCollector) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type WebApplicationFramework. +func (w *WebApplicationFramework) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", w, err) } for key, val := range rawMsg { var err error switch key { - case "eTag": - err = unpopulate(val, "ETag", &s.ETag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &s.Name) + err = unpopulate(val, "Name", &w.Name) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) + case "version": + err = unpopulate(val, "Version", &w.Version) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", w, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerCollectorList. -func (s ServerCollectorList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type WebApplicationListResult. +func (w WebApplicationListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", s.Value) + populate(objectMap, "nextLink", w.NextLink) + populate(objectMap, "value", w.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerCollectorList. -func (s *ServerCollectorList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type WebApplicationListResult. +func (w *WebApplicationListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", w, err) } for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &w.NextLink) + delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &s.Value) + err = unpopulate(val, "Value", &w.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", w, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type UpdateGroupBody. -func (u UpdateGroupBody) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type WebApplicationProperties. +func (w WebApplicationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "eTag", u.ETag) - populate(objectMap, "properties", u.Properties) + populate(objectMap, "applianceNames", w.ApplianceNames) + populate(objectMap, "bindings", w.Bindings) + populate(objectMap, "configurations", w.Configurations) + populate(objectMap, "createdTimestamp", w.CreatedTimestamp) + populate(objectMap, "directories", w.Directories) + populate(objectMap, "displayName", w.DisplayName) + populate(objectMap, "errors", w.Errors) + populate(objectMap, "frameworks", w.Frameworks) + populate(objectMap, "hasErrors", w.HasErrors) + populate(objectMap, "isDeleted", w.IsDeleted) + populate(objectMap, "machineArmIds", w.MachineArmIDs) + populate(objectMap, "machineDisplayName", w.MachineDisplayName) + populate(objectMap, "physicalPath", w.PhysicalPath) + populate(objectMap, "provisioningState", w.ProvisioningState) + populate(objectMap, "serverType", w.ServerType) + populate(objectMap, "staticFolders", w.StaticFolders) + populate(objectMap, "tags", w.Tags) + populate(objectMap, "updatedTimestamp", w.UpdatedTimestamp) + populate(objectMap, "virtualPath", w.VirtualPath) + populate(objectMap, "webServerId", w.WebServerID) + populate(objectMap, "webServerName", w.WebServerName) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateGroupBody. -func (u *UpdateGroupBody) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type WebApplicationProperties. +func (w *WebApplicationProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", w, err) } for key, val := range rawMsg { var err error switch key { - case "eTag": - err = unpopulate(val, "ETag", &u.ETag) + case "applianceNames": + err = unpopulate(val, "ApplianceNames", &w.ApplianceNames) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &u.Properties) + case "bindings": + err = unpopulate(val, "Bindings", &w.Bindings) + delete(rawMsg, key) + case "configurations": + err = unpopulate(val, "Configurations", &w.Configurations) + delete(rawMsg, key) + case "createdTimestamp": + err = unpopulate(val, "CreatedTimestamp", &w.CreatedTimestamp) + delete(rawMsg, key) + case "directories": + err = unpopulate(val, "Directories", &w.Directories) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &w.DisplayName) + delete(rawMsg, key) + case "errors": + err = unpopulate(val, "Errors", &w.Errors) + delete(rawMsg, key) + case "frameworks": + err = unpopulate(val, "Frameworks", &w.Frameworks) + delete(rawMsg, key) + case "hasErrors": + err = unpopulate(val, "HasErrors", &w.HasErrors) + delete(rawMsg, key) + case "isDeleted": + err = unpopulate(val, "IsDeleted", &w.IsDeleted) + delete(rawMsg, key) + case "machineArmIds": + err = unpopulate(val, "MachineArmIDs", &w.MachineArmIDs) + delete(rawMsg, key) + case "machineDisplayName": + err = unpopulate(val, "MachineDisplayName", &w.MachineDisplayName) + delete(rawMsg, key) + case "physicalPath": + err = unpopulate(val, "PhysicalPath", &w.PhysicalPath) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &w.ProvisioningState) + delete(rawMsg, key) + case "serverType": + err = unpopulate(val, "ServerType", &w.ServerType) + delete(rawMsg, key) + case "staticFolders": + err = unpopulate(val, "StaticFolders", &w.StaticFolders) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &w.Tags) + delete(rawMsg, key) + case "updatedTimestamp": + err = unpopulate(val, "UpdatedTimestamp", &w.UpdatedTimestamp) + delete(rawMsg, key) + case "virtualPath": + err = unpopulate(val, "VirtualPath", &w.VirtualPath) + delete(rawMsg, key) + case "webServerId": + err = unpopulate(val, "WebServerID", &w.WebServerID) + delete(rawMsg, key) + case "webServerName": + err = unpopulate(val, "WebServerName", &w.WebServerName) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", w, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type VMFamily. -func (v VMFamily) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type WebRoleImportDisk. +func (w WebRoleImportDisk) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "category", v.Category) - populate(objectMap, "familyName", v.FamilyName) - populate(objectMap, "targetLocations", v.TargetLocations) + populate(objectMap, "diskType", w.DiskType) + populate(objectMap, "lun", w.Lun) + populate(objectMap, "maxSizeInBytes", w.MaxSizeInBytes) + populate(objectMap, "megabytesPerSecondOfRead", w.MegabytesPerSecondOfRead) + populate(objectMap, "megabytesPerSecondOfWrite", w.MegabytesPerSecondOfWrite) + populate(objectMap, "name", w.Name) + populate(objectMap, "numberOfReadOperationsPerSecond", w.NumberOfReadOperationsPerSecond) + populate(objectMap, "numberOfWriteOperationsPerSecond", w.NumberOfWriteOperationsPerSecond) + populate(objectMap, "path", w.Path) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VMFamily. -func (v *VMFamily) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type WebRoleImportDisk. +func (w *WebRoleImportDisk) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", w, err) } for key, val := range rawMsg { var err error switch key { - case "category": - err = unpopulate(val, "Category", &v.Category) + case "diskType": + err = unpopulate(val, "DiskType", &w.DiskType) + delete(rawMsg, key) + case "lun": + err = unpopulate(val, "Lun", &w.Lun) + delete(rawMsg, key) + case "maxSizeInBytes": + err = unpopulate(val, "MaxSizeInBytes", &w.MaxSizeInBytes) + delete(rawMsg, key) + case "megabytesPerSecondOfRead": + err = unpopulate(val, "MegabytesPerSecondOfRead", &w.MegabytesPerSecondOfRead) + delete(rawMsg, key) + case "megabytesPerSecondOfWrite": + err = unpopulate(val, "MegabytesPerSecondOfWrite", &w.MegabytesPerSecondOfWrite) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &w.Name) + delete(rawMsg, key) + case "numberOfReadOperationsPerSecond": + err = unpopulate(val, "NumberOfReadOperationsPerSecond", &w.NumberOfReadOperationsPerSecond) delete(rawMsg, key) - case "familyName": - err = unpopulate(val, "FamilyName", &v.FamilyName) + case "numberOfWriteOperationsPerSecond": + err = unpopulate(val, "NumberOfWriteOperationsPerSecond", &w.NumberOfWriteOperationsPerSecond) delete(rawMsg, key) - case "targetLocations": - err = unpopulate(val, "TargetLocations", &v.TargetLocations) + case "path": + err = unpopulate(val, "Path", &w.Path) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", w, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type VMUptime. -func (v VMUptime) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type WebRoleOperatingSystem. +func (w WebRoleOperatingSystem) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "daysPerMonth", v.DaysPerMonth) - populate(objectMap, "hoursPerDay", v.HoursPerDay) + populate(objectMap, "osArchitecture", w.OSArchitecture) + populate(objectMap, "osName", w.OSName) + populate(objectMap, "osType", w.OSType) + populate(objectMap, "osVersion", w.OSVersion) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VMUptime. -func (v *VMUptime) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type WebRoleOperatingSystem. +func (w *WebRoleOperatingSystem) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", w, err) } for key, val := range rawMsg { var err error switch key { - case "daysPerMonth": - err = unpopulate(val, "DaysPerMonth", &v.DaysPerMonth) + case "osArchitecture": + err = unpopulate(val, "OSArchitecture", &w.OSArchitecture) + delete(rawMsg, key) + case "osName": + err = unpopulate(val, "OSName", &w.OSName) delete(rawMsg, key) - case "hoursPerDay": - err = unpopulate(val, "HoursPerDay", &v.HoursPerDay) + case "osType": + err = unpopulate(val, "OSType", &w.OSType) + delete(rawMsg, key) + case "osVersion": + err = unpopulate(val, "OSVersion", &w.OSVersion) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", w, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type VMwareCollector. -func (v VMwareCollector) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type WebServer. +func (w WebServer) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "eTag", v.ETag) - populate(objectMap, "id", v.ID) - populate(objectMap, "name", v.Name) - populate(objectMap, "properties", v.Properties) - populate(objectMap, "type", v.Type) + populate(objectMap, "id", w.ID) + populate(objectMap, "name", w.Name) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "systemData", w.SystemData) + populate(objectMap, "type", w.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VMwareCollector. -func (v *VMwareCollector) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type WebServer. +func (w *WebServer) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", w, err) } for key, val := range rawMsg { var err error switch key { - case "eTag": - err = unpopulate(val, "ETag", &v.ETag) - delete(rawMsg, key) case "id": - err = unpopulate(val, "ID", &v.ID) + err = unpopulate(val, "ID", &w.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &v.Name) + err = unpopulate(val, "Name", &w.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &v.Properties) + err = unpopulate(val, "Properties", &w.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &w.SystemData) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &v.Type) + err = unpopulate(val, "Type", &w.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", w, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type VMwareCollectorList. -func (v VMwareCollectorList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type WebServerListResult. +func (w WebServerListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", v.Value) + populate(objectMap, "nextLink", w.NextLink) + populate(objectMap, "value", w.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VMwareCollectorList. -func (v *VMwareCollectorList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type WebServerListResult. +func (w *WebServerListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", w, err) } for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &w.NextLink) + delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &v.Value) + err = unpopulate(val, "Value", &w.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebServerProperties. +func (w WebServerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "applianceNames", w.ApplianceNames) + populate(objectMap, "configurationLocation", w.ConfigurationLocation) + populate(objectMap, "createdTimestamp", w.CreatedTimestamp) + populate(objectMap, "displayName", w.DisplayName) + populate(objectMap, "errors", w.Errors) + populate(objectMap, "hasErrors", w.HasErrors) + populate(objectMap, "isDeleted", w.IsDeleted) + populate(objectMap, "machineIds", w.MachineIDs) + populate(objectMap, "provisioningState", w.ProvisioningState) + populate(objectMap, "runAsAccountId", w.RunAsAccountID) + populate(objectMap, "serverFqdn", w.ServerFqdn) + populate(objectMap, "serverType", w.ServerType) + populate(objectMap, "updatedTimestamp", w.UpdatedTimestamp) + populate(objectMap, "version", w.Version) + populate(objectMap, "webApplications", w.WebApplications) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebServerProperties. +func (w *WebServerProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "applianceNames": + err = unpopulate(val, "ApplianceNames", &w.ApplianceNames) + delete(rawMsg, key) + case "configurationLocation": + err = unpopulate(val, "ConfigurationLocation", &w.ConfigurationLocation) + delete(rawMsg, key) + case "createdTimestamp": + err = unpopulate(val, "CreatedTimestamp", &w.CreatedTimestamp) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &w.DisplayName) + delete(rawMsg, key) + case "errors": + err = unpopulate(val, "Errors", &w.Errors) + delete(rawMsg, key) + case "hasErrors": + err = unpopulate(val, "HasErrors", &w.HasErrors) + delete(rawMsg, key) + case "isDeleted": + err = unpopulate(val, "IsDeleted", &w.IsDeleted) + delete(rawMsg, key) + case "machineIds": + err = unpopulate(val, "MachineIDs", &w.MachineIDs) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &w.ProvisioningState) + delete(rawMsg, key) + case "runAsAccountId": + err = unpopulate(val, "RunAsAccountID", &w.RunAsAccountID) + delete(rawMsg, key) + case "serverFqdn": + err = unpopulate(val, "ServerFqdn", &w.ServerFqdn) + delete(rawMsg, key) + case "serverType": + err = unpopulate(val, "ServerType", &w.ServerType) + delete(rawMsg, key) + case "updatedTimestamp": + err = unpopulate(val, "UpdatedTimestamp", &w.UpdatedTimestamp) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &w.Version) + delete(rawMsg, key) + case "webApplications": + err = unpopulate(val, "WebApplications", &w.WebApplications) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) } } return nil diff --git a/sdk/resourcemanager/migrate/armmigrate/operations_client.go b/sdk/resourcemanager/migrate/armmigrate/operations_client.go index 6b386c87504c..4bb3de3bce73 100644 --- a/sdk/resourcemanager/migrate/armmigrate/operations_client.go +++ b/sdk/resourcemanager/migrate/armmigrate/operations_client.go @@ -37,28 +37,27 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO return client, nil } -// NewListPager - Get a list of REST API supported by Microsoft.Migrate provider. +// NewListPager - List the operations for the provider // -// Generated from API version 2019-10-01 +// Generated from API version 2023-10-01-preview // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ More: func(page OperationsClientListResponse) bool { - return false + return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewListPager") - req, err := client.listCreateRequest(ctx, options) - if err != nil { - return OperationsClientListResponse{}, err + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) if err != nil { return OperationsClientListResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return OperationsClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) }, Tracer: client.internal.Tracer(), @@ -67,11 +66,14 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption // listCreateRequest creates the List request. func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.Migrate/operations" + urlPath := "/providers/Microsoft.OffAzure/operations" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -79,7 +81,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * // listHandleResponse handles the List response. func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { result := OperationsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperationResultList); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { return OperationsClientListResponse{}, err } return result, nil diff --git a/sdk/resourcemanager/migrate/armmigrate/operations_client_example_test.go b/sdk/resourcemanager/migrate/armmigrate/operations_client_example_test.go deleted file mode 100644 index 010dbea04578..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/operations_client_example_test.go +++ /dev/null @@ -1,66 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmigrate_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Operations_List.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationResultList = armmigrate.OperationResultList{ - // Value: []*armmigrate.Operation{ - // { - // Name: to.Ptr("Read"), - // Display: &armmigrate.OperationDisplay{ - // Description: to.Ptr("Reads a project"), - // Operation: to.Ptr("Read"), - // Provider: to.Ptr("Microsoft.Migrate"), - // Resource: to.Ptr("Microsoft.Migrate/assessmentProjects"), - // }, - // Origin: to.Ptr("user,system"), - // }, - // { - // Name: to.Ptr("Write"), - // Display: &armmigrate.OperationDisplay{ - // Description: to.Ptr("Creates or updates a project"), - // Operation: to.Ptr("Write"), - // Provider: to.Ptr("Microsoft.Migrate"), - // Resource: to.Ptr("Microsoft.Migrate/assessmentProjects"), - // }, - // Origin: to.Ptr("user,system"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/migrate/armmigrate/options.go b/sdk/resourcemanager/migrate/armmigrate/options.go index 49e70067f93c..3bffd8fb6a14 100644 --- a/sdk/resourcemanager/migrate/armmigrate/options.go +++ b/sdk/resourcemanager/migrate/armmigrate/options.go @@ -8,256 +8,1345 @@ package armmigrate -// AssessedMachinesClientGetOptions contains the optional parameters for the AssessedMachinesClient.Get method. -type AssessedMachinesClientGetOptions struct { +// DependencyMapControllerClientBeginClientGroupMembersOptions contains the optional parameters for the DependencyMapControllerClient.BeginClientGroupMembers +// method. +type DependencyMapControllerClientBeginClientGroupMembersOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DependencyMapControllerClientBeginExportDependenciesOptions contains the optional parameters for the DependencyMapControllerClient.BeginExportDependencies +// method. +type DependencyMapControllerClientBeginExportDependenciesOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DependencyMapControllerClientBeginGenerateCoarseMapOptions contains the optional parameters for the DependencyMapControllerClient.BeginGenerateCoarseMap +// method. +type DependencyMapControllerClientBeginGenerateCoarseMapOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DependencyMapControllerClientBeginGenerateDetailedMapOptions contains the optional parameters for the DependencyMapControllerClient.BeginGenerateDetailedMap +// method. +type DependencyMapControllerClientBeginGenerateDetailedMapOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DependencyMapControllerClientBeginServerGroupMembersOptions contains the optional parameters for the DependencyMapControllerClient.BeginServerGroupMembers +// method. +type DependencyMapControllerClientBeginServerGroupMembersOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// HypervClusterControllerClientBeginCreateClusterOptions contains the optional parameters for the HypervClusterControllerClient.BeginCreateCluster +// method. +type HypervClusterControllerClientBeginCreateClusterOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// HypervClusterControllerClientDeleteOptions contains the optional parameters for the HypervClusterControllerClient.Delete +// method. +type HypervClusterControllerClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// HypervClusterControllerClientGetClusterOptions contains the optional parameters for the HypervClusterControllerClient.GetCluster +// method. +type HypervClusterControllerClientGetClusterOptions struct { + // placeholder for future optional parameters +} + +// HypervClusterControllerClientListByHypervSiteOptions contains the optional parameters for the HypervClusterControllerClient.NewListByHypervSitePager +// method. +type HypervClusterControllerClientListByHypervSiteOptions struct { + // filter query + Filter *string +} + +// HypervDependencyMapControllerClientBeginClientGroupMembersOptions contains the optional parameters for the HypervDependencyMapControllerClient.BeginClientGroupMembers +// method. +type HypervDependencyMapControllerClientBeginClientGroupMembersOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// HypervDependencyMapControllerClientBeginExportDependenciesOptions contains the optional parameters for the HypervDependencyMapControllerClient.BeginExportDependencies +// method. +type HypervDependencyMapControllerClientBeginExportDependenciesOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// HypervDependencyMapControllerClientBeginGenerateCoarseMapOptions contains the optional parameters for the HypervDependencyMapControllerClient.BeginGenerateCoarseMap +// method. +type HypervDependencyMapControllerClientBeginGenerateCoarseMapOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// HypervDependencyMapControllerClientBeginGenerateDetailedMapOptions contains the optional parameters for the HypervDependencyMapControllerClient.BeginGenerateDetailedMap +// method. +type HypervDependencyMapControllerClientBeginGenerateDetailedMapOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// HypervDependencyMapControllerClientBeginServerGroupMembersOptions contains the optional parameters for the HypervDependencyMapControllerClient.BeginServerGroupMembers +// method. +type HypervDependencyMapControllerClientBeginServerGroupMembersOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// HypervDependencyMapControllerClientBeginUpdateDependencyMapStatusOptions contains the optional parameters for the HypervDependencyMapControllerClient.BeginUpdateDependencyMapStatus +// method. +type HypervDependencyMapControllerClientBeginUpdateDependencyMapStatusOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// HypervHostControllerClientBeginCreateOptions contains the optional parameters for the HypervHostControllerClient.BeginCreate +// method. +type HypervHostControllerClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// HypervHostControllerClientBeginDeleteOptions contains the optional parameters for the HypervHostControllerClient.BeginDelete +// method. +type HypervHostControllerClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// HypervHostControllerClientGetOptions contains the optional parameters for the HypervHostControllerClient.Get method. +type HypervHostControllerClientGetOptions struct { + // placeholder for future optional parameters +} + +// HypervHostControllerClientListByHypervSiteOptions contains the optional parameters for the HypervHostControllerClient.NewListByHypervSitePager +// method. +type HypervHostControllerClientListByHypervSiteOptions struct { + // filter query + Filter *string +} + +// HypervJobsClientGetOptions contains the optional parameters for the HypervJobsClient.Get method. +type HypervJobsClientGetOptions struct { + // placeholder for future optional parameters +} + +// HypervJobsClientListByHypervSiteOptions contains the optional parameters for the HypervJobsClient.NewListByHypervSitePager +// method. +type HypervJobsClientListByHypervSiteOptions struct { + // placeholder for future optional parameters +} + +// HypervJobsControllerClientGetOptions contains the optional parameters for the HypervJobsControllerClient.Get method. +type HypervJobsControllerClientGetOptions struct { + // placeholder for future optional parameters +} + +// HypervJobsControllerClientListByVmwareSiteOptions contains the optional parameters for the HypervJobsControllerClient.NewListByVmwareSitePager +// method. +type HypervJobsControllerClientListByVmwareSiteOptions struct { + // placeholder for future optional parameters +} + +// HypervMachinesControllerClientBeginUpdatePropertiesOptions contains the optional parameters for the HypervMachinesControllerClient.BeginUpdateProperties +// method. +type HypervMachinesControllerClientBeginUpdatePropertiesOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// HypervMachinesControllerClientGetOptions contains the optional parameters for the HypervMachinesControllerClient.Get method. +type HypervMachinesControllerClientGetOptions struct { + // placeholder for future optional parameters +} + +// HypervMachinesControllerClientListByHypervSiteOptions contains the optional parameters for the HypervMachinesControllerClient.NewListByHypervSitePager +// method. +type HypervMachinesControllerClientListByHypervSiteOptions struct { + // Optional parameter for continuation token. + ContinuationToken *string + + // filter query + Filter *string + + // page size query + Top *int32 + + // Total count of machines in the given site. + TotalRecordCount *int32 +} + +// HypervMachinesControllerClientUpdateOptions contains the optional parameters for the HypervMachinesControllerClient.Update +// method. +type HypervMachinesControllerClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// HypervOperationsStatusControllerClientGetHypervOperationsStatusOptions contains the optional parameters for the HypervOperationsStatusControllerClient.GetHypervOperationsStatus +// method. +type HypervOperationsStatusControllerClientGetHypervOperationsStatusOptions struct { + // placeholder for future optional parameters +} + +// HypervRunAsAccountsControllerClientGetOptions contains the optional parameters for the HypervRunAsAccountsControllerClient.Get +// method. +type HypervRunAsAccountsControllerClientGetOptions struct { + // placeholder for future optional parameters +} + +// HypervRunAsAccountsControllerClientListByHypervSiteOptions contains the optional parameters for the HypervRunAsAccountsControllerClient.NewListByHypervSitePager +// method. +type HypervRunAsAccountsControllerClientListByHypervSiteOptions struct { + // placeholder for future optional parameters +} + +// HypervSitesClientListByResourceGroupOptions contains the optional parameters for the HypervSitesClient.NewListByResourceGroupPager +// method. +type HypervSitesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// HypervSitesClientListBySubscriptionOptions contains the optional parameters for the HypervSitesClient.NewListBySubscriptionPager +// method. +type HypervSitesClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// HypervSitesControllerClientBeginExportApplicationsOptions contains the optional parameters for the HypervSitesControllerClient.BeginExportApplications +// method. +type HypervSitesControllerClientBeginExportApplicationsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// HypervSitesControllerClientBeginExportMachineErrorsOptions contains the optional parameters for the HypervSitesControllerClient.BeginExportMachineErrors +// method. +type HypervSitesControllerClientBeginExportMachineErrorsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// HypervSitesControllerClientComputeErrorSummaryOptions contains the optional parameters for the HypervSitesControllerClient.ComputeErrorSummary +// method. +type HypervSitesControllerClientComputeErrorSummaryOptions struct { + // placeholder for future optional parameters +} + +// HypervSitesControllerClientComputeusageOptions contains the optional parameters for the HypervSitesControllerClient.Computeusage +// method. +type HypervSitesControllerClientComputeusageOptions struct { + // placeholder for future optional parameters +} + +// HypervSitesControllerClientCreateOptions contains the optional parameters for the HypervSitesControllerClient.Create method. +type HypervSitesControllerClientCreateOptions struct { + // placeholder for future optional parameters +} + +// HypervSitesControllerClientDeleteOptions contains the optional parameters for the HypervSitesControllerClient.Delete method. +type HypervSitesControllerClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// HypervSitesControllerClientGetOptions contains the optional parameters for the HypervSitesControllerClient.Get method. +type HypervSitesControllerClientGetOptions struct { + // placeholder for future optional parameters +} + +// HypervSitesControllerClientListHealthSummaryOptions contains the optional parameters for the HypervSitesControllerClient.ListHealthSummary +// method. +type HypervSitesControllerClientListHealthSummaryOptions struct { + // placeholder for future optional parameters +} + +// HypervSitesControllerClientSummaryOptions contains the optional parameters for the HypervSitesControllerClient.Summary +// method. +type HypervSitesControllerClientSummaryOptions struct { + // placeholder for future optional parameters +} + +// HypervSitesControllerClientUpdateOptions contains the optional parameters for the HypervSitesControllerClient.Update method. +type HypervSitesControllerClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// HypervSoftwareInventoriesControllerClientGetMachineSoftwareInventoryOptions contains the optional parameters for the HypervSoftwareInventoriesControllerClient.GetMachineSoftwareInventory +// method. +type HypervSoftwareInventoriesControllerClientGetMachineSoftwareInventoryOptions struct { + // placeholder for future optional parameters +} + +// HypervSoftwareInventoriesControllerClientListByHypervMachineOptions contains the optional parameters for the HypervSoftwareInventoriesControllerClient.NewListByHypervMachinePager +// method. +type HypervSoftwareInventoriesControllerClientListByHypervMachineOptions struct { + // placeholder for future optional parameters +} + +// IisWebApplicationsControllerClientGetOptions contains the optional parameters for the IisWebApplicationsControllerClient.Get +// method. +type IisWebApplicationsControllerClientGetOptions struct { + // placeholder for future optional parameters +} + +// IisWebApplicationsControllerClientListByWebAppSiteOptions contains the optional parameters for the IisWebApplicationsControllerClient.NewListByWebAppSitePager +// method. +type IisWebApplicationsControllerClientListByWebAppSiteOptions struct { + // Optional parameter for continuation token. + ContinuationToken *string + + // filter query + Filter *string + + // page size query + Top *string + + // Total count of machines in the given site. + TotalRecordCount *int32 +} + +// IisWebApplicationsControllerClientUpdateOptions contains the optional parameters for the IisWebApplicationsControllerClient.Update +// method. +type IisWebApplicationsControllerClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// IisWebServersControllerClientGetOptions contains the optional parameters for the IisWebServersControllerClient.Get method. +type IisWebServersControllerClientGetOptions struct { + // placeholder for future optional parameters +} + +// IisWebServersControllerClientListByWebAppSiteOptions contains the optional parameters for the IisWebServersControllerClient.NewListByWebAppSitePager +// method. +type IisWebServersControllerClientListByWebAppSiteOptions struct { + // Optional parameter for continuation token. + ContinuationToken *string + + // filter query + Filter *string + + // page size query + Top *string + + // Total count of machines in the given site. + TotalRecordCount *int32 +} + +// ImportJobsControllerClientGetDeletejobOptions contains the optional parameters for the ImportJobsControllerClient.GetDeletejob +// method. +type ImportJobsControllerClientGetDeletejobOptions struct { + // placeholder for future optional parameters +} + +// ImportJobsControllerClientGetExportjobOptions contains the optional parameters for the ImportJobsControllerClient.GetExportjob +// method. +type ImportJobsControllerClientGetExportjobOptions struct { + // placeholder for future optional parameters +} + +// ImportJobsControllerClientGetImportjobOptions contains the optional parameters for the ImportJobsControllerClient.GetImportjob +// method. +type ImportJobsControllerClientGetImportjobOptions struct { + // placeholder for future optional parameters +} + +// ImportJobsControllerClientGetOptions contains the optional parameters for the ImportJobsControllerClient.Get method. +type ImportJobsControllerClientGetOptions struct { + // placeholder for future optional parameters +} + +// ImportJobsControllerClientListByImportSiteOptions contains the optional parameters for the ImportJobsControllerClient.NewListByImportSitePager +// method. +type ImportJobsControllerClientListByImportSiteOptions struct { + // placeholder for future optional parameters +} + +// ImportJobsControllerClientListDeletejobsOptions contains the optional parameters for the ImportJobsControllerClient.NewListDeletejobsPager +// method. +type ImportJobsControllerClientListDeletejobsOptions struct { + // placeholder for future optional parameters +} + +// ImportJobsControllerClientListExportjobsOptions contains the optional parameters for the ImportJobsControllerClient.NewListExportjobsPager +// method. +type ImportJobsControllerClientListExportjobsOptions struct { + // placeholder for future optional parameters +} + +// ImportJobsControllerClientListImportjobsOptions contains the optional parameters for the ImportJobsControllerClient.NewListImportjobsPager +// method. +type ImportJobsControllerClientListImportjobsOptions struct { + // placeholder for future optional parameters +} + +// ImportMachinesControllerClientDeleteOptions contains the optional parameters for the ImportMachinesControllerClient.Delete +// method. +type ImportMachinesControllerClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ImportMachinesControllerClientGetOptions contains the optional parameters for the ImportMachinesControllerClient.Get method. +type ImportMachinesControllerClientGetOptions struct { + // placeholder for future optional parameters +} + +// ImportMachinesControllerClientListByImportSiteOptions contains the optional parameters for the ImportMachinesControllerClient.NewListByImportSitePager +// method. +type ImportMachinesControllerClientListByImportSiteOptions struct { + // Optional parameter for continuation token. + ContinuationToken *string + + // filter query + Filter *string + + // page size query + Top *string + + // Total count of machines in the given site. + TotalRecordCount *int32 +} + +// ImportSitesControllerClientCreateOptions contains the optional parameters for the ImportSitesControllerClient.Create method. +type ImportSitesControllerClientCreateOptions struct { + // placeholder for future optional parameters +} + +// ImportSitesControllerClientDeleteImportedMachinesOptions contains the optional parameters for the ImportSitesControllerClient.DeleteImportedMachines +// method. +type ImportSitesControllerClientDeleteImportedMachinesOptions struct { + // placeholder for future optional parameters +} + +// ImportSitesControllerClientDeleteOptions contains the optional parameters for the ImportSitesControllerClient.Delete method. +type ImportSitesControllerClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ImportSitesControllerClientExportURIOptions contains the optional parameters for the ImportSitesControllerClient.ExportURI +// method. +type ImportSitesControllerClientExportURIOptions struct { + // placeholder for future optional parameters +} + +// ImportSitesControllerClientGetOptions contains the optional parameters for the ImportSitesControllerClient.Get method. +type ImportSitesControllerClientGetOptions struct { + // placeholder for future optional parameters +} + +// ImportSitesControllerClientImportURIOptions contains the optional parameters for the ImportSitesControllerClient.ImportURI +// method. +type ImportSitesControllerClientImportURIOptions struct { + // placeholder for future optional parameters +} + +// ImportSitesControllerClientListByResourceGroupOptions contains the optional parameters for the ImportSitesControllerClient.NewListByResourceGroupPager +// method. +type ImportSitesControllerClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ImportSitesControllerClientListBySubscriptionOptions contains the optional parameters for the ImportSitesControllerClient.NewListBySubscriptionPager +// method. +type ImportSitesControllerClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// ImportSitesControllerClientUpdateOptions contains the optional parameters for the ImportSitesControllerClient.Update method. +type ImportSitesControllerClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// MachinesControllerClientBeginStartOptions contains the optional parameters for the MachinesControllerClient.BeginStart +// method. +type MachinesControllerClientBeginStartOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MachinesControllerClientBeginStopOptions contains the optional parameters for the MachinesControllerClient.BeginStop method. +type MachinesControllerClientBeginStopOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MachinesControllerClientGetOptions contains the optional parameters for the MachinesControllerClient.Get method. +type MachinesControllerClientGetOptions struct { + // placeholder for future optional parameters +} + +// MachinesControllerClientListByVmwareSiteOptions contains the optional parameters for the MachinesControllerClient.NewListByVmwareSitePager +// method. +type MachinesControllerClientListByVmwareSiteOptions struct { + // Optional parameter for continuation token. + ContinuationToken *string + + // filter query + Filter *string + + // page size query + Top *int32 + + // Total count of machines in the given site. + TotalRecordCount *int32 +} + +// MachinesControllerClientUpdateOptions contains the optional parameters for the MachinesControllerClient.Update method. +type MachinesControllerClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// MasterSitesControllerClientBeginCreateOptions contains the optional parameters for the MasterSitesControllerClient.BeginCreate +// method. +type MasterSitesControllerClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MasterSitesControllerClientBeginUpdateOptions contains the optional parameters for the MasterSitesControllerClient.BeginUpdate +// method. +type MasterSitesControllerClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MasterSitesControllerClientDeleteOptions contains the optional parameters for the MasterSitesControllerClient.Delete method. +type MasterSitesControllerClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// MasterSitesControllerClientErrorSummaryOptions contains the optional parameters for the MasterSitesControllerClient.ErrorSummary +// method. +type MasterSitesControllerClientErrorSummaryOptions struct { + // placeholder for future optional parameters +} + +// MasterSitesControllerClientGetOptions contains the optional parameters for the MasterSitesControllerClient.Get method. +type MasterSitesControllerClientGetOptions struct { + // placeholder for future optional parameters +} + +// MasterSitesControllerClientListByResourceGroupOptions contains the optional parameters for the MasterSitesControllerClient.NewListByResourceGroupPager +// method. +type MasterSitesControllerClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// MasterSitesControllerClientListBySubscriptionOptions contains the optional parameters for the MasterSitesControllerClient.NewListBySubscriptionPager +// method. +type MasterSitesControllerClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// MasterSitesOperationsStatusControllerClientGetVmwareOperationStatusOptions contains the optional parameters for the MasterSitesOperationsStatusControllerClient.GetVmwareOperationStatus +// method. +type MasterSitesOperationsStatusControllerClientGetVmwareOperationStatusOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionControllerClientCreateOptions contains the optional parameters for the PrivateEndpointConnectionControllerClient.Create +// method. +type PrivateEndpointConnectionControllerClientCreateOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionControllerClientDeleteOptions contains the optional parameters for the PrivateEndpointConnectionControllerClient.Delete +// method. +type PrivateEndpointConnectionControllerClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionControllerClientGetOptions contains the optional parameters for the PrivateEndpointConnectionControllerClient.Get +// method. +type PrivateEndpointConnectionControllerClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionControllerClientListByMasterSiteOptions contains the optional parameters for the PrivateEndpointConnectionControllerClient.NewListByMasterSitePager +// method. +type PrivateEndpointConnectionControllerClientListByMasterSiteOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesControllerClientGetOptions contains the optional parameters for the PrivateLinkResourcesControllerClient.Get +// method. +type PrivateLinkResourcesControllerClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesControllerClientListByMasterSiteOptions contains the optional parameters for the PrivateLinkResourcesControllerClient.NewListByMasterSitePager +// method. +type PrivateLinkResourcesControllerClientListByMasterSiteOptions struct { + // placeholder for future optional parameters +} + +// RunAsAccountsControllerClientGetOptions contains the optional parameters for the RunAsAccountsControllerClient.Get method. +type RunAsAccountsControllerClientGetOptions struct { + // placeholder for future optional parameters +} + +// RunAsAccountsControllerClientListByVmwareSiteOptions contains the optional parameters for the RunAsAccountsControllerClient.NewListByVmwareSitePager +// method. +type RunAsAccountsControllerClientListByVmwareSiteOptions struct { + // placeholder for future optional parameters +} + +// SQLAvailabilityGroupsControllerClientGetOptions contains the optional parameters for the SQLAvailabilityGroupsControllerClient.Get +// method. +type SQLAvailabilityGroupsControllerClientGetOptions struct { // placeholder for future optional parameters } -// AssessedMachinesClientListByAssessmentOptions contains the optional parameters for the AssessedMachinesClient.NewListByAssessmentPager +// SQLAvailabilityGroupsControllerClientListBySQLSiteOptions contains the optional parameters for the SQLAvailabilityGroupsControllerClient.NewListBySQLSitePager // method. -type AssessedMachinesClientListByAssessmentOptions struct { +type SQLAvailabilityGroupsControllerClientListBySQLSiteOptions struct { + // Optional parameter for continuation token. + ContinuationToken *string + + // filter query + Filter *string + + // page size query + Top *string + + // Total count of machines in the given site. + TotalRecordCount *int32 +} + +// SQLDatabasesControllerClientGetOptions contains the optional parameters for the SQLDatabasesControllerClient.Get method. +type SQLDatabasesControllerClientGetOptions struct { // placeholder for future optional parameters } -// AssessmentsClientCreateOptions contains the optional parameters for the AssessmentsClient.Create method. -type AssessmentsClientCreateOptions struct { - // New or Updated Assessment object. - Assessment *Assessment +// SQLDatabasesControllerClientListBySQLSiteOptions contains the optional parameters for the SQLDatabasesControllerClient.NewListBySQLSitePager +// method. +type SQLDatabasesControllerClientListBySQLSiteOptions struct { + // Optional parameter for continuation token. + ContinuationToken *string + + // filter query + Filter *string + + // page size query + Top *string + + // Total count of machines in the given site. + TotalRecordCount *int32 } -// AssessmentsClientDeleteOptions contains the optional parameters for the AssessmentsClient.Delete method. -type AssessmentsClientDeleteOptions struct { +// SQLDiscoverySiteDataSourceControllerClientBeginCreateOptions contains the optional parameters for the SQLDiscoverySiteDataSourceControllerClient.BeginCreate +// method. +type SQLDiscoverySiteDataSourceControllerClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SQLDiscoverySiteDataSourceControllerClientDeleteOptions contains the optional parameters for the SQLDiscoverySiteDataSourceControllerClient.Delete +// method. +type SQLDiscoverySiteDataSourceControllerClientDeleteOptions struct { // placeholder for future optional parameters } -// AssessmentsClientGetOptions contains the optional parameters for the AssessmentsClient.Get method. -type AssessmentsClientGetOptions struct { +// SQLDiscoverySiteDataSourceControllerClientGetOptions contains the optional parameters for the SQLDiscoverySiteDataSourceControllerClient.Get +// method. +type SQLDiscoverySiteDataSourceControllerClientGetOptions struct { // placeholder for future optional parameters } -// AssessmentsClientGetReportDownloadURLOptions contains the optional parameters for the AssessmentsClient.GetReportDownloadURL +// SQLDiscoverySiteDataSourceControllerClientListBySQLSiteOptions contains the optional parameters for the SQLDiscoverySiteDataSourceControllerClient.NewListBySQLSitePager // method. -type AssessmentsClientGetReportDownloadURLOptions struct { +type SQLDiscoverySiteDataSourceControllerClientListBySQLSiteOptions struct { + // placeholder for future optional parameters +} + +// SQLJobsControllerClientGetOptions contains the optional parameters for the SQLJobsControllerClient.Get method. +type SQLJobsControllerClientGetOptions struct { // placeholder for future optional parameters } -// AssessmentsClientListByGroupOptions contains the optional parameters for the AssessmentsClient.NewListByGroupPager method. -type AssessmentsClientListByGroupOptions struct { +// SQLJobsControllerClientListBySQLSiteOptions contains the optional parameters for the SQLJobsControllerClient.NewListBySQLSitePager +// method. +type SQLJobsControllerClientListBySQLSiteOptions struct { // placeholder for future optional parameters } -// AssessmentsClientListByProjectOptions contains the optional parameters for the AssessmentsClient.NewListByProjectPager +// SQLOperationsStatusControllerClientGetSQLOperationStatusOptions contains the optional parameters for the SQLOperationsStatusControllerClient.GetSQLOperationStatus // method. -type AssessmentsClientListByProjectOptions struct { +type SQLOperationsStatusControllerClientGetSQLOperationStatusOptions struct { // placeholder for future optional parameters } -// GroupsClientCreateOptions contains the optional parameters for the GroupsClient.Create method. -type GroupsClientCreateOptions struct { - // New or Updated Group object. - Group *Group +// SQLRunAsAccountsControllerClientGetOptions contains the optional parameters for the SQLRunAsAccountsControllerClient.Get +// method. +type SQLRunAsAccountsControllerClientGetOptions struct { + // placeholder for future optional parameters } -// GroupsClientDeleteOptions contains the optional parameters for the GroupsClient.Delete method. -type GroupsClientDeleteOptions struct { +// SQLRunAsAccountsControllerClientListBySQLSiteOptions contains the optional parameters for the SQLRunAsAccountsControllerClient.NewListBySQLSitePager +// method. +type SQLRunAsAccountsControllerClientListBySQLSiteOptions struct { // placeholder for future optional parameters } -// GroupsClientGetOptions contains the optional parameters for the GroupsClient.Get method. -type GroupsClientGetOptions struct { +// SQLServersControllerClientGetOptions contains the optional parameters for the SQLServersControllerClient.Get method. +type SQLServersControllerClientGetOptions struct { // placeholder for future optional parameters } -// GroupsClientListByProjectOptions contains the optional parameters for the GroupsClient.NewListByProjectPager method. -type GroupsClientListByProjectOptions struct { +// SQLServersControllerClientListBySQLSiteOptions contains the optional parameters for the SQLServersControllerClient.NewListBySQLSitePager +// method. +type SQLServersControllerClientListBySQLSiteOptions struct { + // Optional parameter for continuation token. + ContinuationToken *string + + // filter query + Filter *string + + // page size query + Top *string + + // Total count of machines in the given site. + TotalRecordCount *int32 +} + +// SQLServersControllerClientUpdateOptions contains the optional parameters for the SQLServersControllerClient.Update method. +type SQLServersControllerClientUpdateOptions struct { // placeholder for future optional parameters } -// GroupsClientUpdateMachinesOptions contains the optional parameters for the GroupsClient.UpdateMachines method. -type GroupsClientUpdateMachinesOptions struct { - // Machines list to be added or removed from group. - GroupUpdateProperties *UpdateGroupBody +// SQLSitesControllerClientBeginExportSQLServerErrorsOptions contains the optional parameters for the SQLSitesControllerClient.BeginExportSQLServerErrors +// method. +type SQLSitesControllerClientBeginExportSQLServerErrorsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SQLSitesControllerClientBeginExportSQLServersOptions contains the optional parameters for the SQLSitesControllerClient.BeginExportSQLServers +// method. +type SQLSitesControllerClientBeginExportSQLServersOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SQLSitesControllerClientBeginRefreshOptions contains the optional parameters for the SQLSitesControllerClient.BeginRefresh +// method. +type SQLSitesControllerClientBeginRefreshOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string } -// HyperVCollectorsClientCreateOptions contains the optional parameters for the HyperVCollectorsClient.Create method. -type HyperVCollectorsClientCreateOptions struct { - // New or Updated Hyper-V collector. - CollectorBody *HyperVCollector +// SQLSitesControllerClientBeginUpdateOptions contains the optional parameters for the SQLSitesControllerClient.BeginUpdate +// method. +type SQLSitesControllerClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string } -// HyperVCollectorsClientDeleteOptions contains the optional parameters for the HyperVCollectorsClient.Delete method. -type HyperVCollectorsClientDeleteOptions struct { +// SQLSitesControllerClientCreateOptions contains the optional parameters for the SQLSitesControllerClient.Create method. +type SQLSitesControllerClientCreateOptions struct { // placeholder for future optional parameters } -// HyperVCollectorsClientGetOptions contains the optional parameters for the HyperVCollectorsClient.Get method. -type HyperVCollectorsClientGetOptions struct { +// SQLSitesControllerClientDeleteOptions contains the optional parameters for the SQLSitesControllerClient.Delete method. +type SQLSitesControllerClientDeleteOptions struct { // placeholder for future optional parameters } -// HyperVCollectorsClientListByProjectOptions contains the optional parameters for the HyperVCollectorsClient.NewListByProjectPager +// SQLSitesControllerClientErrorSummaryOptions contains the optional parameters for the SQLSitesControllerClient.ErrorSummary // method. -type HyperVCollectorsClientListByProjectOptions struct { +type SQLSitesControllerClientErrorSummaryOptions struct { + // placeholder for future optional parameters +} + +// SQLSitesControllerClientGetOptions contains the optional parameters for the SQLSitesControllerClient.Get method. +type SQLSitesControllerClientGetOptions struct { // placeholder for future optional parameters } -// ImportCollectorsClientCreateOptions contains the optional parameters for the ImportCollectorsClient.Create method. -type ImportCollectorsClientCreateOptions struct { - // New or Updated Import collector. - CollectorBody *ImportCollector +// SQLSitesControllerClientListByMasterSiteOptions contains the optional parameters for the SQLSitesControllerClient.NewListByMasterSitePager +// method. +type SQLSitesControllerClientListByMasterSiteOptions struct { + // placeholder for future optional parameters } -// ImportCollectorsClientDeleteOptions contains the optional parameters for the ImportCollectorsClient.Delete method. -type ImportCollectorsClientDeleteOptions struct { +// SQLSitesControllerClientSummaryOptions contains the optional parameters for the SQLSitesControllerClient.Summary method. +type SQLSitesControllerClientSummaryOptions struct { // placeholder for future optional parameters } -// ImportCollectorsClientGetOptions contains the optional parameters for the ImportCollectorsClient.Get method. -type ImportCollectorsClientGetOptions struct { +// ServerDependencyMapControllerClientBeginClientGroupMembersOptions contains the optional parameters for the ServerDependencyMapControllerClient.BeginClientGroupMembers +// method. +type ServerDependencyMapControllerClientBeginClientGroupMembersOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServerDependencyMapControllerClientBeginExportDependenciesOptions contains the optional parameters for the ServerDependencyMapControllerClient.BeginExportDependencies +// method. +type ServerDependencyMapControllerClientBeginExportDependenciesOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServerDependencyMapControllerClientBeginGenerateCoarseMapOptions contains the optional parameters for the ServerDependencyMapControllerClient.BeginGenerateCoarseMap +// method. +type ServerDependencyMapControllerClientBeginGenerateCoarseMapOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServerDependencyMapControllerClientBeginGenerateDetailedMapOptions contains the optional parameters for the ServerDependencyMapControllerClient.BeginGenerateDetailedMap +// method. +type ServerDependencyMapControllerClientBeginGenerateDetailedMapOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServerDependencyMapControllerClientBeginServerGroupMembersOptions contains the optional parameters for the ServerDependencyMapControllerClient.BeginServerGroupMembers +// method. +type ServerDependencyMapControllerClientBeginServerGroupMembersOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServerJobsControllerClientGetOptions contains the optional parameters for the ServerJobsControllerClient.Get method. +type ServerJobsControllerClientGetOptions struct { // placeholder for future optional parameters } -// ImportCollectorsClientListByProjectOptions contains the optional parameters for the ImportCollectorsClient.NewListByProjectPager +// ServerJobsControllerClientListByServerSiteResourceOptions contains the optional parameters for the ServerJobsControllerClient.NewListByServerSiteResourcePager // method. -type ImportCollectorsClientListByProjectOptions struct { +type ServerJobsControllerClientListByServerSiteResourceOptions struct { // placeholder for future optional parameters } -// MachinesClientGetOptions contains the optional parameters for the MachinesClient.Get method. -type MachinesClientGetOptions struct { +// ServerOperationsStatusControllerClientGetServerSiteOperationsStatusOptions contains the optional parameters for the ServerOperationsStatusControllerClient.GetServerSiteOperationsStatus +// method. +type ServerOperationsStatusControllerClientGetServerSiteOperationsStatusOptions struct { // placeholder for future optional parameters } -// MachinesClientListByProjectOptions contains the optional parameters for the MachinesClient.NewListByProjectPager method. -type MachinesClientListByProjectOptions struct { +// ServerRunAsAccountsControllerClientGetOptions contains the optional parameters for the ServerRunAsAccountsControllerClient.Get +// method. +type ServerRunAsAccountsControllerClientGetOptions struct { // placeholder for future optional parameters } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -type OperationsClientListOptions struct { +// ServerRunAsAccountsControllerClientListByServerSiteResourceOptions contains the optional parameters for the ServerRunAsAccountsControllerClient.NewListByServerSiteResourcePager +// method. +type ServerRunAsAccountsControllerClientListByServerSiteResourceOptions struct { + // placeholder for future optional parameters +} + +// ServerSitesControllerClientBeginCreateOptions contains the optional parameters for the ServerSitesControllerClient.BeginCreate +// method. +type ServerSitesControllerClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServerSitesControllerClientBeginExportApplicationsOptions contains the optional parameters for the ServerSitesControllerClient.BeginExportApplications +// method. +type ServerSitesControllerClientBeginExportApplicationsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServerSitesControllerClientBeginExportMachineErrorsOptions contains the optional parameters for the ServerSitesControllerClient.BeginExportMachineErrors +// method. +type ServerSitesControllerClientBeginExportMachineErrorsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServerSitesControllerClientBeginRefreshSiteOptions contains the optional parameters for the ServerSitesControllerClient.BeginRefreshSite +// method. +type ServerSitesControllerClientBeginRefreshSiteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServerSitesControllerClientBeginUpdateDependencyMapStatusOptions contains the optional parameters for the ServerSitesControllerClient.BeginUpdateDependencyMapStatus +// method. +type ServerSitesControllerClientBeginUpdateDependencyMapStatusOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServerSitesControllerClientBeginUpdatePropertiesOptions contains the optional parameters for the ServerSitesControllerClient.BeginUpdateProperties +// method. +type ServerSitesControllerClientBeginUpdatePropertiesOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServerSitesControllerClientComputeErrorSummaryOptions contains the optional parameters for the ServerSitesControllerClient.ComputeErrorSummary +// method. +type ServerSitesControllerClientComputeErrorSummaryOptions struct { + // placeholder for future optional parameters +} + +// ServerSitesControllerClientComputeusageOptions contains the optional parameters for the ServerSitesControllerClient.Computeusage +// method. +type ServerSitesControllerClientComputeusageOptions struct { + // placeholder for future optional parameters +} + +// ServerSitesControllerClientDeleteOptions contains the optional parameters for the ServerSitesControllerClient.Delete method. +type ServerSitesControllerClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ServerSitesControllerClientGetOptions contains the optional parameters for the ServerSitesControllerClient.Get method. +type ServerSitesControllerClientGetOptions struct { + // placeholder for future optional parameters +} + +// ServerSitesControllerClientListByResourceGroupOptions contains the optional parameters for the ServerSitesControllerClient.NewListByResourceGroupPager +// method. +type ServerSitesControllerClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ServerSitesControllerClientListBySubscriptionOptions contains the optional parameters for the ServerSitesControllerClient.NewListBySubscriptionPager +// method. +type ServerSitesControllerClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// ServerSitesControllerClientListHealthSummaryOptions contains the optional parameters for the ServerSitesControllerClient.ListHealthSummary +// method. +type ServerSitesControllerClientListHealthSummaryOptions struct { + // placeholder for future optional parameters +} + +// ServerSitesControllerClientSummaryOptions contains the optional parameters for the ServerSitesControllerClient.Summary +// method. +type ServerSitesControllerClientSummaryOptions struct { + // placeholder for future optional parameters +} + +// ServerSitesControllerClientUpdateOptions contains the optional parameters for the ServerSitesControllerClient.Update method. +type ServerSitesControllerClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// ServerSoftwareInventoriesControllerClientGetMachineSoftwareInventoryOptions contains the optional parameters for the ServerSoftwareInventoriesControllerClient.GetMachineSoftwareInventory +// method. +type ServerSoftwareInventoriesControllerClientGetMachineSoftwareInventoryOptions struct { + // placeholder for future optional parameters +} + +// ServerSoftwareInventoriesControllerClientListByServerOptions contains the optional parameters for the ServerSoftwareInventoriesControllerClient.NewListByServerPager +// method. +type ServerSoftwareInventoriesControllerClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// ServersControllerClientDeleteMachineOptions contains the optional parameters for the ServersControllerClient.DeleteMachine +// method. +type ServersControllerClientDeleteMachineOptions struct { + // placeholder for future optional parameters +} + +// ServersControllerClientGetMachineOptions contains the optional parameters for the ServersControllerClient.GetMachine method. +type ServersControllerClientGetMachineOptions struct { + // placeholder for future optional parameters +} + +// ServersControllerClientListByServerSiteResourceOptions contains the optional parameters for the ServersControllerClient.NewListByServerSiteResourcePager +// method. +type ServersControllerClientListByServerSiteResourceOptions struct { + // Optional parameter for continuation token. + ContinuationToken *string + + // filter query + Filter *string + + // page size query + Top *string + + // Total count of machines in the given site. + TotalRecordCount *int32 +} + +// ServersControllerClientUpdateMachineOptions contains the optional parameters for the ServersControllerClient.UpdateMachine +// method. +type ServersControllerClientUpdateMachineOptions struct { + // placeholder for future optional parameters +} + +// SitesControllerClientBeginExportApplicationsOptions contains the optional parameters for the SitesControllerClient.BeginExportApplications +// method. +type SitesControllerClientBeginExportApplicationsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SitesControllerClientBeginExportMachineErrorsOptions contains the optional parameters for the SitesControllerClient.BeginExportMachineErrors +// method. +type SitesControllerClientBeginExportMachineErrorsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SitesControllerClientBeginExportMachinesOptions contains the optional parameters for the SitesControllerClient.BeginExportMachines +// method. +type SitesControllerClientBeginExportMachinesOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SitesControllerClientComputeErrorSummaryOptions contains the optional parameters for the SitesControllerClient.ComputeErrorSummary +// method. +type SitesControllerClientComputeErrorSummaryOptions struct { + // placeholder for future optional parameters +} + +// SitesControllerClientComputeusageOptions contains the optional parameters for the SitesControllerClient.Computeusage method. +type SitesControllerClientComputeusageOptions struct { + // placeholder for future optional parameters +} + +// SitesControllerClientCreateOptions contains the optional parameters for the SitesControllerClient.Create method. +type SitesControllerClientCreateOptions struct { + // placeholder for future optional parameters +} + +// SitesControllerClientDeleteOptions contains the optional parameters for the SitesControllerClient.Delete method. +type SitesControllerClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// SitesControllerClientGetOptions contains the optional parameters for the SitesControllerClient.Get method. +type SitesControllerClientGetOptions struct { + // placeholder for future optional parameters +} + +// SitesControllerClientListByResourceGroupOptions contains the optional parameters for the SitesControllerClient.NewListByResourceGroupPager +// method. +type SitesControllerClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// SitesControllerClientListBySubscriptionOptions contains the optional parameters for the SitesControllerClient.NewListBySubscriptionPager +// method. +type SitesControllerClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// SitesControllerClientListHealthSummaryOptions contains the optional parameters for the SitesControllerClient.ListHealthSummary +// method. +type SitesControllerClientListHealthSummaryOptions struct { // placeholder for future optional parameters } -// PrivateEndpointConnectionClientDeleteOptions contains the optional parameters for the PrivateEndpointConnectionClient.Delete +// SitesControllerClientSummaryOptions contains the optional parameters for the SitesControllerClient.Summary method. +type SitesControllerClientSummaryOptions struct { + // placeholder for future optional parameters +} + +// SitesControllerClientUpdateOptions contains the optional parameters for the SitesControllerClient.Update method. +type SitesControllerClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// TomcatWebApplicationsControllerClientGetOptions contains the optional parameters for the TomcatWebApplicationsControllerClient.Get // method. -type PrivateEndpointConnectionClientDeleteOptions struct { +type TomcatWebApplicationsControllerClientGetOptions struct { // placeholder for future optional parameters } -// PrivateEndpointConnectionClientGetOptions contains the optional parameters for the PrivateEndpointConnectionClient.Get +// TomcatWebApplicationsControllerClientListByWebAppSiteOptions contains the optional parameters for the TomcatWebApplicationsControllerClient.NewListByWebAppSitePager +// method. +type TomcatWebApplicationsControllerClientListByWebAppSiteOptions struct { + // Optional parameter for continuation token. + ContinuationToken *string + + // filter query + Filter *string + + // page size query + Top *string + + // Total count of machines in the given site. + TotalRecordCount *int32 +} + +// TomcatWebApplicationsControllerClientUpdateOptions contains the optional parameters for the TomcatWebApplicationsControllerClient.Update // method. -type PrivateEndpointConnectionClientGetOptions struct { +type TomcatWebApplicationsControllerClientUpdateOptions struct { // placeholder for future optional parameters } -// PrivateEndpointConnectionClientListByProjectOptions contains the optional parameters for the PrivateEndpointConnectionClient.ListByProject +// TomcatWebServersControllerClientGetOptions contains the optional parameters for the TomcatWebServersControllerClient.Get // method. -type PrivateEndpointConnectionClientListByProjectOptions struct { +type TomcatWebServersControllerClientGetOptions struct { // placeholder for future optional parameters } -// PrivateEndpointConnectionClientUpdateOptions contains the optional parameters for the PrivateEndpointConnectionClient.Update +// TomcatWebServersControllerClientListByWebAppSiteOptions contains the optional parameters for the TomcatWebServersControllerClient.NewListByWebAppSitePager +// method. +type TomcatWebServersControllerClientListByWebAppSiteOptions struct { + // Optional parameter for continuation token. + ContinuationToken *string + + // filter query + Filter *string + + // page size query + Top *string + + // Total count of machines in the given site. + TotalRecordCount *int32 +} + +// VcenterControllerClientBeginCreateOptions contains the optional parameters for the VcenterControllerClient.BeginCreate // method. -type PrivateEndpointConnectionClientUpdateOptions struct { - // New or Updated Private Endpoint Connection object. - PrivateEndpointConnectionBody *PrivateEndpointConnection +type VcenterControllerClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VcenterControllerClientDeleteOptions contains the optional parameters for the VcenterControllerClient.Delete method. +type VcenterControllerClientDeleteOptions struct { + // placeholder for future optional parameters } -// PrivateLinkResourceClientGetOptions contains the optional parameters for the PrivateLinkResourceClient.Get method. -type PrivateLinkResourceClientGetOptions struct { +// VcenterControllerClientGetOptions contains the optional parameters for the VcenterControllerClient.Get method. +type VcenterControllerClientGetOptions struct { // placeholder for future optional parameters } -// PrivateLinkResourceClientListByProjectOptions contains the optional parameters for the PrivateLinkResourceClient.ListByProject +// VcenterControllerClientListByVmwareSiteOptions contains the optional parameters for the VcenterControllerClient.NewListByVmwareSitePager // method. -type PrivateLinkResourceClientListByProjectOptions struct { +type VcenterControllerClientListByVmwareSiteOptions struct { + // filter query + Filter *string +} + +// VmwareHostControllerClientGetOptions contains the optional parameters for the VmwareHostControllerClient.Get method. +type VmwareHostControllerClientGetOptions struct { // placeholder for future optional parameters } -// ProjectsClientAssessmentOptionsListOptions contains the optional parameters for the ProjectsClient.NewAssessmentOptionsListPager +// VmwareHostControllerClientListByVmwareSiteOptions contains the optional parameters for the VmwareHostControllerClient.NewListByVmwareSitePager // method. -type ProjectsClientAssessmentOptionsListOptions struct { +type VmwareHostControllerClientListByVmwareSiteOptions struct { // placeholder for future optional parameters } -// ProjectsClientAssessmentOptionsOptions contains the optional parameters for the ProjectsClient.AssessmentOptions method. -type ProjectsClientAssessmentOptionsOptions struct { +// VmwareOperationsStatusClientGetVmwareOperationStatusOptions contains the optional parameters for the VmwareOperationsStatusClient.GetVmwareOperationStatus +// method. +type VmwareOperationsStatusClientGetVmwareOperationStatusOptions struct { // placeholder for future optional parameters } -// ProjectsClientCreateOptions contains the optional parameters for the ProjectsClient.Create method. -type ProjectsClientCreateOptions struct { - // New or Updated project object. - Project *Project +// VmwarePropertiesControllerClientBeginUpdateDependencyMapStatusOptions contains the optional parameters for the VmwarePropertiesControllerClient.BeginUpdateDependencyMapStatus +// method. +type VmwarePropertiesControllerClientBeginUpdateDependencyMapStatusOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VmwarePropertiesControllerClientBeginUpdatePropertiesOptions contains the optional parameters for the VmwarePropertiesControllerClient.BeginUpdateProperties +// method. +type VmwarePropertiesControllerClientBeginUpdatePropertiesOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VmwarePropertiesControllerClientBeginUpdateRunAsAccountOptions contains the optional parameters for the VmwarePropertiesControllerClient.BeginUpdateRunAsAccount +// method. +type VmwarePropertiesControllerClientBeginUpdateRunAsAccountOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VmwarePropertiesControllerClientBeginUpdateTagsOptions contains the optional parameters for the VmwarePropertiesControllerClient.BeginUpdateTags +// method. +type VmwarePropertiesControllerClientBeginUpdateTagsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VmwareSoftwareInventoriesControllerClientGetMachineSoftwareInventoryOptions contains the optional parameters for the VmwareSoftwareInventoriesControllerClient.GetMachineSoftwareInventory +// method. +type VmwareSoftwareInventoriesControllerClientGetMachineSoftwareInventoryOptions struct { + // placeholder for future optional parameters } -// ProjectsClientDeleteOptions contains the optional parameters for the ProjectsClient.Delete method. -type ProjectsClientDeleteOptions struct { +// VmwareSoftwareInventoriesControllerClientListByMachineResourceOptions contains the optional parameters for the VmwareSoftwareInventoriesControllerClient.NewListByMachineResourcePager +// method. +type VmwareSoftwareInventoriesControllerClientListByMachineResourceOptions struct { // placeholder for future optional parameters } -// ProjectsClientGetOptions contains the optional parameters for the ProjectsClient.Get method. -type ProjectsClientGetOptions struct { +// WebAppDiscoverySiteDataSourcesControllerClientBeginCreateOptions contains the optional parameters for the WebAppDiscoverySiteDataSourcesControllerClient.BeginCreate +// method. +type WebAppDiscoverySiteDataSourcesControllerClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// WebAppDiscoverySiteDataSourcesControllerClientBeginDeleteOptions contains the optional parameters for the WebAppDiscoverySiteDataSourcesControllerClient.BeginDelete +// method. +type WebAppDiscoverySiteDataSourcesControllerClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// WebAppDiscoverySiteDataSourcesControllerClientGetOptions contains the optional parameters for the WebAppDiscoverySiteDataSourcesControllerClient.Get +// method. +type WebAppDiscoverySiteDataSourcesControllerClientGetOptions struct { // placeholder for future optional parameters } -// ProjectsClientListBySubscriptionOptions contains the optional parameters for the ProjectsClient.NewListBySubscriptionPager +// WebAppDiscoverySiteDataSourcesControllerClientListByWebAppSiteOptions contains the optional parameters for the WebAppDiscoverySiteDataSourcesControllerClient.NewListByWebAppSitePager // method. -type ProjectsClientListBySubscriptionOptions struct { +type WebAppDiscoverySiteDataSourcesControllerClientListByWebAppSiteOptions struct { // placeholder for future optional parameters } -// ProjectsClientListOptions contains the optional parameters for the ProjectsClient.NewListPager method. -type ProjectsClientListOptions struct { +// WebAppExtendedMachinesControllerClientGetOptions contains the optional parameters for the WebAppExtendedMachinesControllerClient.Get +// method. +type WebAppExtendedMachinesControllerClientGetOptions struct { // placeholder for future optional parameters } -// ProjectsClientUpdateOptions contains the optional parameters for the ProjectsClient.Update method. -type ProjectsClientUpdateOptions struct { - // Updated project object. - Project *Project +// WebAppExtendedMachinesControllerClientListByWebAppSiteOptions contains the optional parameters for the WebAppExtendedMachinesControllerClient.NewListByWebAppSitePager +// method. +type WebAppExtendedMachinesControllerClientListByWebAppSiteOptions struct { + // Optional parameter for continuation token. + ContinuationToken *string + + // filter query + Filter *string + + // page size query + Top *string + + // Total count of machines in the given site. + TotalRecordCount *int32 } -// ServerCollectorsClientCreateOptions contains the optional parameters for the ServerCollectorsClient.Create method. -type ServerCollectorsClientCreateOptions struct { - // New or Updated Server collector. - CollectorBody *ServerCollector +// WebAppPropertiesControllerClientBeginUpdatePropertiesOptions contains the optional parameters for the WebAppPropertiesControllerClient.BeginUpdateProperties +// method. +type WebAppPropertiesControllerClientBeginUpdatePropertiesOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string } -// ServerCollectorsClientDeleteOptions contains the optional parameters for the ServerCollectorsClient.Delete method. -type ServerCollectorsClientDeleteOptions struct { +// WebAppRunAsAccountsControllerClientGetOptions contains the optional parameters for the WebAppRunAsAccountsControllerClient.Get +// method. +type WebAppRunAsAccountsControllerClientGetOptions struct { // placeholder for future optional parameters } -// ServerCollectorsClientGetOptions contains the optional parameters for the ServerCollectorsClient.Get method. -type ServerCollectorsClientGetOptions struct { +// WebAppRunAsAccountsControllerClientListByWebAppSiteOptions contains the optional parameters for the WebAppRunAsAccountsControllerClient.NewListByWebAppSitePager +// method. +type WebAppRunAsAccountsControllerClientListByWebAppSiteOptions struct { // placeholder for future optional parameters } -// ServerCollectorsClientListByProjectOptions contains the optional parameters for the ServerCollectorsClient.NewListByProjectPager +// WebAppSitesControllerClientBeginDeleteOptions contains the optional parameters for the WebAppSitesControllerClient.BeginDelete +// method. +type WebAppSitesControllerClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// WebAppSitesControllerClientBeginExportInventoryOptions contains the optional parameters for the WebAppSitesControllerClient.BeginExportInventory +// method. +type WebAppSitesControllerClientBeginExportInventoryOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// WebAppSitesControllerClientBeginRefreshOptions contains the optional parameters for the WebAppSitesControllerClient.BeginRefresh // method. -type ServerCollectorsClientListByProjectOptions struct { +type WebAppSitesControllerClientBeginRefreshOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// WebAppSitesControllerClientBeginUpdateOptions contains the optional parameters for the WebAppSitesControllerClient.BeginUpdate +// method. +type WebAppSitesControllerClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// WebAppSitesControllerClientCreateOptions contains the optional parameters for the WebAppSitesControllerClient.Create method. +type WebAppSitesControllerClientCreateOptions struct { // placeholder for future optional parameters } -// VMwareCollectorsClientCreateOptions contains the optional parameters for the VMwareCollectorsClient.Create method. -type VMwareCollectorsClientCreateOptions struct { - // New or Updated VMware collector. - CollectorBody *VMwareCollector +// WebAppSitesControllerClientErrorSummaryOptions contains the optional parameters for the WebAppSitesControllerClient.ErrorSummary +// method. +type WebAppSitesControllerClientErrorSummaryOptions struct { + // placeholder for future optional parameters } -// VMwareCollectorsClientDeleteOptions contains the optional parameters for the VMwareCollectorsClient.Delete method. -type VMwareCollectorsClientDeleteOptions struct { +// WebAppSitesControllerClientGetOptions contains the optional parameters for the WebAppSitesControllerClient.Get method. +type WebAppSitesControllerClientGetOptions struct { // placeholder for future optional parameters } -// VMwareCollectorsClientGetOptions contains the optional parameters for the VMwareCollectorsClient.Get method. -type VMwareCollectorsClientGetOptions struct { +// WebAppSitesControllerClientListByMasterSiteOptions contains the optional parameters for the WebAppSitesControllerClient.NewListByMasterSitePager +// method. +type WebAppSitesControllerClientListByMasterSiteOptions struct { // placeholder for future optional parameters } -// VMwareCollectorsClientListByProjectOptions contains the optional parameters for the VMwareCollectorsClient.NewListByProjectPager +// WebAppSitesControllerClientSummaryOptions contains the optional parameters for the WebAppSitesControllerClient.Summary // method. -type VMwareCollectorsClientListByProjectOptions struct { +type WebAppSitesControllerClientSummaryOptions struct { // placeholder for future optional parameters } + +// WebApplicationsControllerClientListByWebAppSiteOptions contains the optional parameters for the WebApplicationsControllerClient.NewListByWebAppSitePager +// method. +type WebApplicationsControllerClientListByWebAppSiteOptions struct { + // Optional parameter for continuation token. + ContinuationToken *string + + // filter query + Filter *string + + // page size query + Top *string + + // Total count of machines in the given site. + TotalRecordCount *int32 +} + +// WebServersControllerClientListByWebAppSiteOptions contains the optional parameters for the WebServersControllerClient.NewListByWebAppSitePager +// method. +type WebServersControllerClientListByWebAppSiteOptions struct { + // Optional parameter for continuation token. + ContinuationToken *string + + // filter query + Filter *string + + // page size query + Top *string + + // Total count of machines in the given site. + TotalRecordCount *int32 +} diff --git a/sdk/resourcemanager/migrate/armmigrate/privateendpointconnection_client.go b/sdk/resourcemanager/migrate/armmigrate/privateendpointconnection_client.go deleted file mode 100644 index 8496f510fbfc..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/privateendpointconnection_client.go +++ /dev/null @@ -1,336 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmigrate - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// PrivateEndpointConnectionClient contains the methods for the PrivateEndpointConnection group. -// Don't use this type directly, use NewPrivateEndpointConnectionClient() instead. -type PrivateEndpointConnectionClient struct { - internal *arm.Client - subscriptionID string -} - -// NewPrivateEndpointConnectionClient creates a new instance of PrivateEndpointConnectionClient with the specified values. -// - subscriptionID - Azure Subscription Id in which project was created. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewPrivateEndpointConnectionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &PrivateEndpointConnectionClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Delete - Delete the private endpoint connection from the project. T. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - privateEndpointConnectionName - Unique name of a private endpoint connection within a project. -// - options - PrivateEndpointConnectionClientDeleteOptions contains the optional parameters for the PrivateEndpointConnectionClient.Delete -// method. -func (client *PrivateEndpointConnectionClient) Delete(ctx context.Context, resourceGroupName string, projectName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionClientDeleteOptions) (PrivateEndpointConnectionClientDeleteResponse, error) { - var err error - const operationName = "PrivateEndpointConnectionClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, projectName, privateEndpointConnectionName, options) - if err != nil { - return PrivateEndpointConnectionClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PrivateEndpointConnectionClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return PrivateEndpointConnectionClientDeleteResponse{}, err - } - resp, err := client.deleteHandleResponse(httpResp) - return resp, err -} - -// deleteCreateRequest creates the Delete request. -func (client *PrivateEndpointConnectionClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, projectName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentprojects/{projectName}/privateEndpointConnections/{privateEndpointConnectionName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if privateEndpointConnectionName == "" { - return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// deleteHandleResponse handles the Delete response. -func (client *PrivateEndpointConnectionClient) deleteHandleResponse(resp *http.Response) (PrivateEndpointConnectionClientDeleteResponse, error) { - result := PrivateEndpointConnectionClientDeleteResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - return result, nil -} - -// Get - Get information related to a specific private endpoint connection in the project. Returns a json object of type 'privateEndpointConnections' -// as specified in the models section. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - privateEndpointConnectionName - Unique name of a private endpoint connection within a project. -// - options - PrivateEndpointConnectionClientGetOptions contains the optional parameters for the PrivateEndpointConnectionClient.Get -// method. -func (client *PrivateEndpointConnectionClient) Get(ctx context.Context, resourceGroupName string, projectName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionClientGetOptions) (PrivateEndpointConnectionClientGetResponse, error) { - var err error - const operationName = "PrivateEndpointConnectionClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, privateEndpointConnectionName, options) - if err != nil { - return PrivateEndpointConnectionClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PrivateEndpointConnectionClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return PrivateEndpointConnectionClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *PrivateEndpointConnectionClient) getCreateRequest(ctx context.Context, resourceGroupName string, projectName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentprojects/{projectName}/privateEndpointConnections/{privateEndpointConnectionName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if privateEndpointConnectionName == "" { - return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *PrivateEndpointConnectionClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionClientGetResponse, error) { - result := PrivateEndpointConnectionClientGetResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { - return PrivateEndpointConnectionClientGetResponse{}, err - } - return result, nil -} - -// ListByProject - Get all private endpoint connections in the project. Returns a json array of objects of type 'privateEndpointConnections' -// as specified in the Models section. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - options - PrivateEndpointConnectionClientListByProjectOptions contains the optional parameters for the PrivateEndpointConnectionClient.ListByProject -// method. -func (client *PrivateEndpointConnectionClient) ListByProject(ctx context.Context, resourceGroupName string, projectName string, options *PrivateEndpointConnectionClientListByProjectOptions) (PrivateEndpointConnectionClientListByProjectResponse, error) { - var err error - const operationName = "PrivateEndpointConnectionClient.ListByProject" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.listByProjectCreateRequest(ctx, resourceGroupName, projectName, options) - if err != nil { - return PrivateEndpointConnectionClientListByProjectResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PrivateEndpointConnectionClientListByProjectResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return PrivateEndpointConnectionClientListByProjectResponse{}, err - } - resp, err := client.listByProjectHandleResponse(httpResp) - return resp, err -} - -// listByProjectCreateRequest creates the ListByProject request. -func (client *PrivateEndpointConnectionClient) listByProjectCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *PrivateEndpointConnectionClientListByProjectOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentprojects/{projectName}/privateEndpointConnections" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByProjectHandleResponse handles the ListByProject response. -func (client *PrivateEndpointConnectionClient) listByProjectHandleResponse(resp *http.Response) (PrivateEndpointConnectionClientListByProjectResponse, error) { - result := PrivateEndpointConnectionClientListByProjectResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionCollection); err != nil { - return PrivateEndpointConnectionClientListByProjectResponse{}, err - } - return result, nil -} - -// Update - Update a specific private endpoint connection in the project. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - privateEndpointConnectionName - Unique name of a private endpoint connection within a project. -// - options - PrivateEndpointConnectionClientUpdateOptions contains the optional parameters for the PrivateEndpointConnectionClient.Update -// method. -func (client *PrivateEndpointConnectionClient) Update(ctx context.Context, resourceGroupName string, projectName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionClientUpdateOptions) (PrivateEndpointConnectionClientUpdateResponse, error) { - var err error - const operationName = "PrivateEndpointConnectionClient.Update" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateCreateRequest(ctx, resourceGroupName, projectName, privateEndpointConnectionName, options) - if err != nil { - return PrivateEndpointConnectionClientUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PrivateEndpointConnectionClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return PrivateEndpointConnectionClientUpdateResponse{}, err - } - resp, err := client.updateHandleResponse(httpResp) - return resp, err -} - -// updateCreateRequest creates the Update request. -func (client *PrivateEndpointConnectionClient) updateCreateRequest(ctx context.Context, resourceGroupName string, projectName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionClientUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentprojects/{projectName}/privateEndpointConnections/{privateEndpointConnectionName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if privateEndpointConnectionName == "" { - return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.PrivateEndpointConnectionBody != nil { - if err := runtime.MarshalAsJSON(req, *options.PrivateEndpointConnectionBody); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// updateHandleResponse handles the Update response. -func (client *PrivateEndpointConnectionClient) updateHandleResponse(resp *http.Response) (PrivateEndpointConnectionClientUpdateResponse, error) { - result := PrivateEndpointConnectionClientUpdateResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { - return PrivateEndpointConnectionClientUpdateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/privateendpointconnection_client_example_test.go b/sdk/resourcemanager/migrate/armmigrate/privateendpointconnection_client_example_test.go deleted file mode 100644 index 9d5406ed8d4c..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/privateendpointconnection_client_example_test.go +++ /dev/null @@ -1,156 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmigrate_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/PrivateEndpointConnections_ListByProject.json -func ExamplePrivateEndpointConnectionClient_ListByProject() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointConnectionClient().ListByProject(ctx, "abgoyal-westEurope", "abgoyalWEselfhostb72bproject", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnectionCollection = armmigrate.PrivateEndpointConnectionCollection{ - // Value: []*armmigrate.PrivateEndpointConnection{ - // { - // Name: to.Ptr("custestpece80project3980pe.7e35576b-3df4-478e-9759-f64351cf4f43"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/privateEndpointConnections"), - // ETag: to.Ptr("\"00009300-0000-0300-0000-602b967b0000\""), - // ID: to.Ptr("/subscriptions/4bd2aa0f-2bd2-4d67-91a8-5a4533d58600/resourceGroups/madhavicus/providers/Microsoft.Migrate/assessmentprojects/custestpece80project/privateEndpointConnections/custestpece80project3980pe.7e35576b-3df4-478e-9759-f64351cf4f43"), - // Properties: &armmigrate.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armmigrate.ResourceID{ - // ID: to.Ptr("/subscriptions/31be0ff4-c932-4cb3-8efc-efa411d79280/resourceGroups/PrivLink-SelfHost/providers/Microsoft.Network/privateEndpoints/custestpece80project3980pe"), - // }, - // PrivateLinkServiceConnectionState: &armmigrate.PrivateLinkServiceConnectionState{ - // ActionsRequired: to.Ptr(""), - // Status: to.Ptr(armmigrate.PrivateLinkServiceConnectionStateStatusApproved), - // }, - // ProvisioningState: to.Ptr(armmigrate.PrivateEndpointConnectionPropertiesProvisioningStateSucceeded), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/PrivateEndpointConnections_Get.json -func ExamplePrivateEndpointConnectionClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointConnectionClient().Get(ctx, "abgoyal-westEurope", "abgoyalWEselfhostb72bproject", "custestpece80project3980pe.7e35576b-3df4-478e-9759-f64351cf4f43", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armmigrate.PrivateEndpointConnection{ - // Name: to.Ptr("custestpece80project3980pe.7e35576b-3df4-478e-9759-f64351cf4f43"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/privateEndpointConnections"), - // ETag: to.Ptr("\"00009300-0000-0300-0000-602b967b0000\""), - // ID: to.Ptr("/subscriptions/4bd2aa0f-2bd2-4d67-91a8-5a4533d58600/resourceGroups/madhavicus/providers/Microsoft.Migrate/assessmentprojects/custestpece80project/privateEndpointConnections/custestpece80project3980pe.7e35576b-3df4-478e-9759-f64351cf4f43"), - // Properties: &armmigrate.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armmigrate.ResourceID{ - // ID: to.Ptr("/subscriptions/31be0ff4-c932-4cb3-8efc-efa411d79280/resourceGroups/PrivLink-SelfHost/providers/Microsoft.Network/privateEndpoints/custestpece80project3980pe"), - // }, - // PrivateLinkServiceConnectionState: &armmigrate.PrivateLinkServiceConnectionState{ - // ActionsRequired: to.Ptr(""), - // Status: to.Ptr(armmigrate.PrivateLinkServiceConnectionStateStatusApproved), - // }, - // ProvisioningState: to.Ptr(armmigrate.PrivateEndpointConnectionPropertiesProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/PrivateEndpointConnections_Create.json -func ExamplePrivateEndpointConnectionClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointConnectionClient().Update(ctx, "abgoyal-westEurope", "abgoyalWEselfhostb72bproject", "custestpece80project3980pe.7e35576b-3df4-478e-9759-f64351cf4f43", &armmigrate.PrivateEndpointConnectionClientUpdateOptions{PrivateEndpointConnectionBody: &armmigrate.PrivateEndpointConnection{ - ETag: to.Ptr("\"00009300-0000-0300-0000-602b967b0000\""), - Properties: &armmigrate.PrivateEndpointConnectionProperties{ - PrivateLinkServiceConnectionState: &armmigrate.PrivateLinkServiceConnectionState{ - ActionsRequired: to.Ptr(""), - Status: to.Ptr(armmigrate.PrivateLinkServiceConnectionStateStatusApproved), - }, - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armmigrate.PrivateEndpointConnection{ - // Name: to.Ptr("custestpece80project3980pe.7e35576b-3df4-478e-9759-f64351cf4f43"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/privateEndpointConnections"), - // ETag: to.Ptr("\"00009300-0000-0300-0000-602b967b0000\""), - // ID: to.Ptr("/subscriptions/4bd2aa0f-2bd2-4d67-91a8-5a4533d58600/resourceGroups/madhavicus/providers/Microsoft.Migrate/assessmentprojects/custestpece80project/privateEndpointConnections/custestpece80project3980pe.7e35576b-3df4-478e-9759-f64351cf4f43"), - // Properties: &armmigrate.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armmigrate.ResourceID{ - // ID: to.Ptr("/subscriptions/31be0ff4-c932-4cb3-8efc-efa411d79280/resourceGroups/PrivLink-SelfHost/providers/Microsoft.Network/privateEndpoints/custestpece80project3980pe"), - // }, - // PrivateLinkServiceConnectionState: &armmigrate.PrivateLinkServiceConnectionState{ - // ActionsRequired: to.Ptr(""), - // Status: to.Ptr(armmigrate.PrivateLinkServiceConnectionStateStatusPending), - // }, - // ProvisioningState: to.Ptr(armmigrate.PrivateEndpointConnectionPropertiesProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/PrivateEndpointConnections_Delete.json -func ExamplePrivateEndpointConnectionClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewPrivateEndpointConnectionClient().Delete(ctx, "abgoyal-westEurope", "abgoyalWEselfhostb72bproject", "custestpece80project3980pe.7e35576b-3df4-478e-9759-f64351cf4f43", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/migrate/armmigrate/privateendpointconnectioncontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/privateendpointconnectioncontroller_client.go new file mode 100644 index 000000000000..6911d329f723 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/privateendpointconnectioncontroller_client.go @@ -0,0 +1,322 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// PrivateEndpointConnectionControllerClient contains the methods for the PrivateEndpointConnectionController group. +// Don't use this type directly, use NewPrivateEndpointConnectionControllerClient() instead. +type PrivateEndpointConnectionControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewPrivateEndpointConnectionControllerClient creates a new instance of PrivateEndpointConnectionControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewPrivateEndpointConnectionControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PrivateEndpointConnectionControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Create - Gets the private link resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - peConnectionName - Private link resource name. +// - body - Resource create parameters. +// - options - PrivateEndpointConnectionControllerClientCreateOptions contains the optional parameters for the PrivateEndpointConnectionControllerClient.Create +// method. +func (client *PrivateEndpointConnectionControllerClient) Create(ctx context.Context, resourceGroupName string, siteName string, peConnectionName string, body PrivateEndpointConnection, options *PrivateEndpointConnectionControllerClientCreateOptions) (PrivateEndpointConnectionControllerClientCreateResponse, error) { + var err error + const operationName = "PrivateEndpointConnectionControllerClient.Create" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, siteName, peConnectionName, body, options) + if err != nil { + return PrivateEndpointConnectionControllerClientCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateEndpointConnectionControllerClientCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionControllerClientCreateResponse{}, err + } + resp, err := client.createHandleResponse(httpResp) + return resp, err +} + +// createCreateRequest creates the Create request. +func (client *PrivateEndpointConnectionControllerClient) createCreateRequest(ctx context.Context, resourceGroupName string, siteName string, peConnectionName string, body PrivateEndpointConnection, options *PrivateEndpointConnectionControllerClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/privateEndpointConnections/{peConnectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if peConnectionName == "" { + return nil, errors.New("parameter peConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peConnectionName}", url.PathEscape(peConnectionName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *PrivateEndpointConnectionControllerClient) createHandleResponse(resp *http.Response) (PrivateEndpointConnectionControllerClientCreateResponse, error) { + result := PrivateEndpointConnectionControllerClientCreateResponse{} + if val := resp.Header.Get("Retry-After"); val != "" { + retryAfter32, err := strconv.ParseInt(val, 10, 32) + retryAfter := int32(retryAfter32) + if err != nil { + return PrivateEndpointConnectionControllerClientCreateResponse{}, err + } + result.RetryAfter = &retryAfter + } + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { + return PrivateEndpointConnectionControllerClientCreateResponse{}, err + } + return result, nil +} + +// Delete - Deletes the private link resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - peConnectionName - Private link resource name. +// - options - PrivateEndpointConnectionControllerClientDeleteOptions contains the optional parameters for the PrivateEndpointConnectionControllerClient.Delete +// method. +func (client *PrivateEndpointConnectionControllerClient) Delete(ctx context.Context, resourceGroupName string, siteName string, peConnectionName string, options *PrivateEndpointConnectionControllerClientDeleteOptions) (PrivateEndpointConnectionControllerClientDeleteResponse, error) { + var err error + const operationName = "PrivateEndpointConnectionControllerClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, siteName, peConnectionName, options) + if err != nil { + return PrivateEndpointConnectionControllerClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateEndpointConnectionControllerClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionControllerClientDeleteResponse{}, err + } + return PrivateEndpointConnectionControllerClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *PrivateEndpointConnectionControllerClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, peConnectionName string, options *PrivateEndpointConnectionControllerClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/privateEndpointConnections/{peConnectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if peConnectionName == "" { + return nil, errors.New("parameter peConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peConnectionName}", url.PathEscape(peConnectionName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the private link resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - peConnectionName - Private link resource name. +// - options - PrivateEndpointConnectionControllerClientGetOptions contains the optional parameters for the PrivateEndpointConnectionControllerClient.Get +// method. +func (client *PrivateEndpointConnectionControllerClient) Get(ctx context.Context, resourceGroupName string, siteName string, peConnectionName string, options *PrivateEndpointConnectionControllerClientGetOptions) (PrivateEndpointConnectionControllerClientGetResponse, error) { + var err error + const operationName = "PrivateEndpointConnectionControllerClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, siteName, peConnectionName, options) + if err != nil { + return PrivateEndpointConnectionControllerClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateEndpointConnectionControllerClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionControllerClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *PrivateEndpointConnectionControllerClient) getCreateRequest(ctx context.Context, resourceGroupName string, siteName string, peConnectionName string, options *PrivateEndpointConnectionControllerClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/privateEndpointConnections/{peConnectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if peConnectionName == "" { + return nil, errors.New("parameter peConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peConnectionName}", url.PathEscape(peConnectionName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateEndpointConnectionControllerClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionControllerClientGetResponse, error) { + result := PrivateEndpointConnectionControllerClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { + return PrivateEndpointConnectionControllerClientGetResponse{}, err + } + return result, nil +} + +// NewListByMasterSitePager - Gets the private link resource. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - options - PrivateEndpointConnectionControllerClientListByMasterSiteOptions contains the optional parameters for the PrivateEndpointConnectionControllerClient.NewListByMasterSitePager +// method. +func (client *PrivateEndpointConnectionControllerClient) NewListByMasterSitePager(resourceGroupName string, siteName string, options *PrivateEndpointConnectionControllerClientListByMasterSiteOptions) *runtime.Pager[PrivateEndpointConnectionControllerClientListByMasterSiteResponse] { + return runtime.NewPager(runtime.PagingHandler[PrivateEndpointConnectionControllerClientListByMasterSiteResponse]{ + More: func(page PrivateEndpointConnectionControllerClientListByMasterSiteResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PrivateEndpointConnectionControllerClientListByMasterSiteResponse) (PrivateEndpointConnectionControllerClientListByMasterSiteResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PrivateEndpointConnectionControllerClient.NewListByMasterSitePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByMasterSiteCreateRequest(ctx, resourceGroupName, siteName, options) + }, nil) + if err != nil { + return PrivateEndpointConnectionControllerClientListByMasterSiteResponse{}, err + } + return client.listByMasterSiteHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByMasterSiteCreateRequest creates the ListByMasterSite request. +func (client *PrivateEndpointConnectionControllerClient) listByMasterSiteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *PrivateEndpointConnectionControllerClientListByMasterSiteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/privateEndpointConnections" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByMasterSiteHandleResponse handles the ListByMasterSite response. +func (client *PrivateEndpointConnectionControllerClient) listByMasterSiteHandleResponse(resp *http.Response) (PrivateEndpointConnectionControllerClientListByMasterSiteResponse, error) { + result := PrivateEndpointConnectionControllerClientListByMasterSiteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { + return PrivateEndpointConnectionControllerClientListByMasterSiteResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/privatelinkresource_client.go b/sdk/resourcemanager/migrate/armmigrate/privatelinkresource_client.go deleted file mode 100644 index e67386210cdc..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/privatelinkresource_client.go +++ /dev/null @@ -1,186 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmigrate - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// PrivateLinkResourceClient contains the methods for the PrivateLinkResource group. -// Don't use this type directly, use NewPrivateLinkResourceClient() instead. -type PrivateLinkResourceClient struct { - internal *arm.Client - subscriptionID string -} - -// NewPrivateLinkResourceClient creates a new instance of PrivateLinkResourceClient with the specified values. -// - subscriptionID - Azure Subscription Id in which project was created. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewPrivateLinkResourceClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkResourceClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &PrivateLinkResourceClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Get information related to a specific private Link Resource in the project. Returns a json object of type 'privateLinkResources' -// as specified in the models section. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - privateLinkResourceName - Unique name of a private link resource within a project. -// - options - PrivateLinkResourceClientGetOptions contains the optional parameters for the PrivateLinkResourceClient.Get method. -func (client *PrivateLinkResourceClient) Get(ctx context.Context, resourceGroupName string, projectName string, privateLinkResourceName string, options *PrivateLinkResourceClientGetOptions) (PrivateLinkResourceClientGetResponse, error) { - var err error - const operationName = "PrivateLinkResourceClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, privateLinkResourceName, options) - if err != nil { - return PrivateLinkResourceClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PrivateLinkResourceClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return PrivateLinkResourceClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *PrivateLinkResourceClient) getCreateRequest(ctx context.Context, resourceGroupName string, projectName string, privateLinkResourceName string, options *PrivateLinkResourceClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentprojects/{projectName}/privateLinkResources/{privateLinkResourceName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if privateLinkResourceName == "" { - return nil, errors.New("parameter privateLinkResourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{privateLinkResourceName}", url.PathEscape(privateLinkResourceName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *PrivateLinkResourceClient) getHandleResponse(resp *http.Response) (PrivateLinkResourceClientGetResponse, error) { - result := PrivateLinkResourceClientGetResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResource); err != nil { - return PrivateLinkResourceClientGetResponse{}, err - } - return result, nil -} - -// ListByProject - Get all private link resources created in the project. Returns a json array of objects of type 'privateLinkResources' -// as specified in the Models section. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - options - PrivateLinkResourceClientListByProjectOptions contains the optional parameters for the PrivateLinkResourceClient.ListByProject -// method. -func (client *PrivateLinkResourceClient) ListByProject(ctx context.Context, resourceGroupName string, projectName string, options *PrivateLinkResourceClientListByProjectOptions) (PrivateLinkResourceClientListByProjectResponse, error) { - var err error - const operationName = "PrivateLinkResourceClient.ListByProject" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.listByProjectCreateRequest(ctx, resourceGroupName, projectName, options) - if err != nil { - return PrivateLinkResourceClientListByProjectResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PrivateLinkResourceClientListByProjectResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return PrivateLinkResourceClientListByProjectResponse{}, err - } - resp, err := client.listByProjectHandleResponse(httpResp) - return resp, err -} - -// listByProjectCreateRequest creates the ListByProject request. -func (client *PrivateLinkResourceClient) listByProjectCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *PrivateLinkResourceClientListByProjectOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentprojects/{projectName}/privateLinkResources" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByProjectHandleResponse handles the ListByProject response. -func (client *PrivateLinkResourceClient) listByProjectHandleResponse(resp *http.Response) (PrivateLinkResourceClientListByProjectResponse, error) { - result := PrivateLinkResourceClientListByProjectResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceCollection); err != nil { - return PrivateLinkResourceClientListByProjectResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/privatelinkresource_client_example_test.go b/sdk/resourcemanager/migrate/armmigrate/privatelinkresource_client_example_test.go deleted file mode 100644 index b4db883810ed..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/privatelinkresource_client_example_test.go +++ /dev/null @@ -1,85 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmigrate_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/PrivateLinkResources_Get.json -func ExamplePrivateLinkResourceClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkResourceClient().Get(ctx, "madhavicus", "custestpece80project", "Default", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateLinkResource = armmigrate.PrivateLinkResource{ - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/privateLinkResources"), - // ID: to.Ptr("/subscriptions/4bd2aa0f-2bd2-4d67-91a8-5a4533d58600/resourceGroups/madhavicus/providers/Microsoft.Migrate/assessmentprojects/custestpece80project/privateLinkResources/Default"), - // Properties: &armmigrate.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("Default"), - // RequiredMembers: []*string{ - // to.Ptr("CollectorAgent")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.prod.migration.windowsazure.com")}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/PrivateLinkResources_ListByProject.json -func ExamplePrivateLinkResourceClient_ListByProject() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkResourceClient().ListByProject(ctx, "madhavicus", "custestpece80project", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateLinkResourceCollection = armmigrate.PrivateLinkResourceCollection{ - // Value: []*armmigrate.PrivateLinkResource{ - // { - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/privateLinkResources"), - // ID: to.Ptr("/subscriptions/4bd2aa0f-2bd2-4d67-91a8-5a4533d58600/resourceGroups/madhavicus/providers/Microsoft.Migrate/assessmentprojects/custestpece80project/privateLinkResources/Default"), - // Properties: &armmigrate.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("Default"), - // RequiredMembers: []*string{ - // to.Ptr("CollectorAgent")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.prod.migration.windowsazure.com")}, - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/migrate/armmigrate/privatelinkresourcescontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/privatelinkresourcescontroller_client.go new file mode 100644 index 000000000000..79f9381f47fd --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/privatelinkresourcescontroller_client.go @@ -0,0 +1,179 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// PrivateLinkResourcesControllerClient contains the methods for the PrivateLinkResourcesController group. +// Don't use this type directly, use NewPrivateLinkResourcesControllerClient() instead. +type PrivateLinkResourcesControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewPrivateLinkResourcesControllerClient creates a new instance of PrivateLinkResourcesControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewPrivateLinkResourcesControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkResourcesControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PrivateLinkResourcesControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Gets the private link resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - privateLinkResourceName - Private link resource name. +// - options - PrivateLinkResourcesControllerClientGetOptions contains the optional parameters for the PrivateLinkResourcesControllerClient.Get +// method. +func (client *PrivateLinkResourcesControllerClient) Get(ctx context.Context, resourceGroupName string, siteName string, privateLinkResourceName string, options *PrivateLinkResourcesControllerClientGetOptions) (PrivateLinkResourcesControllerClientGetResponse, error) { + var err error + const operationName = "PrivateLinkResourcesControllerClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, siteName, privateLinkResourceName, options) + if err != nil { + return PrivateLinkResourcesControllerClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateLinkResourcesControllerClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateLinkResourcesControllerClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *PrivateLinkResourcesControllerClient) getCreateRequest(ctx context.Context, resourceGroupName string, siteName string, privateLinkResourceName string, options *PrivateLinkResourcesControllerClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/privateLinkResources/{privateLinkResourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if privateLinkResourceName == "" { + return nil, errors.New("parameter privateLinkResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateLinkResourceName}", url.PathEscape(privateLinkResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateLinkResourcesControllerClient) getHandleResponse(resp *http.Response) (PrivateLinkResourcesControllerClientGetResponse, error) { + result := PrivateLinkResourcesControllerClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResource); err != nil { + return PrivateLinkResourcesControllerClientGetResponse{}, err + } + return result, nil +} + +// NewListByMasterSitePager - Gets the private link resource. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - options - PrivateLinkResourcesControllerClientListByMasterSiteOptions contains the optional parameters for the PrivateLinkResourcesControllerClient.NewListByMasterSitePager +// method. +func (client *PrivateLinkResourcesControllerClient) NewListByMasterSitePager(resourceGroupName string, siteName string, options *PrivateLinkResourcesControllerClientListByMasterSiteOptions) *runtime.Pager[PrivateLinkResourcesControllerClientListByMasterSiteResponse] { + return runtime.NewPager(runtime.PagingHandler[PrivateLinkResourcesControllerClientListByMasterSiteResponse]{ + More: func(page PrivateLinkResourcesControllerClientListByMasterSiteResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PrivateLinkResourcesControllerClientListByMasterSiteResponse) (PrivateLinkResourcesControllerClientListByMasterSiteResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PrivateLinkResourcesControllerClient.NewListByMasterSitePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByMasterSiteCreateRequest(ctx, resourceGroupName, siteName, options) + }, nil) + if err != nil { + return PrivateLinkResourcesControllerClientListByMasterSiteResponse{}, err + } + return client.listByMasterSiteHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByMasterSiteCreateRequest creates the ListByMasterSite request. +func (client *PrivateLinkResourcesControllerClient) listByMasterSiteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *PrivateLinkResourcesControllerClientListByMasterSiteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/privateLinkResources" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByMasterSiteHandleResponse handles the ListByMasterSite response. +func (client *PrivateLinkResourcesControllerClient) listByMasterSiteHandleResponse(resp *http.Response) (PrivateLinkResourcesControllerClientListByMasterSiteResponse, error) { + result := PrivateLinkResourcesControllerClientListByMasterSiteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil { + return PrivateLinkResourcesControllerClientListByMasterSiteResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/projects_client.go b/sdk/resourcemanager/migrate/armmigrate/projects_client.go deleted file mode 100644 index 0966a23806c3..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/projects_client.go +++ /dev/null @@ -1,583 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmigrate - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// ProjectsClient contains the methods for the Projects group. -// Don't use this type directly, use NewProjectsClient() instead. -type ProjectsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewProjectsClient creates a new instance of ProjectsClient with the specified values. -// - subscriptionID - Azure Subscription Id in which project was created. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewProjectsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProjectsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ProjectsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// AssessmentOptions - Get all available options for the properties of an assessment on a project. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - assessmentOptionsName - Name of the assessment options. The only name accepted in default. -// - options - ProjectsClientAssessmentOptionsOptions contains the optional parameters for the ProjectsClient.AssessmentOptions -// method. -func (client *ProjectsClient) AssessmentOptions(ctx context.Context, resourceGroupName string, projectName string, assessmentOptionsName string, options *ProjectsClientAssessmentOptionsOptions) (ProjectsClientAssessmentOptionsResponse, error) { - var err error - const operationName = "ProjectsClient.AssessmentOptions" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.assessmentOptionsCreateRequest(ctx, resourceGroupName, projectName, assessmentOptionsName, options) - if err != nil { - return ProjectsClientAssessmentOptionsResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProjectsClientAssessmentOptionsResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ProjectsClientAssessmentOptionsResponse{}, err - } - resp, err := client.assessmentOptionsHandleResponse(httpResp) - return resp, err -} - -// assessmentOptionsCreateRequest creates the AssessmentOptions request. -func (client *ProjectsClient) assessmentOptionsCreateRequest(ctx context.Context, resourceGroupName string, projectName string, assessmentOptionsName string, options *ProjectsClientAssessmentOptionsOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/assessmentOptions/{assessmentOptionsName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if assessmentOptionsName == "" { - return nil, errors.New("parameter assessmentOptionsName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{assessmentOptionsName}", url.PathEscape(assessmentOptionsName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// assessmentOptionsHandleResponse handles the AssessmentOptions response. -func (client *ProjectsClient) assessmentOptionsHandleResponse(resp *http.Response) (ProjectsClientAssessmentOptionsResponse, error) { - result := ProjectsClientAssessmentOptionsResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.AssessmentOptions); err != nil { - return ProjectsClientAssessmentOptionsResponse{}, err - } - return result, nil -} - -// NewAssessmentOptionsListPager - Gets list of all available options for the properties of an assessment on a project. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - options - ProjectsClientAssessmentOptionsListOptions contains the optional parameters for the ProjectsClient.NewAssessmentOptionsListPager -// method. -func (client *ProjectsClient) NewAssessmentOptionsListPager(resourceGroupName string, projectName string, options *ProjectsClientAssessmentOptionsListOptions) *runtime.Pager[ProjectsClientAssessmentOptionsListResponse] { - return runtime.NewPager(runtime.PagingHandler[ProjectsClientAssessmentOptionsListResponse]{ - More: func(page ProjectsClientAssessmentOptionsListResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *ProjectsClientAssessmentOptionsListResponse) (ProjectsClientAssessmentOptionsListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ProjectsClient.NewAssessmentOptionsListPager") - req, err := client.assessmentOptionsListCreateRequest(ctx, resourceGroupName, projectName, options) - if err != nil { - return ProjectsClientAssessmentOptionsListResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProjectsClientAssessmentOptionsListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ProjectsClientAssessmentOptionsListResponse{}, runtime.NewResponseError(resp) - } - return client.assessmentOptionsListHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// assessmentOptionsListCreateRequest creates the AssessmentOptionsList request. -func (client *ProjectsClient) assessmentOptionsListCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *ProjectsClientAssessmentOptionsListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/assessmentOptions" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// assessmentOptionsListHandleResponse handles the AssessmentOptionsList response. -func (client *ProjectsClient) assessmentOptionsListHandleResponse(resp *http.Response) (ProjectsClientAssessmentOptionsListResponse, error) { - result := ProjectsClientAssessmentOptionsListResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.AssessmentOptionsResultList); err != nil { - return ProjectsClientAssessmentOptionsListResponse{}, err - } - return result, nil -} - -// Create - Create a project with specified name. If a project already exists, update it. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - options - ProjectsClientCreateOptions contains the optional parameters for the ProjectsClient.Create method. -func (client *ProjectsClient) Create(ctx context.Context, resourceGroupName string, projectName string, options *ProjectsClientCreateOptions) (ProjectsClientCreateResponse, error) { - var err error - const operationName = "ProjectsClient.Create" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createCreateRequest(ctx, resourceGroupName, projectName, options) - if err != nil { - return ProjectsClientCreateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProjectsClientCreateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return ProjectsClientCreateResponse{}, err - } - resp, err := client.createHandleResponse(httpResp) - return resp, err -} - -// createCreateRequest creates the Create request. -func (client *ProjectsClient) createCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *ProjectsClientCreateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.Project != nil { - if err := runtime.MarshalAsJSON(req, *options.Project); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// createHandleResponse handles the Create response. -func (client *ProjectsClient) createHandleResponse(resp *http.Response) (ProjectsClientCreateResponse, error) { - result := ProjectsClientCreateResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.Project); err != nil { - return ProjectsClientCreateResponse{}, err - } - return result, nil -} - -// Delete - Delete the project. Deleting non-existent project is a no-operation. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - options - ProjectsClientDeleteOptions contains the optional parameters for the ProjectsClient.Delete method. -func (client *ProjectsClient) Delete(ctx context.Context, resourceGroupName string, projectName string, options *ProjectsClientDeleteOptions) (ProjectsClientDeleteResponse, error) { - var err error - const operationName = "ProjectsClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, projectName, options) - if err != nil { - return ProjectsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProjectsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return ProjectsClientDeleteResponse{}, err - } - resp, err := client.deleteHandleResponse(httpResp) - return resp, err -} - -// deleteCreateRequest creates the Delete request. -func (client *ProjectsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *ProjectsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// deleteHandleResponse handles the Delete response. -func (client *ProjectsClient) deleteHandleResponse(resp *http.Response) (ProjectsClientDeleteResponse, error) { - result := ProjectsClientDeleteResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - return result, nil -} - -// Get - Get the project with the specified name. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - options - ProjectsClientGetOptions contains the optional parameters for the ProjectsClient.Get method. -func (client *ProjectsClient) Get(ctx context.Context, resourceGroupName string, projectName string, options *ProjectsClientGetOptions) (ProjectsClientGetResponse, error) { - var err error - const operationName = "ProjectsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, options) - if err != nil { - return ProjectsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProjectsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ProjectsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ProjectsClient) getCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *ProjectsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ProjectsClient) getHandleResponse(resp *http.Response) (ProjectsClientGetResponse, error) { - result := ProjectsClientGetResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.Project); err != nil { - return ProjectsClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Get all the projects in the resource group. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - options - ProjectsClientListOptions contains the optional parameters for the ProjectsClient.NewListPager method. -func (client *ProjectsClient) NewListPager(resourceGroupName string, options *ProjectsClientListOptions) *runtime.Pager[ProjectsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[ProjectsClientListResponse]{ - More: func(page ProjectsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ProjectsClientListResponse) (ProjectsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ProjectsClient.NewListPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, resourceGroupName, options) - }, nil) - if err != nil { - return ProjectsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *ProjectsClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *ProjectsClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *ProjectsClient) listHandleResponse(resp *http.Response) (ProjectsClientListResponse, error) { - result := ProjectsClientListResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.ProjectResultList); err != nil { - return ProjectsClientListResponse{}, err - } - return result, nil -} - -// NewListBySubscriptionPager - Get all the projects in the subscription. -// -// Generated from API version 2019-10-01 -// - options - ProjectsClientListBySubscriptionOptions contains the optional parameters for the ProjectsClient.NewListBySubscriptionPager -// method. -func (client *ProjectsClient) NewListBySubscriptionPager(options *ProjectsClientListBySubscriptionOptions) *runtime.Pager[ProjectsClientListBySubscriptionResponse] { - return runtime.NewPager(runtime.PagingHandler[ProjectsClientListBySubscriptionResponse]{ - More: func(page ProjectsClientListBySubscriptionResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ProjectsClientListBySubscriptionResponse) (ProjectsClientListBySubscriptionResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ProjectsClient.NewListBySubscriptionPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listBySubscriptionCreateRequest(ctx, options) - }, nil) - if err != nil { - return ProjectsClientListBySubscriptionResponse{}, err - } - return client.listBySubscriptionHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *ProjectsClient) listBySubscriptionCreateRequest(ctx context.Context, options *ProjectsClientListBySubscriptionOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Migrate/assessmentProjects" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listBySubscriptionHandleResponse handles the ListBySubscription response. -func (client *ProjectsClient) listBySubscriptionHandleResponse(resp *http.Response) (ProjectsClientListBySubscriptionResponse, error) { - result := ProjectsClientListBySubscriptionResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.ProjectResultList); err != nil { - return ProjectsClientListBySubscriptionResponse{}, err - } - return result, nil -} - -// Update - Update a project with specified name. Supports partial updates, for example only tags can be provided. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - options - ProjectsClientUpdateOptions contains the optional parameters for the ProjectsClient.Update method. -func (client *ProjectsClient) Update(ctx context.Context, resourceGroupName string, projectName string, options *ProjectsClientUpdateOptions) (ProjectsClientUpdateResponse, error) { - var err error - const operationName = "ProjectsClient.Update" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateCreateRequest(ctx, resourceGroupName, projectName, options) - if err != nil { - return ProjectsClientUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProjectsClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ProjectsClientUpdateResponse{}, err - } - resp, err := client.updateHandleResponse(httpResp) - return resp, err -} - -// updateCreateRequest creates the Update request. -func (client *ProjectsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *ProjectsClientUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.Project != nil { - if err := runtime.MarshalAsJSON(req, *options.Project); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// updateHandleResponse handles the Update response. -func (client *ProjectsClient) updateHandleResponse(resp *http.Response) (ProjectsClientUpdateResponse, error) { - result := ProjectsClientUpdateResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.Project); err != nil { - return ProjectsClientUpdateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/projects_client_example_test.go b/sdk/resourcemanager/migrate/armmigrate/projects_client_example_test.go deleted file mode 100644 index 33b1e362f1d3..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/projects_client_example_test.go +++ /dev/null @@ -1,1968 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmigrate_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/ProjectsInSubscription_List.json -func ExampleProjectsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewProjectsClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ProjectResultList = armmigrate.ProjectResultList{ - // Value: []*armmigrate.Project{ - // { - // Name: to.Ptr("site1493ae9ea68project"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects"), - // ETag: to.Ptr("\"0500be57-0000-0300-0000-5cb893f70000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/SMSValidations/providers/Microsoft.Migrate/assessmentprojects/site1493ae9ea68project"), - // Location: to.Ptr("centralus"), - // Properties: &armmigrate.ProjectProperties{ - // AssessmentSolutionID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/SMSValidations/providers/Microsoft.Migrate/MigrateProjects/SMSValidations-MigrateProject/Solutions/Servers-Assessment-ServerAssessment"), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-02-15T09:18:02.572Z"); return t}()), - // CustomerWorkspaceID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourcegroups/SMSValidations/providers/Microsoft.OperationalInsights/workspaces/test-haili-01"), - // CustomerWorkspaceLocation: to.Ptr("southeastasia"), - // LastAssessmentTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-18T15:12:55.238Z"); return t}()), - // NumberOfAssessments: to.Ptr[int32](12), - // NumberOfGroups: to.Ptr[int32](8), - // NumberOfMachines: to.Ptr[int32](26), - // ProjectStatus: to.Ptr(armmigrate.ProjectStatusActive), - // ProvisioningState: to.Ptr(armmigrate.ProvisioningStateSucceeded), - // ServiceEndpoint: to.Ptr("https://asmsrvprodcus.prod.migration.windowsazure.com/"), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-18T03:31:20.836Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("site1ad5aa6cc09project"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects"), - // ETag: to.Ptr("\"8300bdec-0000-0300-0000-5cd678410000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/ppValidation/providers/Microsoft.Migrate/assessmentprojects/site1ad5aa6cc09project"), - // Location: to.Ptr("centralus"), - // Properties: &armmigrate.ProjectProperties{ - // AssessmentSolutionID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/ppValidation/providers/Microsoft.Migrate/MigrateProjects/ppValidation-MigrateProject/Solutions/Servers-Assessment-ServerAssessment"), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-02-18T16:46:46.084Z"); return t}()), - // LastAssessmentTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-11T07:22:41.555Z"); return t}()), - // NumberOfAssessments: to.Ptr[int32](12), - // NumberOfGroups: to.Ptr[int32](7), - // NumberOfMachines: to.Ptr[int32](29), - // ProjectStatus: to.Ptr(armmigrate.ProjectStatusActive), - // ProvisioningState: to.Ptr(armmigrate.ProvisioningStateSucceeded), - // ServiceEndpoint: to.Ptr("https://asmsrvprodcus.prod.migration.windowsazure.com/"), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-02-18T16:46:46.084Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("migrateproject0720project"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects"), - // ETag: to.Ptr("\"0d00efcf-0000-0300-0000-5d6fdac70000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/SDKUpgradeValidations/providers/Microsoft.Migrate/assessmentprojects/migrateproject0720project"), - // Location: to.Ptr("centralus"), - // Properties: &armmigrate.ProjectProperties{ - // AssessmentSolutionID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/SDKUpgradeValidations/providers/Microsoft.Migrate/MigrateProjects/SDKUpgradeValidations-MigrateProject/Solutions/Servers-Assessment-ServerAssessment"), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-22T07:06:04.972Z"); return t}()), - // LastAssessmentTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-04T15:39:51.304Z"); return t}()), - // NumberOfAssessments: to.Ptr[int32](2), - // NumberOfGroups: to.Ptr[int32](1), - // NumberOfMachines: to.Ptr[int32](24), - // ProjectStatus: to.Ptr(armmigrate.ProjectStatusActive), - // ProvisioningState: to.Ptr(armmigrate.ProvisioningStateSucceeded), - // ServiceEndpoint: to.Ptr("https://asmsrvprodcus.prod.migration.windowsazure.com/"), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-22T07:06:04.972Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("migrateproject03acproject"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects"), - // ETag: to.Ptr("\"00004d14-0000-0300-0000-5cb820290000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/AccessibilityTesting/providers/Microsoft.Migrate/assessmentprojects/migrateproject03acproject"), - // Location: to.Ptr("centralus"), - // Properties: &armmigrate.ProjectProperties{ - // AssessmentSolutionID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/AccessibilityTesting/providers/Microsoft.Migrate/MigrateProjects/AccessibilityTesting-MigrateProject/Solutions/Servers-Assessment-ServerAssessment"), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-18T06:53:59.419Z"); return t}()), - // NumberOfAssessments: to.Ptr[int32](0), - // NumberOfGroups: to.Ptr[int32](0), - // NumberOfMachines: to.Ptr[int32](16), - // ProjectStatus: to.Ptr(armmigrate.ProjectStatusActive), - // ProvisioningState: to.Ptr(armmigrate.ProvisioningStateSucceeded), - // ServiceEndpoint: to.Ptr("https://asmsrvprodcus.prod.migration.windowsazure.com/"), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-18T06:53:59.419Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("migrateprojecta961project"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects"), - // ETag: to.Ptr("\"1300df9f-0000-0300-0000-5d6e6d860000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/vmwaretesting/providers/Microsoft.Migrate/assessmentprojects/migrateprojecta961project"), - // Location: to.Ptr("centralus"), - // Properties: &armmigrate.ProjectProperties{ - // AssessmentSolutionID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/vmwaretesting/providers/Microsoft.Migrate/MigrateProjects/vmwaretesting-MigrateProject/Solutions/Servers-Assessment-ServerAssessment"), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-20T11:59:42.735Z"); return t}()), - // CustomerWorkspaceID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourcegroups/vmwaretesting/providers/Microsoft.OperationalInsights/workspaces/mahpar324211"), - // CustomerWorkspaceLocation: to.Ptr("westeurope"), - // NumberOfAssessments: to.Ptr[int32](0), - // NumberOfGroups: to.Ptr[int32](1), - // NumberOfMachines: to.Ptr[int32](47), - // ProjectStatus: to.Ptr(armmigrate.ProjectStatusActive), - // ProvisioningState: to.Ptr(armmigrate.ProvisioningStateSucceeded), - // ServiceEndpoint: to.Ptr("https://asmsrvprodcus.prod.migration.windowsazure.com/"), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-03T13:41:26.677Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("PortalGAValidations43bbproject"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects"), - // ETag: to.Ptr("\"02006b1f-0000-0300-0000-5d24a44a0000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/GARegressionTesting/providers/Microsoft.Migrate/assessmentprojects/PortalGAValidations43bbproject"), - // Location: to.Ptr("centralus"), - // Properties: &armmigrate.ProjectProperties{ - // AssessmentSolutionID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/GARegressionTesting/providers/Microsoft.Migrate/MigrateProjects/PortalGAValidations/Solutions/Servers-Assessment-ServerAssessment"), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-04T03:56:50.853Z"); return t}()), - // LastAssessmentTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-09T14:27:22.885Z"); return t}()), - // NumberOfAssessments: to.Ptr[int32](4), - // NumberOfGroups: to.Ptr[int32](4), - // NumberOfMachines: to.Ptr[int32](49), - // ProjectStatus: to.Ptr(armmigrate.ProjectStatusActive), - // ProvisioningState: to.Ptr(armmigrate.ProvisioningStateSucceeded), - // ServiceEndpoint: to.Ptr("https://asmsrvprodcus.prod.migration.windowsazure.com/"), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-04T03:56:50.853Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("vaindana-pre-ga120dproject"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects"), - // ETag: to.Ptr("\"0400d98a-0000-0d00-0000-5cd3ff790000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/vaindana-migrate-ga-rg/providers/Microsoft.Migrate/assessmentprojects/vaindana-pre-ga120dproject"), - // Location: to.Ptr("westeurope"), - // Properties: &armmigrate.ProjectProperties{ - // AssessmentSolutionID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/vaindana-migrate-ga-rg/providers/Microsoft.Migrate/MigrateProjects/vaindana-pre-ga/Solutions/Servers-Assessment-ServerAssessment"), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-08T15:09:37.856Z"); return t}()), - // CustomerWorkspaceID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourcegroups/vaindana-migrate-ga-rg/providers/Microsoft.OperationalInsights/workspaces/vaindana-pre-ga-oms"), - // CustomerWorkspaceLocation: to.Ptr("westeurope"), - // LastAssessmentTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:22:48.973Z"); return t}()), - // NumberOfAssessments: to.Ptr[int32](2), - // NumberOfGroups: to.Ptr[int32](2), - // NumberOfMachines: to.Ptr[int32](14), - // ProjectStatus: to.Ptr(armmigrate.ProjectStatusActive), - // ProvisioningState: to.Ptr(armmigrate.ProvisioningStateSucceeded), - // ServiceEndpoint: to.Ptr("https://asmsrvprodwe.prod.migration.windowsazure.com/"), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-08T17:12:42.178Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("Mahesh-V2-Europe-Bugbash181eproject"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects"), - // ETag: to.Ptr("\"0b00349d-0000-0d00-0000-5d22eb5b0000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/Mahesh-RG-Eurpe-Bugbash/providers/Microsoft.Migrate/assessmentprojects/Mahesh-V2-Europe-Bugbash181eproject"), - // Location: to.Ptr("westeurope"), - // Properties: &armmigrate.ProjectProperties{ - // AssessmentSolutionID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/Mahesh-RG-Eurpe-Bugbash/providers/Microsoft.Migrate/MigrateProjects/Mahesh-V2-Europe-Bugbash/Solutions/Servers-Assessment-ServerAssessment"), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T07:38:23.034Z"); return t}()), - // LastAssessmentTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-02T06:38:34.281Z"); return t}()), - // NumberOfAssessments: to.Ptr[int32](6), - // NumberOfGroups: to.Ptr[int32](3), - // NumberOfMachines: to.Ptr[int32](36), - // ProjectStatus: to.Ptr(armmigrate.ProjectStatusActive), - // ProvisioningState: to.Ptr(armmigrate.ProvisioningStateSucceeded), - // ServiceEndpoint: to.Ptr("https://asmsrvprodwe.prod.migration.windowsazure.com/"), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T07:38:23.034Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("abgoyalWEselfhostb72bproject"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects"), - // ETag: to.Ptr("\"0600c777-0000-0d00-0000-5cdaa4170000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westEurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject"), - // Location: to.Ptr("westeurope"), - // Properties: &armmigrate.ProjectProperties{ - // AssessmentSolutionID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourcegroups/abgoyal-westeurope/providers/microsoft.migrate/migrateprojects/abgoyalweselfhost/Solutions/Servers-Assessment-ServerAssessment"), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T08:28:53.330Z"); return t}()), - // LastAssessmentTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-14T11:18:47.789Z"); return t}()), - // NumberOfAssessments: to.Ptr[int32](3), - // NumberOfGroups: to.Ptr[int32](2), - // NumberOfMachines: to.Ptr[int32](28), - // ProjectStatus: to.Ptr(armmigrate.ProjectStatusActive), - // ProvisioningState: to.Ptr(armmigrate.ProvisioningStateSucceeded), - // ServiceEndpoint: to.Ptr("https://asmsrvprodwe.prod.migration.windowsazure.com/"), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:11:16.022Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("vaindana-pre-ga-10180project"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects"), - // ETag: to.Ptr("\"01003c88-0000-0d00-0000-5d41601b0000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/vaindana-migrate-ga-rg/providers/Microsoft.Migrate/assessmentprojects/vaindana-pre-ga-10180project"), - // Location: to.Ptr("westeurope"), - // Properties: &armmigrate.ProjectProperties{ - // AssessmentSolutionID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/vaindana-migrate-ga-rg/providers/Microsoft.Migrate/MigrateProjects/vaindana-pre-ga-1/Solutions/Servers-Assessment-ServerAssessment"), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T11:58:13.021Z"); return t}()), - // LastAssessmentTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-31T09:32:11.496Z"); return t}()), - // NumberOfAssessments: to.Ptr[int32](4), - // NumberOfGroups: to.Ptr[int32](2), - // NumberOfMachines: to.Ptr[int32](101), - // ProjectStatus: to.Ptr(armmigrate.ProjectStatusActive), - // ProvisioningState: to.Ptr(armmigrate.ProvisioningStateSucceeded), - // ServiceEndpoint: to.Ptr("https://asmsrvprodwe.prod.migration.windowsazure.com/"), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-15T16:52:08.918Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Projects_List.json -func ExampleProjectsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewProjectsClient().NewListPager("abgoyal-westEurope", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ProjectResultList = armmigrate.ProjectResultList{ - // Value: []*armmigrate.Project{ - // { - // Name: to.Ptr("abgoyalWEselfhostb72bproject"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects"), - // ETag: to.Ptr("\"0600c777-0000-0d00-0000-5cdaa4170000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westEurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject"), - // Location: to.Ptr("westeurope"), - // Properties: &armmigrate.ProjectProperties{ - // AssessmentSolutionID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourcegroups/abgoyal-westeurope/providers/microsoft.migrate/migrateprojects/abgoyalweselfhost/Solutions/Servers-Assessment-ServerAssessment"), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T08:28:53.330Z"); return t}()), - // LastAssessmentTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-14T11:18:47.789Z"); return t}()), - // NumberOfAssessments: to.Ptr[int32](3), - // NumberOfGroups: to.Ptr[int32](2), - // NumberOfMachines: to.Ptr[int32](28), - // ProjectStatus: to.Ptr(armmigrate.ProjectStatusActive), - // ProvisioningState: to.Ptr(armmigrate.ProvisioningStateSucceeded), - // ServiceEndpoint: to.Ptr("https://asmsrvprodwe.prod.migration.windowsazure.com/"), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:11:16.022Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Projects_Get.json -func ExampleProjectsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProjectsClient().Get(ctx, "abgoyal-westEurope", "abgoyalWEselfhostb72bproject", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Project = armmigrate.Project{ - // Name: to.Ptr("abgoyalWEselfhostb72bproject"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects"), - // ETag: to.Ptr("\"0600c777-0000-0d00-0000-5cdaa4170000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westEurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject"), - // Location: to.Ptr("westeurope"), - // Properties: &armmigrate.ProjectProperties{ - // AssessmentSolutionID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourcegroups/abgoyal-westeurope/providers/microsoft.migrate/migrateprojects/abgoyalweselfhost/Solutions/Servers-Assessment-ServerAssessment"), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T08:28:53.330Z"); return t}()), - // LastAssessmentTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-14T11:18:47.789Z"); return t}()), - // NumberOfAssessments: to.Ptr[int32](3), - // NumberOfGroups: to.Ptr[int32](2), - // NumberOfMachines: to.Ptr[int32](28), - // ProjectStatus: to.Ptr(armmigrate.ProjectStatusActive), - // ProvisioningState: to.Ptr(armmigrate.ProvisioningStateSucceeded), - // ServiceEndpoint: to.Ptr("https://asmsrvprodwe.prod.migration.windowsazure.com/"), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-09T10:11:16.022Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Projects_Create.json -func ExampleProjectsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProjectsClient().Create(ctx, "abgoyal-westEurope", "abGoyalProject2", &armmigrate.ProjectsClientCreateOptions{Project: &armmigrate.Project{ - ETag: to.Ptr(""), - Location: to.Ptr("West Europe"), - Properties: &armmigrate.ProjectProperties{ - AssessmentSolutionID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourcegroups/abgoyal-westeurope/providers/microsoft.migrate/migrateprojects/abgoyalweselfhost/Solutions/Servers-Assessment-ServerAssessment"), - ProjectStatus: to.Ptr(armmigrate.ProjectStatusActive), - }, - Tags: map[string]any{}, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Project = armmigrate.Project{ - // Name: to.Ptr("abGoyalProject2"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects"), - // ETag: to.Ptr(""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abGoyalProject2"), - // Location: to.Ptr("West Europe"), - // Properties: &armmigrate.ProjectProperties{ - // AssessmentSolutionID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westEurope/providers/Microsoft.Migrate/assessmentprojects/abGoyalProject2"), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-08-26T05:56:58.752Z"); return t}()), - // NumberOfAssessments: to.Ptr[int32](0), - // NumberOfGroups: to.Ptr[int32](0), - // NumberOfMachines: to.Ptr[int32](0), - // ProjectStatus: to.Ptr(armmigrate.ProjectStatusActive), - // ServiceEndpoint: to.Ptr("https://localhost/"), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-08-26T05:56:58.799Z"); return t}()), - // }, - // Tags: map[string]any{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Projects_Update.json -func ExampleProjectsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProjectsClient().Update(ctx, "abgoyal-westEurope", "abGoyalProject2", &armmigrate.ProjectsClientUpdateOptions{Project: &armmigrate.Project{ - ETag: to.Ptr(""), - Location: to.Ptr("West Europe"), - Properties: &armmigrate.ProjectProperties{ - AssessmentSolutionID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourcegroups/abgoyal-westeurope/providers/microsoft.migrate/migrateprojects/abgoyalweselfhost/Solutions/Servers-Assessment-ServerAssessment"), - ProjectStatus: to.Ptr(armmigrate.ProjectStatusActive), - }, - Tags: map[string]any{}, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Project = armmigrate.Project{ - // Name: to.Ptr("abGoyalProject2"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects"), - // ETag: to.Ptr(""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abGoyalProject2"), - // Location: to.Ptr("West Europe"), - // Properties: &armmigrate.ProjectProperties{ - // AssessmentSolutionID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westEurope/providers/Microsoft.Migrate/assessmentprojects/abGoyalProject2"), - // CreatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-08-26T05:56:58.752Z"); return t}()), - // NumberOfAssessments: to.Ptr[int32](0), - // NumberOfGroups: to.Ptr[int32](0), - // NumberOfMachines: to.Ptr[int32](0), - // ProjectStatus: to.Ptr(armmigrate.ProjectStatusActive), - // ServiceEndpoint: to.Ptr("https://localhost/"), - // UpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-08-26T05:56:58.799Z"); return t}()), - // }, - // Tags: map[string]any{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Projects_Delete.json -func ExampleProjectsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewProjectsClient().Delete(ctx, "abgoyal-westEurope", "abGoyalProject2", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/AssessmentOptions_Get.json -func ExampleProjectsClient_AssessmentOptions() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProjectsClient().AssessmentOptions(ctx, "abgoyal-westEurope", "abgoyalWEselfhostb72bproject", "default", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AssessmentOptions = armmigrate.AssessmentOptions{ - // Name: to.Ptr("default"), - // ID: to.Ptr("/subscriptions/5cbd71ba-5a65-4f0c-aea2-33dadde87b4e/resourceGroups/shsinglarg/providers/Microsoft.Migrate/assessmentprojects/shProject/assessmentOptions/default"), - // Properties: &armmigrate.AssessmentOptionsProperties{ - // ReservedInstanceSupportedCurrencies: []*string{ - // to.Ptr("USD"), - // to.Ptr("DKK"), - // to.Ptr("CAD"), - // to.Ptr("JPY"), - // to.Ptr("KRW"), - // to.Ptr("NZD"), - // to.Ptr("NOK"), - // to.Ptr("RUB"), - // to.Ptr("SEK"), - // to.Ptr("GBP"), - // to.Ptr("INR"), - // to.Ptr("BRL"), - // to.Ptr("TWD"), - // to.Ptr("EUR"), - // to.Ptr("CHF"), - // to.Ptr("AUD")}, - // ReservedInstanceSupportedLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs")}, - // ReservedInstanceSupportedOffers: []*string{ - // to.Ptr("MSAZR0003P")}, - // ReservedInstanceVMFamilies: []*string{ - // to.Ptr("Dv2_series"), - // to.Ptr("F_series"), - // to.Ptr("Dv3_series"), - // to.Ptr("DS_series"), - // to.Ptr("DSv2_series"), - // to.Ptr("Fs_series"), - // to.Ptr("Dsv3_series"), - // to.Ptr("Ev3_series"), - // to.Ptr("Esv3_series"), - // to.Ptr("D_series"), - // to.Ptr("Fsv2_series"), - // to.Ptr("M_series"), - // to.Ptr("Ls_series"), - // to.Ptr("H_series")}, - // VMFamilies: []*armmigrate.VMFamily{ - // { - // Category: []*string{ - // to.Ptr("GeneralPurpose")}, - // FamilyName: to.Ptr("Standard_A0_A7"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovIowa"), - // to.Ptr("USGovVirginia"), - // to.Ptr("USDoDCentral"), - // to.Ptr("USDoDEast"), - // to.Ptr("ChinaNorth"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("GeneralPurpose")}, - // FamilyName: to.Ptr("Basic_A0_A4"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovIowa"), - // to.Ptr("USGovVirginia"), - // to.Ptr("USDoDCentral"), - // to.Ptr("USDoDEast"), - // to.Ptr("ChinaNorth"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("GeneralPurpose"), - // to.Ptr("MemoryOptimized")}, - // FamilyName: to.Ptr("Dv2_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovIowa"), - // to.Ptr("USGovVirginia"), - // to.Ptr("USDoDCentral"), - // to.Ptr("USDoDEast"), - // to.Ptr("ChinaNorth"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("ComputeOptimized")}, - // FamilyName: to.Ptr("F_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovIowa"), - // to.Ptr("USGovVirginia"), - // to.Ptr("USDoDCentral"), - // to.Ptr("USDoDEast"), - // to.Ptr("ChinaNorth"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("GeneralPurpose")}, - // FamilyName: to.Ptr("Av2_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovIowa"), - // to.Ptr("USGovVirginia"), - // to.Ptr("USDoDCentral"), - // to.Ptr("USDoDEast"), - // to.Ptr("ChinaNorth"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("GeneralPurpose")}, - // FamilyName: to.Ptr("Dv3_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovIowa"), - // to.Ptr("USGovVirginia"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("GeneralPurpose"), - // to.Ptr("MemoryOptimized"), - // to.Ptr("SupportsPremiumStorage")}, - // FamilyName: to.Ptr("DS_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("EastUs"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("USGovVirginia"), - // to.Ptr("ChinaNorth"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("GeneralPurpose"), - // to.Ptr("MemoryOptimized"), - // to.Ptr("SupportsPremiumStorage")}, - // FamilyName: to.Ptr("DSv2_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovVirginia"), - // to.Ptr("USDoDCentral"), - // to.Ptr("USDoDEast"), - // to.Ptr("ChinaNorth"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("ComputeOptimized"), - // to.Ptr("SupportsPremiumStorage")}, - // FamilyName: to.Ptr("Fs_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovVirginia"), - // to.Ptr("USDoDCentral"), - // to.Ptr("USDoDEast"), - // to.Ptr("ChinaNorth"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("GeneralPurpose"), - // to.Ptr("SupportsPremiumStorage")}, - // FamilyName: to.Ptr("Dsv3_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovVirginia")}, - // }, - // { - // Category: []*string{ - // to.Ptr("MemoryOptimized")}, - // FamilyName: to.Ptr("Ev3_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovIowa"), - // to.Ptr("USGovVirginia"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("MemoryOptimized"), - // to.Ptr("SupportsPremiumStorage")}, - // FamilyName: to.Ptr("Esv3_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovVirginia")}, - // }, - // { - // Category: []*string{ - // to.Ptr("GeneralPurpose")}, - // FamilyName: to.Ptr("D_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("USGovVirginia"), - // to.Ptr("ChinaNorth"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("ComputeOptimized"), - // to.Ptr("SupportsPremiumStorage")}, - // FamilyName: to.Ptr("Fsv2_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovVirginia")}, - // }, - // { - // Category: []*string{ - // to.Ptr("MemoryOptimized"), - // to.Ptr("SupportsPremiumStorage")}, - // FamilyName: to.Ptr("M_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovVirginia")}, - // }, - // { - // Category: []*string{ - // to.Ptr("MemoryOptimized")}, - // FamilyName: to.Ptr("G_series"), - // TargetLocations: []*string{ - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("JapanEast"), - // to.Ptr("UkSouth"), - // to.Ptr("WestUs2"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovVirginia")}, - // }, - // { - // Category: []*string{ - // to.Ptr("MemoryOptimized"), - // to.Ptr("SupportsPremiumStorage")}, - // FamilyName: to.Ptr("GS_series"), - // TargetLocations: []*string{ - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("JapanEast"), - // to.Ptr("UkSouth"), - // to.Ptr("WestUs2"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovVirginia")}, - // }, - // { - // Category: []*string{ - // to.Ptr("StorageOptimized"), - // to.Ptr("SupportsPremiumStorage")}, - // FamilyName: to.Ptr("Ls_series"), - // TargetLocations: []*string{ - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("JapanEast"), - // to.Ptr("UkSouth"), - // to.Ptr("WestUs2"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovVirginia")}, - // }, - // { - // Category: []*string{ - // to.Ptr("HighPerformanceCompute")}, - // FamilyName: to.Ptr("H_series"), - // TargetLocations: []*string{ - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("WestUs"), - // to.Ptr("USGovArizona")}, - // }, - // { - // Category: []*string{ - // to.Ptr("GeneralPurpose"), - // to.Ptr("SupportsPremiumStorage"), - // to.Ptr("Confidential")}, - // FamilyName: to.Ptr("DC_Series"), - // TargetLocations: []*string{ - // to.Ptr("WestEurope"), - // to.Ptr("EastUs")}, - // }, - // { - // Category: []*string{ - // to.Ptr("HighPerformanceCompute")}, - // FamilyName: to.Ptr("Standard_A8_A11"), - // TargetLocations: []*string{ - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("WestUs")}, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/AssessmentOptions_List.json -func ExampleProjectsClient_NewAssessmentOptionsListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewProjectsClient().NewAssessmentOptionsListPager("abgoyal-westEurope", "abgoyalWEselfhostb72bproject", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AssessmentOptionsResultList = armmigrate.AssessmentOptionsResultList{ - // Value: []*armmigrate.AssessmentOptions{ - // { - // Name: to.Ptr("default"), - // ID: to.Ptr("/subscriptions/5cbd71ba-5a65-4f0c-aea2-33dadde87b4e/resourceGroups/shsinglarg/providers/Microsoft.Migrate/assessmentprojects/shProject/assessmentOptions/default"), - // Properties: &armmigrate.AssessmentOptionsProperties{ - // ReservedInstanceSupportedCurrencies: []*string{ - // to.Ptr("USD"), - // to.Ptr("DKK"), - // to.Ptr("CAD"), - // to.Ptr("JPY"), - // to.Ptr("KRW"), - // to.Ptr("NZD"), - // to.Ptr("NOK"), - // to.Ptr("RUB"), - // to.Ptr("SEK"), - // to.Ptr("GBP"), - // to.Ptr("INR"), - // to.Ptr("BRL"), - // to.Ptr("TWD"), - // to.Ptr("EUR"), - // to.Ptr("CHF"), - // to.Ptr("AUD")}, - // ReservedInstanceSupportedLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs")}, - // ReservedInstanceSupportedOffers: []*string{ - // to.Ptr("MSAZR0003P")}, - // ReservedInstanceVMFamilies: []*string{ - // to.Ptr("Dv2_series"), - // to.Ptr("F_series"), - // to.Ptr("Dv3_series"), - // to.Ptr("DS_series"), - // to.Ptr("DSv2_series"), - // to.Ptr("Fs_series"), - // to.Ptr("Dsv3_series"), - // to.Ptr("Ev3_series"), - // to.Ptr("Esv3_series"), - // to.Ptr("D_series"), - // to.Ptr("Fsv2_series"), - // to.Ptr("M_series"), - // to.Ptr("Ls_series"), - // to.Ptr("H_series")}, - // VMFamilies: []*armmigrate.VMFamily{ - // { - // Category: []*string{ - // to.Ptr("GeneralPurpose")}, - // FamilyName: to.Ptr("Standard_A0_A7"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovIowa"), - // to.Ptr("USGovVirginia"), - // to.Ptr("USDoDCentral"), - // to.Ptr("USDoDEast"), - // to.Ptr("ChinaNorth"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("GeneralPurpose")}, - // FamilyName: to.Ptr("Basic_A0_A4"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovIowa"), - // to.Ptr("USGovVirginia"), - // to.Ptr("USDoDCentral"), - // to.Ptr("USDoDEast"), - // to.Ptr("ChinaNorth"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("GeneralPurpose"), - // to.Ptr("MemoryOptimized")}, - // FamilyName: to.Ptr("Dv2_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovIowa"), - // to.Ptr("USGovVirginia"), - // to.Ptr("USDoDCentral"), - // to.Ptr("USDoDEast"), - // to.Ptr("ChinaNorth"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("ComputeOptimized")}, - // FamilyName: to.Ptr("F_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovIowa"), - // to.Ptr("USGovVirginia"), - // to.Ptr("USDoDCentral"), - // to.Ptr("USDoDEast"), - // to.Ptr("ChinaNorth"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("GeneralPurpose")}, - // FamilyName: to.Ptr("Av2_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovIowa"), - // to.Ptr("USGovVirginia"), - // to.Ptr("USDoDCentral"), - // to.Ptr("USDoDEast"), - // to.Ptr("ChinaNorth"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("GeneralPurpose")}, - // FamilyName: to.Ptr("Dv3_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovIowa"), - // to.Ptr("USGovVirginia"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("GeneralPurpose"), - // to.Ptr("MemoryOptimized"), - // to.Ptr("SupportsPremiumStorage")}, - // FamilyName: to.Ptr("DS_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("EastUs"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("USGovVirginia"), - // to.Ptr("ChinaNorth"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("GeneralPurpose"), - // to.Ptr("MemoryOptimized"), - // to.Ptr("SupportsPremiumStorage")}, - // FamilyName: to.Ptr("DSv2_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovVirginia"), - // to.Ptr("USDoDCentral"), - // to.Ptr("USDoDEast"), - // to.Ptr("ChinaNorth"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("ComputeOptimized"), - // to.Ptr("SupportsPremiumStorage")}, - // FamilyName: to.Ptr("Fs_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovVirginia"), - // to.Ptr("USDoDCentral"), - // to.Ptr("USDoDEast"), - // to.Ptr("ChinaNorth"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("GeneralPurpose"), - // to.Ptr("SupportsPremiumStorage")}, - // FamilyName: to.Ptr("Dsv3_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovVirginia")}, - // }, - // { - // Category: []*string{ - // to.Ptr("MemoryOptimized")}, - // FamilyName: to.Ptr("Ev3_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovIowa"), - // to.Ptr("USGovVirginia"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("MemoryOptimized"), - // to.Ptr("SupportsPremiumStorage")}, - // FamilyName: to.Ptr("Esv3_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("WestCentralUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("GermanyNortheast"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovTexas"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovVirginia")}, - // }, - // { - // Category: []*string{ - // to.Ptr("GeneralPurpose")}, - // FamilyName: to.Ptr("D_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("USGovVirginia"), - // to.Ptr("ChinaNorth"), - // to.Ptr("ChinaEast")}, - // }, - // { - // Category: []*string{ - // to.Ptr("ComputeOptimized"), - // to.Ptr("SupportsPremiumStorage")}, - // FamilyName: to.Ptr("Fsv2_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("WestIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("CentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("FranceCentral"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovVirginia")}, - // }, - // { - // Category: []*string{ - // to.Ptr("MemoryOptimized"), - // to.Ptr("SupportsPremiumStorage")}, - // FamilyName: to.Ptr("M_series"), - // TargetLocations: []*string{ - // to.Ptr("EastAsia"), - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("AustraliaSoutheast"), - // to.Ptr("BrazilSouth"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("SouthIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("JapanWest"), - // to.Ptr("KoreaCentral"), - // to.Ptr("KoreaSouth"), - // to.Ptr("UkWest"), - // to.Ptr("UkSouth"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("EastUs2"), - // to.Ptr("USGovArizona"), - // to.Ptr("USGovVirginia")}, - // }, - // { - // Category: []*string{ - // to.Ptr("MemoryOptimized")}, - // FamilyName: to.Ptr("G_series"), - // TargetLocations: []*string{ - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("JapanEast"), - // to.Ptr("UkSouth"), - // to.Ptr("WestUs2"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovVirginia")}, - // }, - // { - // Category: []*string{ - // to.Ptr("MemoryOptimized"), - // to.Ptr("SupportsPremiumStorage")}, - // FamilyName: to.Ptr("GS_series"), - // TargetLocations: []*string{ - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("JapanEast"), - // to.Ptr("UkSouth"), - // to.Ptr("WestUs2"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovVirginia")}, - // }, - // { - // Category: []*string{ - // to.Ptr("StorageOptimized"), - // to.Ptr("SupportsPremiumStorage")}, - // FamilyName: to.Ptr("Ls_series"), - // TargetLocations: []*string{ - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("CanadaCentral"), - // to.Ptr("CanadaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("JapanEast"), - // to.Ptr("UkSouth"), - // to.Ptr("WestUs2"), - // to.Ptr("EastUs2"), - // to.Ptr("WestUs"), - // to.Ptr("GermanyCentral"), - // to.Ptr("USGovVirginia")}, - // }, - // { - // Category: []*string{ - // to.Ptr("HighPerformanceCompute")}, - // FamilyName: to.Ptr("H_series"), - // TargetLocations: []*string{ - // to.Ptr("SoutheastAsia"), - // to.Ptr("AustraliaEast"), - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("CentralIndia"), - // to.Ptr("JapanEast"), - // to.Ptr("UkSouth"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("WestUs2"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("WestUs"), - // to.Ptr("USGovArizona")}, - // }, - // { - // Category: []*string{ - // to.Ptr("GeneralPurpose"), - // to.Ptr("SupportsPremiumStorage"), - // to.Ptr("Confidential")}, - // FamilyName: to.Ptr("DC_Series"), - // TargetLocations: []*string{ - // to.Ptr("WestEurope"), - // to.Ptr("EastUs")}, - // }, - // { - // Category: []*string{ - // to.Ptr("HighPerformanceCompute")}, - // FamilyName: to.Ptr("Standard_A8_A11"), - // TargetLocations: []*string{ - // to.Ptr("WestEurope"), - // to.Ptr("NorthEurope"), - // to.Ptr("NorthCentralUs"), - // to.Ptr("EastUs"), - // to.Ptr("SouthCentralUs"), - // to.Ptr("WestUs")}, - // }}, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/migrate/armmigrate/response_types.go b/sdk/resourcemanager/migrate/armmigrate/response_types.go index 4340953383fb..77feb62d65c5 100644 --- a/sdk/resourcemanager/migrate/armmigrate/response_types.go +++ b/sdk/resourcemanager/migrate/armmigrate/response_types.go @@ -8,381 +8,1396 @@ package armmigrate -// AssessedMachinesClientGetResponse contains the response from method AssessedMachinesClient.Get. -type AssessedMachinesClientGetResponse struct { - // A machine evaluated as part of an assessment. - AssessedMachine +import "encoding/json" - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// DependencyMapControllerClientClientGroupMembersResponse contains the response from method DependencyMapControllerClient.BeginClientGroupMembers. +type DependencyMapControllerClientClientGroupMembersResponse struct { + // Anything + Interface any } -// AssessedMachinesClientListByAssessmentResponse contains the response from method AssessedMachinesClient.NewListByAssessmentPager. -type AssessedMachinesClientListByAssessmentResponse struct { - // List of assessed machines. - AssessedMachineResultList +// UnmarshalJSON implements the json.Unmarshaller interface for type DependencyMapControllerClientClientGroupMembersResponse. +func (d *DependencyMapControllerClientClientGroupMembersResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &d.Interface) +} + +// DependencyMapControllerClientExportDependenciesResponse contains the response from method DependencyMapControllerClient.BeginExportDependencies. +type DependencyMapControllerClientExportDependenciesResponse struct { + // Anything + Interface any +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DependencyMapControllerClientExportDependenciesResponse. +func (d *DependencyMapControllerClientExportDependenciesResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &d.Interface) +} + +// DependencyMapControllerClientGenerateCoarseMapResponse contains the response from method DependencyMapControllerClient.BeginGenerateCoarseMap. +type DependencyMapControllerClientGenerateCoarseMapResponse struct { + // Anything + Interface any +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DependencyMapControllerClientGenerateCoarseMapResponse. +func (d *DependencyMapControllerClientGenerateCoarseMapResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &d.Interface) +} + +// DependencyMapControllerClientGenerateDetailedMapResponse contains the response from method DependencyMapControllerClient.BeginGenerateDetailedMap. +type DependencyMapControllerClientGenerateDetailedMapResponse struct { + // Anything + Interface any +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DependencyMapControllerClientGenerateDetailedMapResponse. +func (d *DependencyMapControllerClientGenerateDetailedMapResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &d.Interface) +} + +// DependencyMapControllerClientServerGroupMembersResponse contains the response from method DependencyMapControllerClient.BeginServerGroupMembers. +type DependencyMapControllerClientServerGroupMembersResponse struct { + // Anything + Interface any +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DependencyMapControllerClientServerGroupMembersResponse. +func (d *DependencyMapControllerClientServerGroupMembersResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &d.Interface) +} + +// HypervClusterControllerClientCreateClusterResponse contains the response from method HypervClusterControllerClient.BeginCreateCluster. +type HypervClusterControllerClientCreateClusterResponse struct { + // A cluster resource belonging to a site resource. + HypervCluster +} + +// HypervClusterControllerClientDeleteResponse contains the response from method HypervClusterControllerClient.Delete. +type HypervClusterControllerClientDeleteResponse struct { + // placeholder for future response values +} + +// HypervClusterControllerClientGetClusterResponse contains the response from method HypervClusterControllerClient.GetCluster. +type HypervClusterControllerClientGetClusterResponse struct { + // A cluster resource belonging to a site resource. + HypervCluster +} + +// HypervClusterControllerClientListByHypervSiteResponse contains the response from method HypervClusterControllerClient.NewListByHypervSitePager. +type HypervClusterControllerClientListByHypervSiteResponse struct { + // The response of a HypervCluster list operation. + HypervClusterListResult +} + +// HypervDependencyMapControllerClientClientGroupMembersResponse contains the response from method HypervDependencyMapControllerClient.BeginClientGroupMembers. +type HypervDependencyMapControllerClientClientGroupMembersResponse struct { + // Anything + Interface any +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HypervDependencyMapControllerClientClientGroupMembersResponse. +func (h *HypervDependencyMapControllerClientClientGroupMembersResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &h.Interface) +} + +// HypervDependencyMapControllerClientExportDependenciesResponse contains the response from method HypervDependencyMapControllerClient.BeginExportDependencies. +type HypervDependencyMapControllerClientExportDependenciesResponse struct { + // Anything + Interface any +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HypervDependencyMapControllerClientExportDependenciesResponse. +func (h *HypervDependencyMapControllerClientExportDependenciesResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &h.Interface) +} + +// HypervDependencyMapControllerClientGenerateCoarseMapResponse contains the response from method HypervDependencyMapControllerClient.BeginGenerateCoarseMap. +type HypervDependencyMapControllerClientGenerateCoarseMapResponse struct { + // Anything + Interface any +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HypervDependencyMapControllerClientGenerateCoarseMapResponse. +func (h *HypervDependencyMapControllerClientGenerateCoarseMapResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &h.Interface) +} + +// HypervDependencyMapControllerClientGenerateDetailedMapResponse contains the response from method HypervDependencyMapControllerClient.BeginGenerateDetailedMap. +type HypervDependencyMapControllerClientGenerateDetailedMapResponse struct { + // Anything + Interface any +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HypervDependencyMapControllerClientGenerateDetailedMapResponse. +func (h *HypervDependencyMapControllerClientGenerateDetailedMapResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &h.Interface) +} + +// HypervDependencyMapControllerClientServerGroupMembersResponse contains the response from method HypervDependencyMapControllerClient.BeginServerGroupMembers. +type HypervDependencyMapControllerClientServerGroupMembersResponse struct { + // Anything + Interface any +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HypervDependencyMapControllerClientServerGroupMembersResponse. +func (h *HypervDependencyMapControllerClientServerGroupMembersResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &h.Interface) +} - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// HypervDependencyMapControllerClientUpdateDependencyMapStatusResponse contains the response from method HypervDependencyMapControllerClient.BeginUpdateDependencyMapStatus. +type HypervDependencyMapControllerClientUpdateDependencyMapStatusResponse struct { + // Anything + Interface any } -// AssessmentsClientCreateResponse contains the response from method AssessmentsClient.Create. -type AssessmentsClientCreateResponse struct { - // An assessment created for a group in the Migration project. - Assessment +// UnmarshalJSON implements the json.Unmarshaller interface for type HypervDependencyMapControllerClientUpdateDependencyMapStatusResponse. +func (h *HypervDependencyMapControllerClientUpdateDependencyMapStatusResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &h.Interface) +} + +// HypervHostControllerClientCreateResponse contains the response from method HypervHostControllerClient.BeginCreate. +type HypervHostControllerClientCreateResponse struct { + // A host resource belonging to a site resource. + HypervHost +} - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// HypervHostControllerClientDeleteResponse contains the response from method HypervHostControllerClient.BeginDelete. +type HypervHostControllerClientDeleteResponse struct { + // placeholder for future response values } -// AssessmentsClientDeleteResponse contains the response from method AssessmentsClient.Delete. -type AssessmentsClientDeleteResponse struct { - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// HypervHostControllerClientGetResponse contains the response from method HypervHostControllerClient.Get. +type HypervHostControllerClientGetResponse struct { + // A host resource belonging to a site resource. + HypervHost } -// AssessmentsClientGetReportDownloadURLResponse contains the response from method AssessmentsClient.GetReportDownloadURL. -type AssessmentsClientGetReportDownloadURLResponse struct { - // Download URL for assessment report. - DownloadURL +// HypervHostControllerClientListByHypervSiteResponse contains the response from method HypervHostControllerClient.NewListByHypervSitePager. +type HypervHostControllerClientListByHypervSiteResponse struct { + // The response of a HypervHost list operation. + HypervHostListResult +} - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// HypervJobsClientGetResponse contains the response from method HypervJobsClient.Get. +type HypervJobsClientGetResponse struct { + // A job resource belonging to a site resource. + HypervJob } -// AssessmentsClientGetResponse contains the response from method AssessmentsClient.Get. -type AssessmentsClientGetResponse struct { - // An assessment created for a group in the Migration project. - Assessment +// HypervJobsClientListByHypervSiteResponse contains the response from method HypervJobsClient.NewListByHypervSitePager. +type HypervJobsClientListByHypervSiteResponse struct { + // The response of a HypervJob list operation. + HypervJobListResult +} - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// HypervJobsControllerClientGetResponse contains the response from method HypervJobsControllerClient.Get. +type HypervJobsControllerClientGetResponse struct { + // A host resource belonging to a site resource. + VmwareJob } -// AssessmentsClientListByGroupResponse contains the response from method AssessmentsClient.NewListByGroupPager. -type AssessmentsClientListByGroupResponse struct { - // List of assessments. - AssessmentResultList +// HypervJobsControllerClientListByVmwareSiteResponse contains the response from method HypervJobsControllerClient.NewListByVmwareSitePager. +type HypervJobsControllerClientListByVmwareSiteResponse struct { + // The response of a VmwareJob list operation. + VmwareJobListResult +} - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// HypervMachinesControllerClientGetResponse contains the response from method HypervMachinesControllerClient.Get. +type HypervMachinesControllerClientGetResponse struct { + // A machine resource belonging to a site resource. + HypervMachine } -// AssessmentsClientListByProjectResponse contains the response from method AssessmentsClient.NewListByProjectPager. -type AssessmentsClientListByProjectResponse struct { - // List of assessments. - AssessmentResultList +// HypervMachinesControllerClientListByHypervSiteResponse contains the response from method HypervMachinesControllerClient.NewListByHypervSitePager. +type HypervMachinesControllerClientListByHypervSiteResponse struct { + // The response of a HypervMachine list operation. + HypervMachineListResult +} - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// HypervMachinesControllerClientUpdatePropertiesResponse contains the response from method HypervMachinesControllerClient.BeginUpdateProperties. +type HypervMachinesControllerClientUpdatePropertiesResponse struct { + // Anything + Interface any } -// GroupsClientCreateResponse contains the response from method GroupsClient.Create. -type GroupsClientCreateResponse struct { - // A group created in a Migration project. - Group +// UnmarshalJSON implements the json.Unmarshaller interface for type HypervMachinesControllerClientUpdatePropertiesResponse. +func (h *HypervMachinesControllerClientUpdatePropertiesResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &h.Interface) +} - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// HypervMachinesControllerClientUpdateResponse contains the response from method HypervMachinesControllerClient.Update. +type HypervMachinesControllerClientUpdateResponse struct { + // A machine resource belonging to a site resource. + HypervMachine } -// GroupsClientDeleteResponse contains the response from method GroupsClient.Delete. -type GroupsClientDeleteResponse struct { - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// HypervOperationsStatusControllerClientGetHypervOperationsStatusResponse contains the response from method HypervOperationsStatusControllerClient.GetHypervOperationsStatus. +type HypervOperationsStatusControllerClientGetHypervOperationsStatusResponse struct { + // Operation status REST resource. + OperationStatus } -// GroupsClientGetResponse contains the response from method GroupsClient.Get. -type GroupsClientGetResponse struct { - // A group created in a Migration project. - Group +// HypervRunAsAccountsControllerClientGetResponse contains the response from method HypervRunAsAccountsControllerClient.Get. +type HypervRunAsAccountsControllerClientGetResponse struct { + // A machine resource belonging to a site resource. + HypervRunAsAccountResource +} - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// HypervRunAsAccountsControllerClientListByHypervSiteResponse contains the response from method HypervRunAsAccountsControllerClient.NewListByHypervSitePager. +type HypervRunAsAccountsControllerClientListByHypervSiteResponse struct { + // The response of a HypervRunAsAccountResource list operation. + HypervRunAsAccountResourceListResult } -// GroupsClientListByProjectResponse contains the response from method GroupsClient.NewListByProjectPager. -type GroupsClientListByProjectResponse struct { - // List of groups. - GroupResultList +// HypervSitesClientListByResourceGroupResponse contains the response from method HypervSitesClient.NewListByResourceGroupPager. +type HypervSitesClientListByResourceGroupResponse struct { + // The response of a HypervSite list operation. + HypervSiteListResult +} - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// HypervSitesClientListBySubscriptionResponse contains the response from method HypervSitesClient.NewListBySubscriptionPager. +type HypervSitesClientListBySubscriptionResponse struct { + // The response of a HypervSite list operation. + HypervSiteListResult } -// GroupsClientUpdateMachinesResponse contains the response from method GroupsClient.UpdateMachines. -type GroupsClientUpdateMachinesResponse struct { - // A group created in a Migration project. - Group +// HypervSitesControllerClientComputeErrorSummaryResponse contains the response from method HypervSitesControllerClient.ComputeErrorSummary. +type HypervSitesControllerClientComputeErrorSummaryResponse struct { + // Site error summary. + SiteErrorSummary +} - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// HypervSitesControllerClientComputeusageResponse contains the response from method HypervSitesControllerClient.Computeusage. +type HypervSitesControllerClientComputeusageResponse struct { + // Hyper-V site usage. + HypervSiteUsage } -// HyperVCollectorsClientCreateResponse contains the response from method HyperVCollectorsClient.Create. -type HyperVCollectorsClientCreateResponse struct { - HyperVCollector +// HypervSitesControllerClientCreateResponse contains the response from method HypervSitesControllerClient.Create. +type HypervSitesControllerClientCreateResponse struct { + // A HyperV SiteResource + HypervSite - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string + // RetryAfter contains the information returned from the Retry-After header response. + RetryAfter *int32 } -// HyperVCollectorsClientDeleteResponse contains the response from method HyperVCollectorsClient.Delete. -type HyperVCollectorsClientDeleteResponse struct { - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// HypervSitesControllerClientDeleteResponse contains the response from method HypervSitesControllerClient.Delete. +type HypervSitesControllerClientDeleteResponse struct { + // placeholder for future response values } -// HyperVCollectorsClientGetResponse contains the response from method HyperVCollectorsClient.Get. -type HyperVCollectorsClientGetResponse struct { - HyperVCollector +// HypervSitesControllerClientExportApplicationsResponse contains the response from method HypervSitesControllerClient.BeginExportApplications. +type HypervSitesControllerClientExportApplicationsResponse struct { + // Anything + Interface any +} - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// UnmarshalJSON implements the json.Unmarshaller interface for type HypervSitesControllerClientExportApplicationsResponse. +func (h *HypervSitesControllerClientExportApplicationsResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &h.Interface) } -// HyperVCollectorsClientListByProjectResponse contains the response from method HyperVCollectorsClient.NewListByProjectPager. -type HyperVCollectorsClientListByProjectResponse struct { - // List of Hyper-V collectors. - HyperVCollectorList +// HypervSitesControllerClientExportMachineErrorsResponse contains the response from method HypervSitesControllerClient.BeginExportMachineErrors. +type HypervSitesControllerClientExportMachineErrorsResponse struct { + // Anything + Interface any +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HypervSitesControllerClientExportMachineErrorsResponse. +func (h *HypervSitesControllerClientExportMachineErrorsResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &h.Interface) +} - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// HypervSitesControllerClientGetResponse contains the response from method HypervSitesControllerClient.Get. +type HypervSitesControllerClientGetResponse struct { + // A HyperV SiteResource + HypervSite } -// ImportCollectorsClientCreateResponse contains the response from method ImportCollectorsClient.Create. -type ImportCollectorsClientCreateResponse struct { - ImportCollector +// HypervSitesControllerClientListHealthSummaryResponse contains the response from method HypervSitesControllerClient.ListHealthSummary. +type HypervSitesControllerClientListHealthSummaryResponse struct { + // Collection of SiteHealthSummary. + SiteHealthSummaryCollection +} - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// HypervSitesControllerClientSummaryResponse contains the response from method HypervSitesControllerClient.Summary. +type HypervSitesControllerClientSummaryResponse struct { + // Hyper-V site usage. + HypervSiteUsage } -// ImportCollectorsClientDeleteResponse contains the response from method ImportCollectorsClient.Delete. -type ImportCollectorsClientDeleteResponse struct { - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// HypervSitesControllerClientUpdateResponse contains the response from method HypervSitesControllerClient.Update. +type HypervSitesControllerClientUpdateResponse struct { + // A HyperV SiteResource + HypervSite } -// ImportCollectorsClientGetResponse contains the response from method ImportCollectorsClient.Get. -type ImportCollectorsClientGetResponse struct { - ImportCollector +// HypervSoftwareInventoriesControllerClientGetMachineSoftwareInventoryResponse contains the response from method HypervSoftwareInventoriesControllerClient.GetMachineSoftwareInventory. +type HypervSoftwareInventoriesControllerClientGetMachineSoftwareInventoryResponse struct { + // HyperV VM software inventory REST resource. + HypervVMSoftwareInventory +} - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// HypervSoftwareInventoriesControllerClientListByHypervMachineResponse contains the response from method HypervSoftwareInventoriesControllerClient.NewListByHypervMachinePager. +type HypervSoftwareInventoriesControllerClientListByHypervMachineResponse struct { + // The response of a HypervVmSoftwareInventory list operation. + HypervVMSoftwareInventoryListResult } -// ImportCollectorsClientListByProjectResponse contains the response from method ImportCollectorsClient.NewListByProjectPager. -type ImportCollectorsClientListByProjectResponse struct { - // List of Import collectors. - ImportCollectorList +// IisWebApplicationsControllerClientGetResponse contains the response from method IisWebApplicationsControllerClient.Get. +type IisWebApplicationsControllerClientGetResponse struct { + // Web application REST Resource. + IisWebApplications +} - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// IisWebApplicationsControllerClientListByWebAppSiteResponse contains the response from method IisWebApplicationsControllerClient.NewListByWebAppSitePager. +type IisWebApplicationsControllerClientListByWebAppSiteResponse struct { + // The response of a IisWebApplications list operation. + IisWebApplicationsListResult } -// MachinesClientGetResponse contains the response from method MachinesClient.Get. -type MachinesClientGetResponse struct { - // A machine in a migration project. - Machine +// IisWebApplicationsControllerClientUpdateResponse contains the response from method IisWebApplicationsControllerClient.Update. +type IisWebApplicationsControllerClientUpdateResponse struct { + // Web application REST Resource. + IisWebApplications +} + +// IisWebServersControllerClientGetResponse contains the response from method IisWebServersControllerClient.Get. +type IisWebServersControllerClientGetResponse struct { + // Web server REST Resource. + IisWebServers +} + +// IisWebServersControllerClientListByWebAppSiteResponse contains the response from method IisWebServersControllerClient.NewListByWebAppSitePager. +type IisWebServersControllerClientListByWebAppSiteResponse struct { + // The response of a IisWebServers list operation. + IisWebServersListResult +} - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// ImportJobsControllerClientGetDeletejobResponse contains the response from method ImportJobsControllerClient.GetDeletejob. +type ImportJobsControllerClientGetDeletejobResponse struct { + // A host resource belonging to a site resource. + DeleteImportMachinesJob } -// MachinesClientListByProjectResponse contains the response from method MachinesClient.NewListByProjectPager. -type MachinesClientListByProjectResponse struct { - // List of machines. - MachineResultList +// ImportJobsControllerClientGetExportjobResponse contains the response from method ImportJobsControllerClient.GetExportjob. +type ImportJobsControllerClientGetExportjobResponse struct { + // Export machines job REST resource. + ExportImportedMachinesJob +} + +// ImportJobsControllerClientGetImportjobResponse contains the response from method ImportJobsControllerClient.GetImportjob. +type ImportJobsControllerClientGetImportjobResponse struct { + // Import machines Job REST Resource. + ImportMachinesJob +} + +// ImportJobsControllerClientGetResponse contains the response from method ImportJobsControllerClient.Get. +type ImportJobsControllerClientGetResponse struct { + // A host resource belonging to a site resource. + ImportJob +} + +// ImportJobsControllerClientListByImportSiteResponse contains the response from method ImportJobsControllerClient.NewListByImportSitePager. +type ImportJobsControllerClientListByImportSiteResponse struct { + // The response of a ImportJob list operation. + ImportJobListResult +} + +// ImportJobsControllerClientListDeletejobsResponse contains the response from method ImportJobsControllerClient.NewListDeletejobsPager. +type ImportJobsControllerClientListDeletejobsResponse struct { + // Paged collection of DeleteImportMachinesJob items + PagedDeleteImportMachinesJob +} + +// ImportJobsControllerClientListExportjobsResponse contains the response from method ImportJobsControllerClient.NewListExportjobsPager. +type ImportJobsControllerClientListExportjobsResponse struct { + // Paged collection of ExportImportedMachinesJob items + PagedExportImportedMachinesJob +} + +// ImportJobsControllerClientListImportjobsResponse contains the response from method ImportJobsControllerClient.NewListImportjobsPager. +type ImportJobsControllerClientListImportjobsResponse struct { + // Paged collection of ImportMachinesJob items + PagedImportMachinesJob +} + +// ImportMachinesControllerClientDeleteResponse contains the response from method ImportMachinesControllerClient.Delete. +type ImportMachinesControllerClientDeleteResponse struct { + // placeholder for future response values +} + +// ImportMachinesControllerClientGetResponse contains the response from method ImportMachinesControllerClient.Get. +type ImportMachinesControllerClientGetResponse struct { + // An machine resource belonging to a site resource. + ImportMachine +} + +// ImportMachinesControllerClientListByImportSiteResponse contains the response from method ImportMachinesControllerClient.NewListByImportSitePager. +type ImportMachinesControllerClientListByImportSiteResponse struct { + // The response of a ImportMachine list operation. + ImportMachineListResult +} + +// ImportSitesControllerClientCreateResponse contains the response from method ImportSitesControllerClient.Create. +type ImportSitesControllerClientCreateResponse struct { + // A ImportSite + ImportSite + + // RetryAfter contains the information returned from the Retry-After header response. + RetryAfter *int32 +} - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// ImportSitesControllerClientDeleteImportedMachinesResponse contains the response from method ImportSitesControllerClient.DeleteImportedMachines. +type ImportSitesControllerClientDeleteImportedMachinesResponse struct { + // Import URI response class. + SasURIResponse +} + +// ImportSitesControllerClientDeleteResponse contains the response from method ImportSitesControllerClient.Delete. +type ImportSitesControllerClientDeleteResponse struct { + // placeholder for future response values +} + +// ImportSitesControllerClientExportURIResponse contains the response from method ImportSitesControllerClient.ExportURI. +type ImportSitesControllerClientExportURIResponse struct { + // Import URI response class. + SasURIResponse +} + +// ImportSitesControllerClientGetResponse contains the response from method ImportSitesControllerClient.Get. +type ImportSitesControllerClientGetResponse struct { + // A ImportSite + ImportSite +} + +// ImportSitesControllerClientImportURIResponse contains the response from method ImportSitesControllerClient.ImportURI. +type ImportSitesControllerClientImportURIResponse struct { + // Import URI response class. + SasURIResponse +} + +// ImportSitesControllerClientListByResourceGroupResponse contains the response from method ImportSitesControllerClient.NewListByResourceGroupPager. +type ImportSitesControllerClientListByResourceGroupResponse struct { + // The response of a ImportSite list operation. + ImportSiteListResult +} + +// ImportSitesControllerClientListBySubscriptionResponse contains the response from method ImportSitesControllerClient.NewListBySubscriptionPager. +type ImportSitesControllerClientListBySubscriptionResponse struct { + // The response of a ImportSite list operation. + ImportSiteListResult +} + +// ImportSitesControllerClientUpdateResponse contains the response from method ImportSitesControllerClient.Update. +type ImportSitesControllerClientUpdateResponse struct { + // A ImportSite + ImportSite +} + +// MachinesControllerClientGetResponse contains the response from method MachinesControllerClient.Get. +type MachinesControllerClientGetResponse struct { + // An machine resource belonging to a site resource. + MachineResource +} + +// MachinesControllerClientListByVmwareSiteResponse contains the response from method MachinesControllerClient.NewListByVmwareSitePager. +type MachinesControllerClientListByVmwareSiteResponse struct { + // The response of a MachineResource list operation. + MachineResourceListResult +} + +// MachinesControllerClientStartResponse contains the response from method MachinesControllerClient.BeginStart. +type MachinesControllerClientStartResponse struct { + // Anything + Interface any +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MachinesControllerClientStartResponse. +func (m *MachinesControllerClientStartResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &m.Interface) +} + +// MachinesControllerClientStopResponse contains the response from method MachinesControllerClient.BeginStop. +type MachinesControllerClientStopResponse struct { + // Anything + Interface any +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MachinesControllerClientStopResponse. +func (m *MachinesControllerClientStopResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &m.Interface) +} + +// MachinesControllerClientUpdateResponse contains the response from method MachinesControllerClient.Update. +type MachinesControllerClientUpdateResponse struct { + // An machine resource belonging to a site resource. + MachineResource +} + +// MasterSitesControllerClientCreateResponse contains the response from method MasterSitesControllerClient.BeginCreate. +type MasterSitesControllerClientCreateResponse struct { + // A MasterSite + MasterSite +} + +// MasterSitesControllerClientDeleteResponse contains the response from method MasterSitesControllerClient.Delete. +type MasterSitesControllerClientDeleteResponse struct { + // placeholder for future response values +} + +// MasterSitesControllerClientErrorSummaryResponse contains the response from method MasterSitesControllerClient.ErrorSummary. +type MasterSitesControllerClientErrorSummaryResponse struct { + // Site error summary. + SiteErrorSummary +} + +// MasterSitesControllerClientGetResponse contains the response from method MasterSitesControllerClient.Get. +type MasterSitesControllerClientGetResponse struct { + // A MasterSite + MasterSite +} + +// MasterSitesControllerClientListByResourceGroupResponse contains the response from method MasterSitesControllerClient.NewListByResourceGroupPager. +type MasterSitesControllerClientListByResourceGroupResponse struct { + // The response of a MasterSite list operation. + MasterSiteListResult +} + +// MasterSitesControllerClientListBySubscriptionResponse contains the response from method MasterSitesControllerClient.NewListBySubscriptionPager. +type MasterSitesControllerClientListBySubscriptionResponse struct { + // The response of a MasterSite list operation. + MasterSiteListResult +} + +// MasterSitesControllerClientUpdateResponse contains the response from method MasterSitesControllerClient.BeginUpdate. +type MasterSitesControllerClientUpdateResponse struct { + // A MasterSite + MasterSite +} + +// MasterSitesOperationsStatusControllerClientGetVmwareOperationStatusResponse contains the response from method MasterSitesOperationsStatusControllerClient.GetVmwareOperationStatus. +type MasterSitesOperationsStatusControllerClientGetVmwareOperationStatusResponse struct { + // Operation status REST resource. + OperationStatus } // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { - // List of API operations. - OperationResultList + // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. + OperationListResult } -// PrivateEndpointConnectionClientDeleteResponse contains the response from method PrivateEndpointConnectionClient.Delete. -type PrivateEndpointConnectionClientDeleteResponse struct { - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// PrivateEndpointConnectionControllerClientCreateResponse contains the response from method PrivateEndpointConnectionControllerClient.Create. +type PrivateEndpointConnectionControllerClientCreateResponse struct { + // REST model used to encapsulate Private Link properties for tracked resources. + PrivateEndpointConnection + + // RetryAfter contains the information returned from the Retry-After header response. + RetryAfter *int32 +} + +// PrivateEndpointConnectionControllerClientDeleteResponse contains the response from method PrivateEndpointConnectionControllerClient.Delete. +type PrivateEndpointConnectionControllerClientDeleteResponse struct { + // placeholder for future response values } -// PrivateEndpointConnectionClientGetResponse contains the response from method PrivateEndpointConnectionClient.Get. -type PrivateEndpointConnectionClientGetResponse struct { - // A private endpoint connection for a project. +// PrivateEndpointConnectionControllerClientGetResponse contains the response from method PrivateEndpointConnectionControllerClient.Get. +type PrivateEndpointConnectionControllerClientGetResponse struct { + // REST model used to encapsulate Private Link properties for tracked resources. PrivateEndpointConnection +} - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// PrivateEndpointConnectionControllerClientListByMasterSiteResponse contains the response from method PrivateEndpointConnectionControllerClient.NewListByMasterSitePager. +type PrivateEndpointConnectionControllerClientListByMasterSiteResponse struct { + // The response of a PrivateEndpointConnection list operation. + PrivateEndpointConnectionListResult } -// PrivateEndpointConnectionClientListByProjectResponse contains the response from method PrivateEndpointConnectionClient.ListByProject. -type PrivateEndpointConnectionClientListByProjectResponse struct { - // A collection of private endpoint connections for a project. - PrivateEndpointConnectionCollection +// PrivateLinkResourcesControllerClientGetResponse contains the response from method PrivateLinkResourcesControllerClient.Get. +type PrivateLinkResourcesControllerClientGetResponse struct { + // REST model used to encapsulate Private Link properties for tracked resources. + PrivateLinkResource +} - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// PrivateLinkResourcesControllerClientListByMasterSiteResponse contains the response from method PrivateLinkResourcesControllerClient.NewListByMasterSitePager. +type PrivateLinkResourcesControllerClientListByMasterSiteResponse struct { + // The response of a PrivateLinkResource list operation. + PrivateLinkResourceListResult } -// PrivateEndpointConnectionClientUpdateResponse contains the response from method PrivateEndpointConnectionClient.Update. -type PrivateEndpointConnectionClientUpdateResponse struct { - // A private endpoint connection for a project. - PrivateEndpointConnection +// RunAsAccountsControllerClientGetResponse contains the response from method RunAsAccountsControllerClient.Get. +type RunAsAccountsControllerClientGetResponse struct { + // A runasaccount resource belonging to a site resource. + VmwareRunAsAccountResource +} - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// RunAsAccountsControllerClientListByVmwareSiteResponse contains the response from method RunAsAccountsControllerClient.NewListByVmwareSitePager. +type RunAsAccountsControllerClientListByVmwareSiteResponse struct { + // The response of a VmwareRunAsAccountResource list operation. + VmwareRunAsAccountResourceListResult } -// PrivateLinkResourceClientGetResponse contains the response from method PrivateLinkResourceClient.Get. -type PrivateLinkResourceClientGetResponse struct { - // A private link resource for a project for which a private endpoint can be created. - PrivateLinkResource +// SQLAvailabilityGroupsControllerClientGetResponse contains the response from method SQLAvailabilityGroupsControllerClient.Get. +type SQLAvailabilityGroupsControllerClientGetResponse struct { + // Class representing the web model of SQL Availability Group. + SQLAvailabilityGroup +} + +// SQLAvailabilityGroupsControllerClientListBySQLSiteResponse contains the response from method SQLAvailabilityGroupsControllerClient.NewListBySQLSitePager. +type SQLAvailabilityGroupsControllerClientListBySQLSiteResponse struct { + // The response of a SqlAvailabilityGroup list operation. + SQLAvailabilityGroupListResult +} + +// SQLDatabasesControllerClientGetResponse contains the response from method SQLDatabasesControllerClient.Get. +type SQLDatabasesControllerClientGetResponse struct { + // Class representing the web model of SQL Database. + SQLDatabaseV2 +} + +// SQLDatabasesControllerClientListBySQLSiteResponse contains the response from method SQLDatabasesControllerClient.NewListBySQLSitePager. +type SQLDatabasesControllerClientListBySQLSiteResponse struct { + // The response of a SqlDatabaseV2 list operation. + SQLDatabaseV2ListResult +} + +// SQLDiscoverySiteDataSourceControllerClientCreateResponse contains the response from method SQLDiscoverySiteDataSourceControllerClient.BeginCreate. +type SQLDiscoverySiteDataSourceControllerClientCreateResponse struct { + // A SQL discovery site data source resource. + SQLDiscoverySiteDataSource +} + +// SQLDiscoverySiteDataSourceControllerClientDeleteResponse contains the response from method SQLDiscoverySiteDataSourceControllerClient.Delete. +type SQLDiscoverySiteDataSourceControllerClientDeleteResponse struct { + // placeholder for future response values +} + +// SQLDiscoverySiteDataSourceControllerClientGetResponse contains the response from method SQLDiscoverySiteDataSourceControllerClient.Get. +type SQLDiscoverySiteDataSourceControllerClientGetResponse struct { + // A SQL discovery site data source resource. + SQLDiscoverySiteDataSource +} + +// SQLDiscoverySiteDataSourceControllerClientListBySQLSiteResponse contains the response from method SQLDiscoverySiteDataSourceControllerClient.NewListBySQLSitePager. +type SQLDiscoverySiteDataSourceControllerClientListBySQLSiteResponse struct { + // The response of a SqlDiscoverySiteDataSource list operation. + SQLDiscoverySiteDataSourceListResult +} + +// SQLJobsControllerClientGetResponse contains the response from method SQLJobsControllerClient.Get. +type SQLJobsControllerClientGetResponse struct { + // Class representing the web model of SQL Database. + SQLJob +} + +// SQLJobsControllerClientListBySQLSiteResponse contains the response from method SQLJobsControllerClient.NewListBySQLSitePager. +type SQLJobsControllerClientListBySQLSiteResponse struct { + // The response of a SqlJob list operation. + SQLJobListResult +} + +// SQLOperationsStatusControllerClientGetSQLOperationStatusResponse contains the response from method SQLOperationsStatusControllerClient.GetSQLOperationStatus. +type SQLOperationsStatusControllerClientGetSQLOperationStatusResponse struct { + // Operation status REST resource. + OperationStatus +} + +// SQLRunAsAccountsControllerClientGetResponse contains the response from method SQLRunAsAccountsControllerClient.Get. +type SQLRunAsAccountsControllerClientGetResponse struct { + // A runasaccount resource belonging to a site resource. + SQLRunAsAccount +} + +// SQLRunAsAccountsControllerClientListBySQLSiteResponse contains the response from method SQLRunAsAccountsControllerClient.NewListBySQLSitePager. +type SQLRunAsAccountsControllerClientListBySQLSiteResponse struct { + // The response of a SqlRunAsAccount list operation. + SQLRunAsAccountListResult +} + +// SQLServersControllerClientGetResponse contains the response from method SQLServersControllerClient.Get. +type SQLServersControllerClientGetResponse struct { + // Class representing the web model of SQL Server. + SQLServerV2 +} + +// SQLServersControllerClientListBySQLSiteResponse contains the response from method SQLServersControllerClient.NewListBySQLSitePager. +type SQLServersControllerClientListBySQLSiteResponse struct { + // The response of a SqlServerV2 list operation. + SQLServerV2ListResult +} + +// SQLServersControllerClientUpdateResponse contains the response from method SQLServersControllerClient.Update. +type SQLServersControllerClientUpdateResponse struct { + // Class representing the web model of SQL Server. + SQLServerV2 +} + +// SQLSitesControllerClientCreateResponse contains the response from method SQLSitesControllerClient.Create. +type SQLSitesControllerClientCreateResponse struct { + // SQL site web model. + SQLSite + + // RetryAfter contains the information returned from the Retry-After header response. + RetryAfter *int32 +} + +// SQLSitesControllerClientDeleteResponse contains the response from method SQLSitesControllerClient.Delete. +type SQLSitesControllerClientDeleteResponse struct { + // placeholder for future response values +} + +// SQLSitesControllerClientErrorSummaryResponse contains the response from method SQLSitesControllerClient.ErrorSummary. +type SQLSitesControllerClientErrorSummaryResponse struct { + // Site error summary. + SiteErrorSummary +} + +// SQLSitesControllerClientExportSQLServerErrorsResponse contains the response from method SQLSitesControllerClient.BeginExportSQLServerErrors. +type SQLSitesControllerClientExportSQLServerErrorsResponse struct { + // Anything + Interface any +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLSitesControllerClientExportSQLServerErrorsResponse. +func (s *SQLSitesControllerClientExportSQLServerErrorsResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &s.Interface) +} + +// SQLSitesControllerClientExportSQLServersResponse contains the response from method SQLSitesControllerClient.BeginExportSQLServers. +type SQLSitesControllerClientExportSQLServersResponse struct { + // Anything + Interface any +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLSitesControllerClientExportSQLServersResponse. +func (s *SQLSitesControllerClientExportSQLServersResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &s.Interface) +} + +// SQLSitesControllerClientGetResponse contains the response from method SQLSitesControllerClient.Get. +type SQLSitesControllerClientGetResponse struct { + // SQL site web model. + SQLSite +} + +// SQLSitesControllerClientListByMasterSiteResponse contains the response from method SQLSitesControllerClient.NewListByMasterSitePager. +type SQLSitesControllerClientListByMasterSiteResponse struct { + // The response of a SqlSite list operation. + SQLSiteListResult +} + +// SQLSitesControllerClientRefreshResponse contains the response from method SQLSitesControllerClient.BeginRefresh. +type SQLSitesControllerClientRefreshResponse struct { + // Anything + Interface any +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLSitesControllerClientRefreshResponse. +func (s *SQLSitesControllerClientRefreshResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &s.Interface) +} + +// SQLSitesControllerClientSummaryResponse contains the response from method SQLSitesControllerClient.Summary. +type SQLSitesControllerClientSummaryResponse struct { + // SQL site usage. + SQLSiteUsage +} + +// SQLSitesControllerClientUpdateResponse contains the response from method SQLSitesControllerClient.BeginUpdate. +type SQLSitesControllerClientUpdateResponse struct { + // SQL site web model. + SQLSite +} + +// ServerDependencyMapControllerClientClientGroupMembersResponse contains the response from method ServerDependencyMapControllerClient.BeginClientGroupMembers. +type ServerDependencyMapControllerClientClientGroupMembersResponse struct { + // Anything + Interface any +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerDependencyMapControllerClientClientGroupMembersResponse. +func (s *ServerDependencyMapControllerClientClientGroupMembersResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &s.Interface) +} + +// ServerDependencyMapControllerClientExportDependenciesResponse contains the response from method ServerDependencyMapControllerClient.BeginExportDependencies. +type ServerDependencyMapControllerClientExportDependenciesResponse struct { + // Anything + Interface any +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerDependencyMapControllerClientExportDependenciesResponse. +func (s *ServerDependencyMapControllerClientExportDependenciesResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &s.Interface) +} + +// ServerDependencyMapControllerClientGenerateCoarseMapResponse contains the response from method ServerDependencyMapControllerClient.BeginGenerateCoarseMap. +type ServerDependencyMapControllerClientGenerateCoarseMapResponse struct { + // Anything + Interface any +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerDependencyMapControllerClientGenerateCoarseMapResponse. +func (s *ServerDependencyMapControllerClientGenerateCoarseMapResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &s.Interface) +} + +// ServerDependencyMapControllerClientGenerateDetailedMapResponse contains the response from method ServerDependencyMapControllerClient.BeginGenerateDetailedMap. +type ServerDependencyMapControllerClientGenerateDetailedMapResponse struct { + // Anything + Interface any +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerDependencyMapControllerClientGenerateDetailedMapResponse. +func (s *ServerDependencyMapControllerClientGenerateDetailedMapResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &s.Interface) +} + +// ServerDependencyMapControllerClientServerGroupMembersResponse contains the response from method ServerDependencyMapControllerClient.BeginServerGroupMembers. +type ServerDependencyMapControllerClientServerGroupMembersResponse struct { + // Anything + Interface any +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerDependencyMapControllerClientServerGroupMembersResponse. +func (s *ServerDependencyMapControllerClientServerGroupMembersResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &s.Interface) +} + +// ServerJobsControllerClientGetResponse contains the response from method ServerJobsControllerClient.Get. +type ServerJobsControllerClientGetResponse struct { + // A host resource belonging to a site resource. + ServerJob +} - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// ServerJobsControllerClientListByServerSiteResourceResponse contains the response from method ServerJobsControllerClient.NewListByServerSiteResourcePager. +type ServerJobsControllerClientListByServerSiteResourceResponse struct { + // The response of a ServerJob list operation. + ServerJobListResult } -// PrivateLinkResourceClientListByProjectResponse contains the response from method PrivateLinkResourceClient.ListByProject. -type PrivateLinkResourceClientListByProjectResponse struct { - // A list of private link resources - PrivateLinkResourceCollection +// ServerOperationsStatusControllerClientGetServerSiteOperationsStatusResponse contains the response from method ServerOperationsStatusControllerClient.GetServerSiteOperationsStatus. +type ServerOperationsStatusControllerClientGetServerSiteOperationsStatusResponse struct { + // Operation status REST resource. + OperationStatus +} - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// ServerRunAsAccountsControllerClientGetResponse contains the response from method ServerRunAsAccountsControllerClient.Get. +type ServerRunAsAccountsControllerClientGetResponse struct { + // A run as account resource belonging to a site resource. + ServerRunAsAccount } -// ProjectsClientAssessmentOptionsListResponse contains the response from method ProjectsClient.NewAssessmentOptionsListPager. -type ProjectsClientAssessmentOptionsListResponse struct { - // List of API operations. - AssessmentOptionsResultList +// ServerRunAsAccountsControllerClientListByServerSiteResourceResponse contains the response from method ServerRunAsAccountsControllerClient.NewListByServerSiteResourcePager. +type ServerRunAsAccountsControllerClientListByServerSiteResourceResponse struct { + // The response of a ServerRunAsAccount list operation. + ServerRunAsAccountListResult +} - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// ServerSitesControllerClientComputeErrorSummaryResponse contains the response from method ServerSitesControllerClient.ComputeErrorSummary. +type ServerSitesControllerClientComputeErrorSummaryResponse struct { + // Site error summary. + SiteErrorSummary } -// ProjectsClientAssessmentOptionsResponse contains the response from method ProjectsClient.AssessmentOptions. -type ProjectsClientAssessmentOptionsResponse struct { - // Assessment options. - AssessmentOptions +// ServerSitesControllerClientComputeusageResponse contains the response from method ServerSitesControllerClient.Computeusage. +type ServerSitesControllerClientComputeusageResponse struct { + // The properties of ServerSiteUsageResponse. + ServerSiteUsageResponse +} - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// ServerSitesControllerClientCreateResponse contains the response from method ServerSitesControllerClient.BeginCreate. +type ServerSitesControllerClientCreateResponse struct { + // A ServerSiteResource + ServerSiteResource } -// ProjectsClientCreateResponse contains the response from method ProjectsClient.Create. -type ProjectsClientCreateResponse struct { - // Azure Migrate Project. - Project +// ServerSitesControllerClientDeleteResponse contains the response from method ServerSitesControllerClient.Delete. +type ServerSitesControllerClientDeleteResponse struct { + // placeholder for future response values +} - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// ServerSitesControllerClientExportApplicationsResponse contains the response from method ServerSitesControllerClient.BeginExportApplications. +type ServerSitesControllerClientExportApplicationsResponse struct { + // Anything + Interface any } -// ProjectsClientDeleteResponse contains the response from method ProjectsClient.Delete. -type ProjectsClientDeleteResponse struct { - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerSitesControllerClientExportApplicationsResponse. +func (s *ServerSitesControllerClientExportApplicationsResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &s.Interface) } -// ProjectsClientGetResponse contains the response from method ProjectsClient.Get. -type ProjectsClientGetResponse struct { - // Azure Migrate Project. - Project +// ServerSitesControllerClientExportMachineErrorsResponse contains the response from method ServerSitesControllerClient.BeginExportMachineErrors. +type ServerSitesControllerClientExportMachineErrorsResponse struct { + // Anything + Interface any +} - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerSitesControllerClientExportMachineErrorsResponse. +func (s *ServerSitesControllerClientExportMachineErrorsResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &s.Interface) } -// ProjectsClientListBySubscriptionResponse contains the response from method ProjectsClient.NewListBySubscriptionPager. -type ProjectsClientListBySubscriptionResponse struct { - // List of projects. - ProjectResultList +// ServerSitesControllerClientGetResponse contains the response from method ServerSitesControllerClient.Get. +type ServerSitesControllerClientGetResponse struct { + // A ServerSiteResource + ServerSiteResource +} - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// ServerSitesControllerClientListByResourceGroupResponse contains the response from method ServerSitesControllerClient.NewListByResourceGroupPager. +type ServerSitesControllerClientListByResourceGroupResponse struct { + // The response of a ServerSiteResource list operation. + ServerSiteResourceListResult } -// ProjectsClientListResponse contains the response from method ProjectsClient.NewListPager. -type ProjectsClientListResponse struct { - // List of projects. - ProjectResultList +// ServerSitesControllerClientListBySubscriptionResponse contains the response from method ServerSitesControllerClient.NewListBySubscriptionPager. +type ServerSitesControllerClientListBySubscriptionResponse struct { + // The response of a ServerSiteResource list operation. + ServerSiteResourceListResult +} - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// ServerSitesControllerClientListHealthSummaryResponse contains the response from method ServerSitesControllerClient.ListHealthSummary. +type ServerSitesControllerClientListHealthSummaryResponse struct { + // Collection of SiteHealthSummary. + SiteHealthSummaryCollection } -// ProjectsClientUpdateResponse contains the response from method ProjectsClient.Update. -type ProjectsClientUpdateResponse struct { - // Azure Migrate Project. - Project +// ServerSitesControllerClientRefreshSiteResponse contains the response from method ServerSitesControllerClient.BeginRefreshSite. +type ServerSitesControllerClientRefreshSiteResponse struct { + // Anything + Interface any +} - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerSitesControllerClientRefreshSiteResponse. +func (s *ServerSitesControllerClientRefreshSiteResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &s.Interface) } -// ServerCollectorsClientCreateResponse contains the response from method ServerCollectorsClient.Create. -type ServerCollectorsClientCreateResponse struct { - ServerCollector +// ServerSitesControllerClientSummaryResponse contains the response from method ServerSitesControllerClient.Summary. +type ServerSitesControllerClientSummaryResponse struct { + // Server site usage. + ServerSiteUsage +} - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// ServerSitesControllerClientUpdateDependencyMapStatusResponse contains the response from method ServerSitesControllerClient.BeginUpdateDependencyMapStatus. +type ServerSitesControllerClientUpdateDependencyMapStatusResponse struct { + // Anything + Interface any } -// ServerCollectorsClientDeleteResponse contains the response from method ServerCollectorsClient.Delete. -type ServerCollectorsClientDeleteResponse struct { - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerSitesControllerClientUpdateDependencyMapStatusResponse. +func (s *ServerSitesControllerClientUpdateDependencyMapStatusResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &s.Interface) } -// ServerCollectorsClientGetResponse contains the response from method ServerCollectorsClient.Get. -type ServerCollectorsClientGetResponse struct { - ServerCollector +// ServerSitesControllerClientUpdatePropertiesResponse contains the response from method ServerSitesControllerClient.BeginUpdateProperties. +type ServerSitesControllerClientUpdatePropertiesResponse struct { + // Anything + Interface any +} - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerSitesControllerClientUpdatePropertiesResponse. +func (s *ServerSitesControllerClientUpdatePropertiesResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &s.Interface) } -// ServerCollectorsClientListByProjectResponse contains the response from method ServerCollectorsClient.NewListByProjectPager. -type ServerCollectorsClientListByProjectResponse struct { - // List of Server collectors. - ServerCollectorList +// ServerSitesControllerClientUpdateResponse contains the response from method ServerSitesControllerClient.Update. +type ServerSitesControllerClientUpdateResponse struct { + // A ServerSiteResource + ServerSiteResource +} - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// ServerSoftwareInventoriesControllerClientGetMachineSoftwareInventoryResponse contains the response from method ServerSoftwareInventoriesControllerClient.GetMachineSoftwareInventory. +type ServerSoftwareInventoriesControllerClientGetMachineSoftwareInventoryResponse struct { + // An software inventory resource belonging to a server resource. + ServerSoftwareInventory } -// VMwareCollectorsClientCreateResponse contains the response from method VMwareCollectorsClient.Create. -type VMwareCollectorsClientCreateResponse struct { - VMwareCollector +// ServerSoftwareInventoriesControllerClientListByServerResponse contains the response from method ServerSoftwareInventoriesControllerClient.NewListByServerPager. +type ServerSoftwareInventoriesControllerClientListByServerResponse struct { + // The response of a ServerSoftwareInventory list operation. + ServerSoftwareInventoryListResult +} - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// ServersControllerClientDeleteMachineResponse contains the response from method ServersControllerClient.DeleteMachine. +type ServersControllerClientDeleteMachineResponse struct { + // placeholder for future response values } -// VMwareCollectorsClientDeleteResponse contains the response from method VMwareCollectorsClient.Delete. -type VMwareCollectorsClientDeleteResponse struct { - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// ServersControllerClientGetMachineResponse contains the response from method ServersControllerClient.GetMachine. +type ServersControllerClientGetMachineResponse struct { + // A machine resource belonging to a site resource. + Server } -// VMwareCollectorsClientGetResponse contains the response from method VMwareCollectorsClient.Get. -type VMwareCollectorsClientGetResponse struct { - VMwareCollector +// ServersControllerClientListByServerSiteResourceResponse contains the response from method ServersControllerClient.NewListByServerSiteResourcePager. +type ServersControllerClientListByServerSiteResourceResponse struct { + // The response of a Server list operation. + ServerListResult +} + +// ServersControllerClientUpdateMachineResponse contains the response from method ServersControllerClient.UpdateMachine. +type ServersControllerClientUpdateMachineResponse struct { + // A machine resource belonging to a site resource. + Server +} - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// SitesControllerClientComputeErrorSummaryResponse contains the response from method SitesControllerClient.ComputeErrorSummary. +type SitesControllerClientComputeErrorSummaryResponse struct { + // Site error summary. + SiteErrorSummary } -// VMwareCollectorsClientListByProjectResponse contains the response from method VMwareCollectorsClient.NewListByProjectPager. -type VMwareCollectorsClientListByProjectResponse struct { - // List of VMware collectors. - VMwareCollectorList +// SitesControllerClientComputeusageResponse contains the response from method SitesControllerClient.Computeusage. +type SitesControllerClientComputeusageResponse struct { + // VMware site usage. + VmwareSiteUsage +} + +// SitesControllerClientCreateResponse contains the response from method SitesControllerClient.Create. +type SitesControllerClientCreateResponse struct { + // A VmwareSite + VmwareSite + + // RetryAfter contains the information returned from the Retry-After header response. + RetryAfter *int32 +} + +// SitesControllerClientDeleteResponse contains the response from method SitesControllerClient.Delete. +type SitesControllerClientDeleteResponse struct { + // placeholder for future response values +} + +// SitesControllerClientExportApplicationsResponse contains the response from method SitesControllerClient.BeginExportApplications. +type SitesControllerClientExportApplicationsResponse struct { + // Anything + Interface any +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SitesControllerClientExportApplicationsResponse. +func (s *SitesControllerClientExportApplicationsResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &s.Interface) +} + +// SitesControllerClientExportMachineErrorsResponse contains the response from method SitesControllerClient.BeginExportMachineErrors. +type SitesControllerClientExportMachineErrorsResponse struct { + // Anything + Interface any +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SitesControllerClientExportMachineErrorsResponse. +func (s *SitesControllerClientExportMachineErrorsResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &s.Interface) +} + +// SitesControllerClientExportMachinesResponse contains the response from method SitesControllerClient.BeginExportMachines. +type SitesControllerClientExportMachinesResponse struct { + // Anything + Interface any +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SitesControllerClientExportMachinesResponse. +func (s *SitesControllerClientExportMachinesResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &s.Interface) +} + +// SitesControllerClientGetResponse contains the response from method SitesControllerClient.Get. +type SitesControllerClientGetResponse struct { + // A VmwareSite + VmwareSite +} + +// SitesControllerClientListByResourceGroupResponse contains the response from method SitesControllerClient.NewListByResourceGroupPager. +type SitesControllerClientListByResourceGroupResponse struct { + // The response of a VmwareSite list operation. + VmwareSiteListResult +} + +// SitesControllerClientListBySubscriptionResponse contains the response from method SitesControllerClient.NewListBySubscriptionPager. +type SitesControllerClientListBySubscriptionResponse struct { + // The response of a VmwareSite list operation. + VmwareSiteListResult +} + +// SitesControllerClientListHealthSummaryResponse contains the response from method SitesControllerClient.ListHealthSummary. +type SitesControllerClientListHealthSummaryResponse struct { + // Collection of SiteHealthSummary. + SiteHealthSummaryCollection +} + +// SitesControllerClientSummaryResponse contains the response from method SitesControllerClient.Summary. +type SitesControllerClientSummaryResponse struct { + // VMware site usage. + VmwareSiteUsage +} + +// SitesControllerClientUpdateResponse contains the response from method SitesControllerClient.Update. +type SitesControllerClientUpdateResponse struct { + // A VmwareSite + VmwareSite +} + +// TomcatWebApplicationsControllerClientGetResponse contains the response from method TomcatWebApplicationsControllerClient.Get. +type TomcatWebApplicationsControllerClientGetResponse struct { + // Web application REST Resource. + TomcatWebApplications +} + +// TomcatWebApplicationsControllerClientListByWebAppSiteResponse contains the response from method TomcatWebApplicationsControllerClient.NewListByWebAppSitePager. +type TomcatWebApplicationsControllerClientListByWebAppSiteResponse struct { + // The response of a TomcatWebApplications list operation. + TomcatWebApplicationsListResult +} + +// TomcatWebApplicationsControllerClientUpdateResponse contains the response from method TomcatWebApplicationsControllerClient.Update. +type TomcatWebApplicationsControllerClientUpdateResponse struct { + // Web application REST Resource. + TomcatWebApplications +} + +// TomcatWebServersControllerClientGetResponse contains the response from method TomcatWebServersControllerClient.Get. +type TomcatWebServersControllerClientGetResponse struct { + // Web server REST Resource. + TomcatWebServers +} + +// TomcatWebServersControllerClientListByWebAppSiteResponse contains the response from method TomcatWebServersControllerClient.NewListByWebAppSitePager. +type TomcatWebServersControllerClientListByWebAppSiteResponse struct { + // The response of a TomcatWebServers list operation. + TomcatWebServersListResult +} + +// VcenterControllerClientCreateResponse contains the response from method VcenterControllerClient.BeginCreate. +type VcenterControllerClientCreateResponse struct { + // A vcenter resource belonging to a site resource. + Vcenter +} + +// VcenterControllerClientDeleteResponse contains the response from method VcenterControllerClient.Delete. +type VcenterControllerClientDeleteResponse struct { + // placeholder for future response values +} + +// VcenterControllerClientGetResponse contains the response from method VcenterControllerClient.Get. +type VcenterControllerClientGetResponse struct { + // A vcenter resource belonging to a site resource. + Vcenter +} + +// VcenterControllerClientListByVmwareSiteResponse contains the response from method VcenterControllerClient.NewListByVmwareSitePager. +type VcenterControllerClientListByVmwareSiteResponse struct { + // The response of a Vcenter list operation. + VcenterListResult +} + +// VmwareHostControllerClientGetResponse contains the response from method VmwareHostControllerClient.Get. +type VmwareHostControllerClientGetResponse struct { + // A host resource belonging to a site resource. + VmwareHost +} + +// VmwareHostControllerClientListByVmwareSiteResponse contains the response from method VmwareHostControllerClient.NewListByVmwareSitePager. +type VmwareHostControllerClientListByVmwareSiteResponse struct { + // The response of a VmwareHost list operation. + VmwareHostListResult +} + +// VmwareOperationsStatusClientGetVmwareOperationStatusResponse contains the response from method VmwareOperationsStatusClient.GetVmwareOperationStatus. +type VmwareOperationsStatusClientGetVmwareOperationStatusResponse struct { + // Operation status REST resource. + OperationStatus +} + +// VmwarePropertiesControllerClientUpdateDependencyMapStatusResponse contains the response from method VmwarePropertiesControllerClient.BeginUpdateDependencyMapStatus. +type VmwarePropertiesControllerClientUpdateDependencyMapStatusResponse struct { + // Anything + Interface any +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VmwarePropertiesControllerClientUpdateDependencyMapStatusResponse. +func (v *VmwarePropertiesControllerClientUpdateDependencyMapStatusResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &v.Interface) +} + +// VmwarePropertiesControllerClientUpdatePropertiesResponse contains the response from method VmwarePropertiesControllerClient.BeginUpdateProperties. +type VmwarePropertiesControllerClientUpdatePropertiesResponse struct { + // Anything + Interface any +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VmwarePropertiesControllerClientUpdatePropertiesResponse. +func (v *VmwarePropertiesControllerClientUpdatePropertiesResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &v.Interface) +} + +// VmwarePropertiesControllerClientUpdateRunAsAccountResponse contains the response from method VmwarePropertiesControllerClient.BeginUpdateRunAsAccount. +type VmwarePropertiesControllerClientUpdateRunAsAccountResponse struct { + // Anything + Interface any +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VmwarePropertiesControllerClientUpdateRunAsAccountResponse. +func (v *VmwarePropertiesControllerClientUpdateRunAsAccountResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &v.Interface) +} + +// VmwarePropertiesControllerClientUpdateTagsResponse contains the response from method VmwarePropertiesControllerClient.BeginUpdateTags. +type VmwarePropertiesControllerClientUpdateTagsResponse struct { + // Anything + Interface any +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VmwarePropertiesControllerClientUpdateTagsResponse. +func (v *VmwarePropertiesControllerClientUpdateTagsResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &v.Interface) +} + +// VmwareSoftwareInventoriesControllerClientGetMachineSoftwareInventoryResponse contains the response from method VmwareSoftwareInventoriesControllerClient.GetMachineSoftwareInventory. +type VmwareSoftwareInventoriesControllerClientGetMachineSoftwareInventoryResponse struct { + // An software inventory resource belonging to a machine resource. + VmwareMachineSoftwareInventory +} + +// VmwareSoftwareInventoriesControllerClientListByMachineResourceResponse contains the response from method VmwareSoftwareInventoriesControllerClient.NewListByMachineResourcePager. +type VmwareSoftwareInventoriesControllerClientListByMachineResourceResponse struct { + // The response of a VmwareMachineSoftwareInventory list operation. + VmwareMachineSoftwareInventoryListResult +} + +// WebAppDiscoverySiteDataSourcesControllerClientCreateResponse contains the response from method WebAppDiscoverySiteDataSourcesControllerClient.BeginCreate. +type WebAppDiscoverySiteDataSourcesControllerClientCreateResponse struct { + // Web app data source web model. + DiscoverySiteDataSource +} + +// WebAppDiscoverySiteDataSourcesControllerClientDeleteResponse contains the response from method WebAppDiscoverySiteDataSourcesControllerClient.BeginDelete. +type WebAppDiscoverySiteDataSourcesControllerClientDeleteResponse struct { + // placeholder for future response values +} + +// WebAppDiscoverySiteDataSourcesControllerClientGetResponse contains the response from method WebAppDiscoverySiteDataSourcesControllerClient.Get. +type WebAppDiscoverySiteDataSourcesControllerClientGetResponse struct { + // Web app data source web model. + DiscoverySiteDataSource +} + +// WebAppDiscoverySiteDataSourcesControllerClientListByWebAppSiteResponse contains the response from method WebAppDiscoverySiteDataSourcesControllerClient.NewListByWebAppSitePager. +type WebAppDiscoverySiteDataSourcesControllerClientListByWebAppSiteResponse struct { + // The response of a DiscoverySiteDataSource list operation. + DiscoverySiteDataSourceListResult +} + +// WebAppExtendedMachinesControllerClientGetResponse contains the response from method WebAppExtendedMachinesControllerClient.Get. +type WebAppExtendedMachinesControllerClientGetResponse struct { + // Web app extended machine REST Resource. + WebAppExtendedMachine +} + +// WebAppExtendedMachinesControllerClientListByWebAppSiteResponse contains the response from method WebAppExtendedMachinesControllerClient.NewListByWebAppSitePager. +type WebAppExtendedMachinesControllerClientListByWebAppSiteResponse struct { + // The response of a WebAppExtendedMachine list operation. + WebAppExtendedMachineListResult +} + +// WebAppPropertiesControllerClientUpdatePropertiesResponse contains the response from method WebAppPropertiesControllerClient.BeginUpdateProperties. +type WebAppPropertiesControllerClientUpdatePropertiesResponse struct { + // Anything + Interface any +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebAppPropertiesControllerClientUpdatePropertiesResponse. +func (w *WebAppPropertiesControllerClientUpdatePropertiesResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &w.Interface) +} + +// WebAppRunAsAccountsControllerClientGetResponse contains the response from method WebAppRunAsAccountsControllerClient.Get. +type WebAppRunAsAccountsControllerClientGetResponse struct { + // Run as account REST Resource. + WebAppRunAsAccount +} + +// WebAppRunAsAccountsControllerClientListByWebAppSiteResponse contains the response from method WebAppRunAsAccountsControllerClient.NewListByWebAppSitePager. +type WebAppRunAsAccountsControllerClientListByWebAppSiteResponse struct { + // The response of a WebAppRunAsAccount list operation. + WebAppRunAsAccountListResult +} + +// WebAppSitesControllerClientCreateResponse contains the response from method WebAppSitesControllerClient.Create. +type WebAppSitesControllerClientCreateResponse struct { + // WebApp site web model. + WebAppSite + + // RetryAfter contains the information returned from the Retry-After header response. + RetryAfter *int32 +} + +// WebAppSitesControllerClientDeleteResponse contains the response from method WebAppSitesControllerClient.BeginDelete. +type WebAppSitesControllerClientDeleteResponse struct { + // placeholder for future response values +} + +// WebAppSitesControllerClientErrorSummaryResponse contains the response from method WebAppSitesControllerClient.ErrorSummary. +type WebAppSitesControllerClientErrorSummaryResponse struct { + // Site error summary. + SiteErrorSummary +} + +// WebAppSitesControllerClientExportInventoryResponse contains the response from method WebAppSitesControllerClient.BeginExportInventory. +type WebAppSitesControllerClientExportInventoryResponse struct { + // Anything + Interface any +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebAppSitesControllerClientExportInventoryResponse. +func (w *WebAppSitesControllerClientExportInventoryResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &w.Interface) +} + +// WebAppSitesControllerClientGetResponse contains the response from method WebAppSitesControllerClient.Get. +type WebAppSitesControllerClientGetResponse struct { + // WebApp site web model. + WebAppSite +} + +// WebAppSitesControllerClientListByMasterSiteResponse contains the response from method WebAppSitesControllerClient.NewListByMasterSitePager. +type WebAppSitesControllerClientListByMasterSiteResponse struct { + // The response of a WebAppSite list operation. + WebAppSiteListResult +} + +// WebAppSitesControllerClientRefreshResponse contains the response from method WebAppSitesControllerClient.BeginRefresh. +type WebAppSitesControllerClientRefreshResponse struct { + // Anything + Interface any +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebAppSitesControllerClientRefreshResponse. +func (w *WebAppSitesControllerClientRefreshResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &w.Interface) +} + +// WebAppSitesControllerClientSummaryResponse contains the response from method WebAppSitesControllerClient.Summary. +type WebAppSitesControllerClientSummaryResponse struct { + // Web app site usage. + WebAppSiteUsage +} + +// WebAppSitesControllerClientUpdateResponse contains the response from method WebAppSitesControllerClient.BeginUpdate. +type WebAppSitesControllerClientUpdateResponse struct { + // WebApp site web model. + WebAppSite +} + +// WebApplicationsControllerClientListByWebAppSiteResponse contains the response from method WebApplicationsControllerClient.NewListByWebAppSitePager. +type WebApplicationsControllerClientListByWebAppSiteResponse struct { + // The response of a WebApplication list operation. + WebApplicationListResult +} - // XMSRequestID contains the information returned from the x-ms-request-id header response. - XMSRequestID *string +// WebServersControllerClientListByWebAppSiteResponse contains the response from method WebServersControllerClient.NewListByWebAppSitePager. +type WebServersControllerClientListByWebAppSiteResponse struct { + // The response of a WebServer list operation. + WebServerListResult } diff --git a/sdk/resourcemanager/migrate/armmigrate/runasaccountscontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/runasaccountscontroller_client.go new file mode 100644 index 000000000000..c824a488c88c --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/runasaccountscontroller_client.go @@ -0,0 +1,179 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// RunAsAccountsControllerClient contains the methods for the RunAsAccountsController group. +// Don't use this type directly, use NewRunAsAccountsControllerClient() instead. +type RunAsAccountsControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewRunAsAccountsControllerClient creates a new instance of RunAsAccountsControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewRunAsAccountsControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RunAsAccountsControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &RunAsAccountsControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get a VmwareRunAsAccountResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - accountName - RunAsAccounts name +// - options - RunAsAccountsControllerClientGetOptions contains the optional parameters for the RunAsAccountsControllerClient.Get +// method. +func (client *RunAsAccountsControllerClient) Get(ctx context.Context, resourceGroupName string, siteName string, accountName string, options *RunAsAccountsControllerClientGetOptions) (RunAsAccountsControllerClientGetResponse, error) { + var err error + const operationName = "RunAsAccountsControllerClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, siteName, accountName, options) + if err != nil { + return RunAsAccountsControllerClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RunAsAccountsControllerClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RunAsAccountsControllerClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *RunAsAccountsControllerClient) getCreateRequest(ctx context.Context, resourceGroupName string, siteName string, accountName string, options *RunAsAccountsControllerClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/vmwareSites/{siteName}/runAsAccounts/{accountName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *RunAsAccountsControllerClient) getHandleResponse(resp *http.Response) (RunAsAccountsControllerClientGetResponse, error) { + result := RunAsAccountsControllerClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VmwareRunAsAccountResource); err != nil { + return RunAsAccountsControllerClientGetResponse{}, err + } + return result, nil +} + +// NewListByVmwareSitePager - List VmwareRunAsAccountResource resources by VmwareSite +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - options - RunAsAccountsControllerClientListByVmwareSiteOptions contains the optional parameters for the RunAsAccountsControllerClient.NewListByVmwareSitePager +// method. +func (client *RunAsAccountsControllerClient) NewListByVmwareSitePager(resourceGroupName string, siteName string, options *RunAsAccountsControllerClientListByVmwareSiteOptions) *runtime.Pager[RunAsAccountsControllerClientListByVmwareSiteResponse] { + return runtime.NewPager(runtime.PagingHandler[RunAsAccountsControllerClientListByVmwareSiteResponse]{ + More: func(page RunAsAccountsControllerClientListByVmwareSiteResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *RunAsAccountsControllerClientListByVmwareSiteResponse) (RunAsAccountsControllerClientListByVmwareSiteResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RunAsAccountsControllerClient.NewListByVmwareSitePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByVmwareSiteCreateRequest(ctx, resourceGroupName, siteName, options) + }, nil) + if err != nil { + return RunAsAccountsControllerClientListByVmwareSiteResponse{}, err + } + return client.listByVmwareSiteHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByVmwareSiteCreateRequest creates the ListByVmwareSite request. +func (client *RunAsAccountsControllerClient) listByVmwareSiteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *RunAsAccountsControllerClientListByVmwareSiteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/vmwareSites/{siteName}/runAsAccounts" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByVmwareSiteHandleResponse handles the ListByVmwareSite response. +func (client *RunAsAccountsControllerClient) listByVmwareSiteHandleResponse(resp *http.Response) (RunAsAccountsControllerClientListByVmwareSiteResponse, error) { + result := RunAsAccountsControllerClientListByVmwareSiteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VmwareRunAsAccountResourceListResult); err != nil { + return RunAsAccountsControllerClientListByVmwareSiteResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/servercollectors_client.go b/sdk/resourcemanager/migrate/armmigrate/servercollectors_client.go deleted file mode 100644 index b10d4151f5b0..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/servercollectors_client.go +++ /dev/null @@ -1,332 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmigrate - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// ServerCollectorsClient contains the methods for the ServerCollectors group. -// Don't use this type directly, use NewServerCollectorsClient() instead. -type ServerCollectorsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewServerCollectorsClient creates a new instance of ServerCollectorsClient with the specified values. -// - subscriptionID - Azure Subscription Id in which project was created. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewServerCollectorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ServerCollectorsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ServerCollectorsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Create - Create or Update Server collector -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - serverCollectorName - Unique name of a Server collector within a project. -// - options - ServerCollectorsClientCreateOptions contains the optional parameters for the ServerCollectorsClient.Create method. -func (client *ServerCollectorsClient) Create(ctx context.Context, resourceGroupName string, projectName string, serverCollectorName string, options *ServerCollectorsClientCreateOptions) (ServerCollectorsClientCreateResponse, error) { - var err error - const operationName = "ServerCollectorsClient.Create" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createCreateRequest(ctx, resourceGroupName, projectName, serverCollectorName, options) - if err != nil { - return ServerCollectorsClientCreateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ServerCollectorsClientCreateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return ServerCollectorsClientCreateResponse{}, err - } - resp, err := client.createHandleResponse(httpResp) - return resp, err -} - -// createCreateRequest creates the Create request. -func (client *ServerCollectorsClient) createCreateRequest(ctx context.Context, resourceGroupName string, projectName string, serverCollectorName string, options *ServerCollectorsClientCreateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/servercollectors/{serverCollectorName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if serverCollectorName == "" { - return nil, errors.New("parameter serverCollectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{serverCollectorName}", url.PathEscape(serverCollectorName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.CollectorBody != nil { - if err := runtime.MarshalAsJSON(req, *options.CollectorBody); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// createHandleResponse handles the Create response. -func (client *ServerCollectorsClient) createHandleResponse(resp *http.Response) (ServerCollectorsClientCreateResponse, error) { - result := ServerCollectorsClientCreateResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.ServerCollector); err != nil { - return ServerCollectorsClientCreateResponse{}, err - } - return result, nil -} - -// Delete - Delete a Server collector from the project. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - serverCollectorName - Unique name of a Server collector within a project. -// - options - ServerCollectorsClientDeleteOptions contains the optional parameters for the ServerCollectorsClient.Delete method. -func (client *ServerCollectorsClient) Delete(ctx context.Context, resourceGroupName string, projectName string, serverCollectorName string, options *ServerCollectorsClientDeleteOptions) (ServerCollectorsClientDeleteResponse, error) { - var err error - const operationName = "ServerCollectorsClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, projectName, serverCollectorName, options) - if err != nil { - return ServerCollectorsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ServerCollectorsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return ServerCollectorsClientDeleteResponse{}, err - } - resp, err := client.deleteHandleResponse(httpResp) - return resp, err -} - -// deleteCreateRequest creates the Delete request. -func (client *ServerCollectorsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, projectName string, serverCollectorName string, options *ServerCollectorsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/servercollectors/{serverCollectorName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if serverCollectorName == "" { - return nil, errors.New("parameter serverCollectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{serverCollectorName}", url.PathEscape(serverCollectorName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// deleteHandleResponse handles the Delete response. -func (client *ServerCollectorsClient) deleteHandleResponse(resp *http.Response) (ServerCollectorsClientDeleteResponse, error) { - result := ServerCollectorsClientDeleteResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - return result, nil -} - -// Get - Get a Server collector. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - serverCollectorName - Unique name of a Server collector within a project. -// - options - ServerCollectorsClientGetOptions contains the optional parameters for the ServerCollectorsClient.Get method. -func (client *ServerCollectorsClient) Get(ctx context.Context, resourceGroupName string, projectName string, serverCollectorName string, options *ServerCollectorsClientGetOptions) (ServerCollectorsClientGetResponse, error) { - var err error - const operationName = "ServerCollectorsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, serverCollectorName, options) - if err != nil { - return ServerCollectorsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ServerCollectorsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ServerCollectorsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ServerCollectorsClient) getCreateRequest(ctx context.Context, resourceGroupName string, projectName string, serverCollectorName string, options *ServerCollectorsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/servercollectors/{serverCollectorName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if serverCollectorName == "" { - return nil, errors.New("parameter serverCollectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{serverCollectorName}", url.PathEscape(serverCollectorName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ServerCollectorsClient) getHandleResponse(resp *http.Response) (ServerCollectorsClientGetResponse, error) { - result := ServerCollectorsClientGetResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.ServerCollector); err != nil { - return ServerCollectorsClientGetResponse{}, err - } - return result, nil -} - -// NewListByProjectPager - Get a list of Server collector. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - options - ServerCollectorsClientListByProjectOptions contains the optional parameters for the ServerCollectorsClient.NewListByProjectPager -// method. -func (client *ServerCollectorsClient) NewListByProjectPager(resourceGroupName string, projectName string, options *ServerCollectorsClientListByProjectOptions) *runtime.Pager[ServerCollectorsClientListByProjectResponse] { - return runtime.NewPager(runtime.PagingHandler[ServerCollectorsClientListByProjectResponse]{ - More: func(page ServerCollectorsClientListByProjectResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *ServerCollectorsClientListByProjectResponse) (ServerCollectorsClientListByProjectResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ServerCollectorsClient.NewListByProjectPager") - req, err := client.listByProjectCreateRequest(ctx, resourceGroupName, projectName, options) - if err != nil { - return ServerCollectorsClientListByProjectResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ServerCollectorsClientListByProjectResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServerCollectorsClientListByProjectResponse{}, runtime.NewResponseError(resp) - } - return client.listByProjectHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByProjectCreateRequest creates the ListByProject request. -func (client *ServerCollectorsClient) listByProjectCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *ServerCollectorsClientListByProjectOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/servercollectors" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByProjectHandleResponse handles the ListByProject response. -func (client *ServerCollectorsClient) listByProjectHandleResponse(resp *http.Response) (ServerCollectorsClientListByProjectResponse, error) { - result := ServerCollectorsClientListByProjectResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.ServerCollectorList); err != nil { - return ServerCollectorsClientListByProjectResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/servercollectors_client_example_test.go b/sdk/resourcemanager/migrate/armmigrate/servercollectors_client_example_test.go deleted file mode 100644 index d6939731cb21..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/servercollectors_client_example_test.go +++ /dev/null @@ -1,188 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmigrate_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/ServerCollectors_ListByProject.json -func ExampleServerCollectorsClient_NewListByProjectPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServerCollectorsClient().NewListByProjectPager("pajindtest", "app11141project", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ServerCollectorList = armmigrate.ServerCollectorList{ - // Value: []*armmigrate.ServerCollector{ - // { - // Name: to.Ptr("app23df4collector"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/servercollectors"), - // ETag: to.Ptr("\"00000606-0000-0d00-0000-605999bf0000\""), - // ID: to.Ptr("/subscriptions/4bd2aa0f-2bd2-4d67-91a8-5a4533d58600/resourceGroups/pajindtest/providers/Microsoft.Migrate/assessmentprojects/app11141project/servercollectors/app23df4collector"), - // Properties: &armmigrate.CollectorProperties{ - // AgentProperties: &armmigrate.CollectorAgentProperties{ - // ID: to.Ptr("dc984f5a-58a3-4f84-818c-a19febefa66a"), - // LastHeartbeatUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-17T03:51:30.206Z"); return t}()), - // SpnDetails: &armmigrate.CollectorBodyAgentSpnProperties{ - // ApplicationID: to.Ptr("ad9f701a-cc08-4421-b51f-b5762d58e9ba"), - // Audience: to.Ptr("https://72f988bf-86f1-41af-91ab-2d7cd011db47/app23df4authandaccessaadapp"), - // Authority: to.Ptr("https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47"), - // ObjectID: to.Ptr("b4975e42-9248-4a36-b99f-37eca377ea00"), - // TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), - // }, - // Version: to.Ptr("1.0.8.393"), - // }, - // CreatedTimestamp: to.Ptr("2020-09-11T07:15:52.4361521Z"), - // DiscoverySiteID: to.Ptr("/subscriptions/4bd2aa0f-2bd2-4d67-91a8-5a4533d58600/resourceGroups/pajindTest/providers/Microsoft.OffAzure/ServerSites/app21141site"), - // UpdatedTimestamp: to.Ptr("2021-03-23T07:33:19.697297Z"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/ServerCollectors_Get.json -func ExampleServerCollectorsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerCollectorsClient().Get(ctx, "pajindtest", "app11141project", "app23df4collector", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerCollector = armmigrate.ServerCollector{ - // Name: to.Ptr("app23df4collector"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/servercollectors"), - // ETag: to.Ptr("\"00000606-0000-0d00-0000-605999bf0000\""), - // ID: to.Ptr("/subscriptions/4bd2aa0f-2bd2-4d67-91a8-5a4533d58600/resourceGroups/pajindtest/providers/Microsoft.Migrate/assessmentprojects/app11141project/servercollectors/app23df4collector"), - // Properties: &armmigrate.CollectorProperties{ - // AgentProperties: &armmigrate.CollectorAgentProperties{ - // ID: to.Ptr("dc984f5a-58a3-4f84-818c-a19febefa66a"), - // LastHeartbeatUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-17T03:51:30.206Z"); return t}()), - // SpnDetails: &armmigrate.CollectorBodyAgentSpnProperties{ - // ApplicationID: to.Ptr("ad9f701a-cc08-4421-b51f-b5762d58e9ba"), - // Audience: to.Ptr("https://72f988bf-86f1-41af-91ab-2d7cd011db47/app23df4authandaccessaadapp"), - // Authority: to.Ptr("https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47"), - // ObjectID: to.Ptr("b4975e42-9248-4a36-b99f-37eca377ea00"), - // TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), - // }, - // Version: to.Ptr("1.0.8.393"), - // }, - // CreatedTimestamp: to.Ptr("2020-09-11T07:15:52.4361521Z"), - // DiscoverySiteID: to.Ptr("/subscriptions/4bd2aa0f-2bd2-4d67-91a8-5a4533d58600/resourceGroups/pajindTest/providers/Microsoft.OffAzure/ServerSites/app21141site"), - // UpdatedTimestamp: to.Ptr("2021-03-23T07:33:19.697297Z"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/ServerCollectors_Create.json -func ExampleServerCollectorsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerCollectorsClient().Create(ctx, "pajindtest", "app11141project", "app23df4collector", &armmigrate.ServerCollectorsClientCreateOptions{CollectorBody: &armmigrate.ServerCollector{ - ETag: to.Ptr("\"00000606-0000-0d00-0000-605999bf0000\""), - Properties: &armmigrate.CollectorProperties{ - AgentProperties: &armmigrate.CollectorAgentProperties{ - SpnDetails: &armmigrate.CollectorBodyAgentSpnProperties{ - ApplicationID: to.Ptr("ad9f701a-cc08-4421-b51f-b5762d58e9ba"), - Audience: to.Ptr("https://72f988bf-86f1-41af-91ab-2d7cd011db47/app23df4authandaccessaadapp"), - Authority: to.Ptr("https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47"), - ObjectID: to.Ptr("b4975e42-9248-4a36-b99f-37eca377ea00"), - TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), - }, - }, - DiscoverySiteID: to.Ptr("/subscriptions/4bd2aa0f-2bd2-4d67-91a8-5a4533d58600/resourceGroups/pajindTest/providers/Microsoft.OffAzure/ServerSites/app21141site"), - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerCollector = armmigrate.ServerCollector{ - // Name: to.Ptr("app23df4collector"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/servercollectors"), - // ETag: to.Ptr("\"00000606-0000-0d00-0000-605999bf0000\""), - // ID: to.Ptr("/subscriptions/4bd2aa0f-2bd2-4d67-91a8-5a4533d58600/resourceGroups/pajindtest/providers/Microsoft.Migrate/assessmentprojects/app11141project/servercollectors/app23df4collector"), - // Properties: &armmigrate.CollectorProperties{ - // AgentProperties: &armmigrate.CollectorAgentProperties{ - // ID: to.Ptr("dc984f5a-58a3-4f84-818c-a19febefa66a"), - // LastHeartbeatUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-17T03:51:30.206Z"); return t}()), - // SpnDetails: &armmigrate.CollectorBodyAgentSpnProperties{ - // ApplicationID: to.Ptr("ad9f701a-cc08-4421-b51f-b5762d58e9ba"), - // Audience: to.Ptr("https://72f988bf-86f1-41af-91ab-2d7cd011db47/app23df4authandaccessaadapp"), - // Authority: to.Ptr("https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47"), - // ObjectID: to.Ptr("b4975e42-9248-4a36-b99f-37eca377ea00"), - // TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), - // }, - // Version: to.Ptr("1.0.8.393"), - // }, - // CreatedTimestamp: to.Ptr("2020-09-11T07:15:52.4361521Z"), - // DiscoverySiteID: to.Ptr("/subscriptions/4bd2aa0f-2bd2-4d67-91a8-5a4533d58600/resourceGroups/pajindTest/providers/Microsoft.OffAzure/ServerSites/app21141site"), - // UpdatedTimestamp: to.Ptr("2021-03-23T07:33:19.697297Z"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/ServerCollectors_Delete.json -func ExampleServerCollectorsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewServerCollectorsClient().Delete(ctx, "pajindtest", "app11141project", "app23df4collector", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/migrate/armmigrate/serverdependencymapcontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/serverdependencymapcontroller_client.go new file mode 100644 index 000000000000..757f50af9cbd --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/serverdependencymapcontroller_client.go @@ -0,0 +1,449 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ServerDependencyMapControllerClient contains the methods for the ServerDependencyMapController group. +// Don't use this type directly, use NewServerDependencyMapControllerClient() instead. +type ServerDependencyMapControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewServerDependencyMapControllerClient creates a new instance of ServerDependencyMapControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewServerDependencyMapControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ServerDependencyMapControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ServerDependencyMapControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginClientGroupMembers - API to list client group members for the selected client group. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - mapRequest - The content of the action request +// - options - ServerDependencyMapControllerClientBeginClientGroupMembersOptions contains the optional parameters for the ServerDependencyMapControllerClient.BeginClientGroupMembers +// method. +func (client *ServerDependencyMapControllerClient) BeginClientGroupMembers(ctx context.Context, resourceGroupName string, siteName string, mapRequest DependencyMapServiceMapextensionsClientGroupMembersRequest, options *ServerDependencyMapControllerClientBeginClientGroupMembersOptions) (*runtime.Poller[ServerDependencyMapControllerClientClientGroupMembersResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.clientGroupMembers(ctx, resourceGroupName, siteName, mapRequest, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ServerDependencyMapControllerClientClientGroupMembersResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ServerDependencyMapControllerClientClientGroupMembersResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ClientGroupMembers - API to list client group members for the selected client group. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *ServerDependencyMapControllerClient) clientGroupMembers(ctx context.Context, resourceGroupName string, siteName string, mapRequest DependencyMapServiceMapextensionsClientGroupMembersRequest, options *ServerDependencyMapControllerClientBeginClientGroupMembersOptions) (*http.Response, error) { + var err error + const operationName = "ServerDependencyMapControllerClient.BeginClientGroupMembers" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.clientGroupMembersCreateRequest(ctx, resourceGroupName, siteName, mapRequest, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// clientGroupMembersCreateRequest creates the ClientGroupMembers request. +func (client *ServerDependencyMapControllerClient) clientGroupMembersCreateRequest(ctx context.Context, resourceGroupName string, siteName string, mapRequest DependencyMapServiceMapextensionsClientGroupMembersRequest, options *ServerDependencyMapControllerClientBeginClientGroupMembersOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/serverSites/{siteName}/clientGroupMembers" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, mapRequest); err != nil { + return nil, err + } + return req, nil +} + +// BeginExportDependencies - API to generate report containing agentless dependencies. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - requestBody - The content of the action request +// - options - ServerDependencyMapControllerClientBeginExportDependenciesOptions contains the optional parameters for the ServerDependencyMapControllerClient.BeginExportDependencies +// method. +func (client *ServerDependencyMapControllerClient) BeginExportDependencies(ctx context.Context, resourceGroupName string, siteName string, requestBody DependencyMapServiceMapextensionsExportDependenciesRequest, options *ServerDependencyMapControllerClientBeginExportDependenciesOptions) (*runtime.Poller[ServerDependencyMapControllerClientExportDependenciesResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.exportDependencies(ctx, resourceGroupName, siteName, requestBody, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ServerDependencyMapControllerClientExportDependenciesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ServerDependencyMapControllerClientExportDependenciesResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ExportDependencies - API to generate report containing agentless dependencies. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *ServerDependencyMapControllerClient) exportDependencies(ctx context.Context, resourceGroupName string, siteName string, requestBody DependencyMapServiceMapextensionsExportDependenciesRequest, options *ServerDependencyMapControllerClientBeginExportDependenciesOptions) (*http.Response, error) { + var err error + const operationName = "ServerDependencyMapControllerClient.BeginExportDependencies" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.exportDependenciesCreateRequest(ctx, resourceGroupName, siteName, requestBody, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// exportDependenciesCreateRequest creates the ExportDependencies request. +func (client *ServerDependencyMapControllerClient) exportDependenciesCreateRequest(ctx context.Context, resourceGroupName string, siteName string, requestBody DependencyMapServiceMapextensionsExportDependenciesRequest, options *ServerDependencyMapControllerClientBeginExportDependenciesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/serverSites/{siteName}/exportDependencies" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, requestBody); err != nil { + return nil, err + } + return req, nil +} + +// BeginGenerateCoarseMap - API to generate coarse map for the list of machines. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - mapRequest - The content of the action request +// - options - ServerDependencyMapControllerClientBeginGenerateCoarseMapOptions contains the optional parameters for the ServerDependencyMapControllerClient.BeginGenerateCoarseMap +// method. +func (client *ServerDependencyMapControllerClient) BeginGenerateCoarseMap(ctx context.Context, resourceGroupName string, siteName string, mapRequest DependencyMapServiceMapextensionsScopeMapRequest, options *ServerDependencyMapControllerClientBeginGenerateCoarseMapOptions) (*runtime.Poller[ServerDependencyMapControllerClientGenerateCoarseMapResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.generateCoarseMap(ctx, resourceGroupName, siteName, mapRequest, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ServerDependencyMapControllerClientGenerateCoarseMapResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ServerDependencyMapControllerClientGenerateCoarseMapResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// GenerateCoarseMap - API to generate coarse map for the list of machines. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *ServerDependencyMapControllerClient) generateCoarseMap(ctx context.Context, resourceGroupName string, siteName string, mapRequest DependencyMapServiceMapextensionsScopeMapRequest, options *ServerDependencyMapControllerClientBeginGenerateCoarseMapOptions) (*http.Response, error) { + var err error + const operationName = "ServerDependencyMapControllerClient.BeginGenerateCoarseMap" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.generateCoarseMapCreateRequest(ctx, resourceGroupName, siteName, mapRequest, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// generateCoarseMapCreateRequest creates the GenerateCoarseMap request. +func (client *ServerDependencyMapControllerClient) generateCoarseMapCreateRequest(ctx context.Context, resourceGroupName string, siteName string, mapRequest DependencyMapServiceMapextensionsScopeMapRequest, options *ServerDependencyMapControllerClientBeginGenerateCoarseMapOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/serverSites/{siteName}/generateCoarseMap" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, mapRequest); err != nil { + return nil, err + } + return req, nil +} + +// BeginGenerateDetailedMap - API to generate detailed map for a selected machine. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - mapRequest - The content of the action request +// - options - ServerDependencyMapControllerClientBeginGenerateDetailedMapOptions contains the optional parameters for the ServerDependencyMapControllerClient.BeginGenerateDetailedMap +// method. +func (client *ServerDependencyMapControllerClient) BeginGenerateDetailedMap(ctx context.Context, resourceGroupName string, siteName string, mapRequest DependencyMapServiceMapextensionsSingleMachineDetailedMapRequest, options *ServerDependencyMapControllerClientBeginGenerateDetailedMapOptions) (*runtime.Poller[ServerDependencyMapControllerClientGenerateDetailedMapResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.generateDetailedMap(ctx, resourceGroupName, siteName, mapRequest, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ServerDependencyMapControllerClientGenerateDetailedMapResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ServerDependencyMapControllerClientGenerateDetailedMapResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// GenerateDetailedMap - API to generate detailed map for a selected machine. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *ServerDependencyMapControllerClient) generateDetailedMap(ctx context.Context, resourceGroupName string, siteName string, mapRequest DependencyMapServiceMapextensionsSingleMachineDetailedMapRequest, options *ServerDependencyMapControllerClientBeginGenerateDetailedMapOptions) (*http.Response, error) { + var err error + const operationName = "ServerDependencyMapControllerClient.BeginGenerateDetailedMap" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.generateDetailedMapCreateRequest(ctx, resourceGroupName, siteName, mapRequest, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// generateDetailedMapCreateRequest creates the GenerateDetailedMap request. +func (client *ServerDependencyMapControllerClient) generateDetailedMapCreateRequest(ctx context.Context, resourceGroupName string, siteName string, mapRequest DependencyMapServiceMapextensionsSingleMachineDetailedMapRequest, options *ServerDependencyMapControllerClientBeginGenerateDetailedMapOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/serverSites/{siteName}/generateDetailedMap" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, mapRequest); err != nil { + return nil, err + } + return req, nil +} + +// BeginServerGroupMembers - API to list server group members for the selected server group. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - mapRequest - The content of the action request +// - options - ServerDependencyMapControllerClientBeginServerGroupMembersOptions contains the optional parameters for the ServerDependencyMapControllerClient.BeginServerGroupMembers +// method. +func (client *ServerDependencyMapControllerClient) BeginServerGroupMembers(ctx context.Context, resourceGroupName string, siteName string, mapRequest DependencyMapServiceMapextensionsServerGroupMembersRequest, options *ServerDependencyMapControllerClientBeginServerGroupMembersOptions) (*runtime.Poller[ServerDependencyMapControllerClientServerGroupMembersResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.serverGroupMembers(ctx, resourceGroupName, siteName, mapRequest, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ServerDependencyMapControllerClientServerGroupMembersResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ServerDependencyMapControllerClientServerGroupMembersResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ServerGroupMembers - API to list server group members for the selected server group. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *ServerDependencyMapControllerClient) serverGroupMembers(ctx context.Context, resourceGroupName string, siteName string, mapRequest DependencyMapServiceMapextensionsServerGroupMembersRequest, options *ServerDependencyMapControllerClientBeginServerGroupMembersOptions) (*http.Response, error) { + var err error + const operationName = "ServerDependencyMapControllerClient.BeginServerGroupMembers" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.serverGroupMembersCreateRequest(ctx, resourceGroupName, siteName, mapRequest, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// serverGroupMembersCreateRequest creates the ServerGroupMembers request. +func (client *ServerDependencyMapControllerClient) serverGroupMembersCreateRequest(ctx context.Context, resourceGroupName string, siteName string, mapRequest DependencyMapServiceMapextensionsServerGroupMembersRequest, options *ServerDependencyMapControllerClientBeginServerGroupMembersOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/serverSites/{siteName}/serverGroupMembers" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, mapRequest); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/serverjobscontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/serverjobscontroller_client.go new file mode 100644 index 000000000000..34c120b526a4 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/serverjobscontroller_client.go @@ -0,0 +1,179 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ServerJobsControllerClient contains the methods for the ServerJobsController group. +// Don't use this type directly, use NewServerJobsControllerClient() instead. +type ServerJobsControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewServerJobsControllerClient creates a new instance of ServerJobsControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewServerJobsControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ServerJobsControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ServerJobsControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get a ServerJob +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - jobName - Jobs name +// - options - ServerJobsControllerClientGetOptions contains the optional parameters for the ServerJobsControllerClient.Get +// method. +func (client *ServerJobsControllerClient) Get(ctx context.Context, resourceGroupName string, siteName string, jobName string, options *ServerJobsControllerClientGetOptions) (ServerJobsControllerClientGetResponse, error) { + var err error + const operationName = "ServerJobsControllerClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, siteName, jobName, options) + if err != nil { + return ServerJobsControllerClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ServerJobsControllerClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServerJobsControllerClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ServerJobsControllerClient) getCreateRequest(ctx context.Context, resourceGroupName string, siteName string, jobName string, options *ServerJobsControllerClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/serverSites/{siteName}/jobs/{jobName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ServerJobsControllerClient) getHandleResponse(resp *http.Response) (ServerJobsControllerClientGetResponse, error) { + result := ServerJobsControllerClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ServerJob); err != nil { + return ServerJobsControllerClientGetResponse{}, err + } + return result, nil +} + +// NewListByServerSiteResourcePager - List ServerJob resources by ServerSiteResource +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - options - ServerJobsControllerClientListByServerSiteResourceOptions contains the optional parameters for the ServerJobsControllerClient.NewListByServerSiteResourcePager +// method. +func (client *ServerJobsControllerClient) NewListByServerSiteResourcePager(resourceGroupName string, siteName string, options *ServerJobsControllerClientListByServerSiteResourceOptions) *runtime.Pager[ServerJobsControllerClientListByServerSiteResourceResponse] { + return runtime.NewPager(runtime.PagingHandler[ServerJobsControllerClientListByServerSiteResourceResponse]{ + More: func(page ServerJobsControllerClientListByServerSiteResourceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ServerJobsControllerClientListByServerSiteResourceResponse) (ServerJobsControllerClientListByServerSiteResourceResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ServerJobsControllerClient.NewListByServerSiteResourcePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByServerSiteResourceCreateRequest(ctx, resourceGroupName, siteName, options) + }, nil) + if err != nil { + return ServerJobsControllerClientListByServerSiteResourceResponse{}, err + } + return client.listByServerSiteResourceHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByServerSiteResourceCreateRequest creates the ListByServerSiteResource request. +func (client *ServerJobsControllerClient) listByServerSiteResourceCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *ServerJobsControllerClientListByServerSiteResourceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/serverSites/{siteName}/jobs" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByServerSiteResourceHandleResponse handles the ListByServerSiteResource response. +func (client *ServerJobsControllerClient) listByServerSiteResourceHandleResponse(resp *http.Response) (ServerJobsControllerClientListByServerSiteResourceResponse, error) { + result := ServerJobsControllerClientListByServerSiteResourceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ServerJobListResult); err != nil { + return ServerJobsControllerClientListByServerSiteResourceResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/serveroperationsstatuscontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/serveroperationsstatuscontroller_client.go new file mode 100644 index 000000000000..4625ea25e0a8 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/serveroperationsstatuscontroller_client.go @@ -0,0 +1,114 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ServerOperationsStatusControllerClient contains the methods for the ServerOperationsStatusController group. +// Don't use this type directly, use NewServerOperationsStatusControllerClient() instead. +type ServerOperationsStatusControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewServerOperationsStatusControllerClient creates a new instance of ServerOperationsStatusControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewServerOperationsStatusControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ServerOperationsStatusControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ServerOperationsStatusControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// GetServerSiteOperationsStatus - A operation status resource belonging to a site resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - operationStatusName - Operation status Arm Name. +// - options - ServerOperationsStatusControllerClientGetServerSiteOperationsStatusOptions contains the optional parameters for +// the ServerOperationsStatusControllerClient.GetServerSiteOperationsStatus method. +func (client *ServerOperationsStatusControllerClient) GetServerSiteOperationsStatus(ctx context.Context, resourceGroupName string, siteName string, operationStatusName string, options *ServerOperationsStatusControllerClientGetServerSiteOperationsStatusOptions) (ServerOperationsStatusControllerClientGetServerSiteOperationsStatusResponse, error) { + var err error + const operationName = "ServerOperationsStatusControllerClient.GetServerSiteOperationsStatus" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getServerSiteOperationsStatusCreateRequest(ctx, resourceGroupName, siteName, operationStatusName, options) + if err != nil { + return ServerOperationsStatusControllerClientGetServerSiteOperationsStatusResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ServerOperationsStatusControllerClientGetServerSiteOperationsStatusResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServerOperationsStatusControllerClientGetServerSiteOperationsStatusResponse{}, err + } + resp, err := client.getServerSiteOperationsStatusHandleResponse(httpResp) + return resp, err +} + +// getServerSiteOperationsStatusCreateRequest creates the GetServerSiteOperationsStatus request. +func (client *ServerOperationsStatusControllerClient) getServerSiteOperationsStatusCreateRequest(ctx context.Context, resourceGroupName string, siteName string, operationStatusName string, options *ServerOperationsStatusControllerClientGetServerSiteOperationsStatusOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/serverSites/{siteName}/operationsStatus/{operationStatusName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if operationStatusName == "" { + return nil, errors.New("parameter operationStatusName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{operationStatusName}", url.PathEscape(operationStatusName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getServerSiteOperationsStatusHandleResponse handles the GetServerSiteOperationsStatus response. +func (client *ServerOperationsStatusControllerClient) getServerSiteOperationsStatusHandleResponse(resp *http.Response) (ServerOperationsStatusControllerClientGetServerSiteOperationsStatusResponse, error) { + result := ServerOperationsStatusControllerClientGetServerSiteOperationsStatusResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { + return ServerOperationsStatusControllerClientGetServerSiteOperationsStatusResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/serverrunasaccountscontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/serverrunasaccountscontroller_client.go new file mode 100644 index 000000000000..65f3006965ae --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/serverrunasaccountscontroller_client.go @@ -0,0 +1,179 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ServerRunAsAccountsControllerClient contains the methods for the ServerRunAsAccountsController group. +// Don't use this type directly, use NewServerRunAsAccountsControllerClient() instead. +type ServerRunAsAccountsControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewServerRunAsAccountsControllerClient creates a new instance of ServerRunAsAccountsControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewServerRunAsAccountsControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ServerRunAsAccountsControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ServerRunAsAccountsControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get a ServerRunAsAccount +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - accountName - RunAsAccounts name +// - options - ServerRunAsAccountsControllerClientGetOptions contains the optional parameters for the ServerRunAsAccountsControllerClient.Get +// method. +func (client *ServerRunAsAccountsControllerClient) Get(ctx context.Context, resourceGroupName string, siteName string, accountName string, options *ServerRunAsAccountsControllerClientGetOptions) (ServerRunAsAccountsControllerClientGetResponse, error) { + var err error + const operationName = "ServerRunAsAccountsControllerClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, siteName, accountName, options) + if err != nil { + return ServerRunAsAccountsControllerClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ServerRunAsAccountsControllerClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServerRunAsAccountsControllerClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ServerRunAsAccountsControllerClient) getCreateRequest(ctx context.Context, resourceGroupName string, siteName string, accountName string, options *ServerRunAsAccountsControllerClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/serverSites/{siteName}/runAsAccounts/{accountName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ServerRunAsAccountsControllerClient) getHandleResponse(resp *http.Response) (ServerRunAsAccountsControllerClientGetResponse, error) { + result := ServerRunAsAccountsControllerClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ServerRunAsAccount); err != nil { + return ServerRunAsAccountsControllerClientGetResponse{}, err + } + return result, nil +} + +// NewListByServerSiteResourcePager - List ServerRunAsAccount resources by ServerSiteResource +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - options - ServerRunAsAccountsControllerClientListByServerSiteResourceOptions contains the optional parameters for the ServerRunAsAccountsControllerClient.NewListByServerSiteResourcePager +// method. +func (client *ServerRunAsAccountsControllerClient) NewListByServerSiteResourcePager(resourceGroupName string, siteName string, options *ServerRunAsAccountsControllerClientListByServerSiteResourceOptions) *runtime.Pager[ServerRunAsAccountsControllerClientListByServerSiteResourceResponse] { + return runtime.NewPager(runtime.PagingHandler[ServerRunAsAccountsControllerClientListByServerSiteResourceResponse]{ + More: func(page ServerRunAsAccountsControllerClientListByServerSiteResourceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ServerRunAsAccountsControllerClientListByServerSiteResourceResponse) (ServerRunAsAccountsControllerClientListByServerSiteResourceResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ServerRunAsAccountsControllerClient.NewListByServerSiteResourcePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByServerSiteResourceCreateRequest(ctx, resourceGroupName, siteName, options) + }, nil) + if err != nil { + return ServerRunAsAccountsControllerClientListByServerSiteResourceResponse{}, err + } + return client.listByServerSiteResourceHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByServerSiteResourceCreateRequest creates the ListByServerSiteResource request. +func (client *ServerRunAsAccountsControllerClient) listByServerSiteResourceCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *ServerRunAsAccountsControllerClientListByServerSiteResourceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/serverSites/{siteName}/runAsAccounts" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByServerSiteResourceHandleResponse handles the ListByServerSiteResource response. +func (client *ServerRunAsAccountsControllerClient) listByServerSiteResourceHandleResponse(resp *http.Response) (ServerRunAsAccountsControllerClientListByServerSiteResourceResponse, error) { + result := ServerRunAsAccountsControllerClientListByServerSiteResourceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ServerRunAsAccountListResult); err != nil { + return ServerRunAsAccountsControllerClientListByServerSiteResourceResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/serverscontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/serverscontroller_client.go new file mode 100644 index 000000000000..65c3cd87195e --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/serverscontroller_client.go @@ -0,0 +1,326 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// ServersControllerClient contains the methods for the ServersController group. +// Don't use this type directly, use NewServersControllerClient() instead. +type ServersControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewServersControllerClient creates a new instance of ServersControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewServersControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ServersControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ServersControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// DeleteMachine - Delete a Server +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - machineName - A server machine name +// - options - ServersControllerClientDeleteMachineOptions contains the optional parameters for the ServersControllerClient.DeleteMachine +// method. +func (client *ServersControllerClient) DeleteMachine(ctx context.Context, resourceGroupName string, siteName string, machineName string, options *ServersControllerClientDeleteMachineOptions) (ServersControllerClientDeleteMachineResponse, error) { + var err error + const operationName = "ServersControllerClient.DeleteMachine" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteMachineCreateRequest(ctx, resourceGroupName, siteName, machineName, options) + if err != nil { + return ServersControllerClientDeleteMachineResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ServersControllerClientDeleteMachineResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return ServersControllerClientDeleteMachineResponse{}, err + } + return ServersControllerClientDeleteMachineResponse{}, nil +} + +// deleteMachineCreateRequest creates the DeleteMachine request. +func (client *ServersControllerClient) deleteMachineCreateRequest(ctx context.Context, resourceGroupName string, siteName string, machineName string, options *ServersControllerClientDeleteMachineOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/serverSites/{siteName}/machines/{machineName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if machineName == "" { + return nil, errors.New("parameter machineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{machineName}", url.PathEscape(machineName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// GetMachine - Get a Server +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - machineName - A server machine name +// - options - ServersControllerClientGetMachineOptions contains the optional parameters for the ServersControllerClient.GetMachine +// method. +func (client *ServersControllerClient) GetMachine(ctx context.Context, resourceGroupName string, siteName string, machineName string, options *ServersControllerClientGetMachineOptions) (ServersControllerClientGetMachineResponse, error) { + var err error + const operationName = "ServersControllerClient.GetMachine" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getMachineCreateRequest(ctx, resourceGroupName, siteName, machineName, options) + if err != nil { + return ServersControllerClientGetMachineResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ServersControllerClientGetMachineResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServersControllerClientGetMachineResponse{}, err + } + resp, err := client.getMachineHandleResponse(httpResp) + return resp, err +} + +// getMachineCreateRequest creates the GetMachine request. +func (client *ServersControllerClient) getMachineCreateRequest(ctx context.Context, resourceGroupName string, siteName string, machineName string, options *ServersControllerClientGetMachineOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/serverSites/{siteName}/machines/{machineName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if machineName == "" { + return nil, errors.New("parameter machineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{machineName}", url.PathEscape(machineName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getMachineHandleResponse handles the GetMachine response. +func (client *ServersControllerClient) getMachineHandleResponse(resp *http.Response) (ServersControllerClientGetMachineResponse, error) { + result := ServersControllerClientGetMachineResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Server); err != nil { + return ServersControllerClientGetMachineResponse{}, err + } + return result, nil +} + +// NewListByServerSiteResourcePager - Get all machines in a site. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - options - ServersControllerClientListByServerSiteResourceOptions contains the optional parameters for the ServersControllerClient.NewListByServerSiteResourcePager +// method. +func (client *ServersControllerClient) NewListByServerSiteResourcePager(resourceGroupName string, siteName string, options *ServersControllerClientListByServerSiteResourceOptions) *runtime.Pager[ServersControllerClientListByServerSiteResourceResponse] { + return runtime.NewPager(runtime.PagingHandler[ServersControllerClientListByServerSiteResourceResponse]{ + More: func(page ServersControllerClientListByServerSiteResourceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ServersControllerClientListByServerSiteResourceResponse) (ServersControllerClientListByServerSiteResourceResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ServersControllerClient.NewListByServerSiteResourcePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByServerSiteResourceCreateRequest(ctx, resourceGroupName, siteName, options) + }, nil) + if err != nil { + return ServersControllerClientListByServerSiteResourceResponse{}, err + } + return client.listByServerSiteResourceHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByServerSiteResourceCreateRequest creates the ListByServerSiteResource request. +func (client *ServersControllerClient) listByServerSiteResourceCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *ServersControllerClientListByServerSiteResourceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/serverSites/{siteName}/machines" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + if options != nil && options.Filter != nil { + reqQP.Set("filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("top", *options.Top) + } + if options != nil && options.ContinuationToken != nil { + reqQP.Set("continuationToken", *options.ContinuationToken) + } + if options != nil && options.TotalRecordCount != nil { + reqQP.Set("totalRecordCount", strconv.FormatInt(int64(*options.TotalRecordCount), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByServerSiteResourceHandleResponse handles the ListByServerSiteResource response. +func (client *ServersControllerClient) listByServerSiteResourceHandleResponse(resp *http.Response) (ServersControllerClientListByServerSiteResourceResponse, error) { + result := ServersControllerClientListByServerSiteResourceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ServerListResult); err != nil { + return ServersControllerClientListByServerSiteResourceResponse{}, err + } + return result, nil +} + +// UpdateMachine - Update a Server machine +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - machineName - A server machine name +// - body - The resource properties to be updated. +// - options - ServersControllerClientUpdateMachineOptions contains the optional parameters for the ServersControllerClient.UpdateMachine +// method. +func (client *ServersControllerClient) UpdateMachine(ctx context.Context, resourceGroupName string, siteName string, machineName string, body ServerUpdate, options *ServersControllerClientUpdateMachineOptions) (ServersControllerClientUpdateMachineResponse, error) { + var err error + const operationName = "ServersControllerClient.UpdateMachine" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateMachineCreateRequest(ctx, resourceGroupName, siteName, machineName, body, options) + if err != nil { + return ServersControllerClientUpdateMachineResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ServersControllerClientUpdateMachineResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServersControllerClientUpdateMachineResponse{}, err + } + resp, err := client.updateMachineHandleResponse(httpResp) + return resp, err +} + +// updateMachineCreateRequest creates the UpdateMachine request. +func (client *ServersControllerClient) updateMachineCreateRequest(ctx context.Context, resourceGroupName string, siteName string, machineName string, body ServerUpdate, options *ServersControllerClientUpdateMachineOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/serverSites/{siteName}/machines/{machineName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if machineName == "" { + return nil, errors.New("parameter machineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{machineName}", url.PathEscape(machineName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// updateMachineHandleResponse handles the UpdateMachine response. +func (client *ServersControllerClient) updateMachineHandleResponse(resp *http.Response) (ServersControllerClientUpdateMachineResponse, error) { + result := ServersControllerClientUpdateMachineResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Server); err != nil { + return ServersControllerClientUpdateMachineResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/serversitescontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/serversitescontroller_client.go new file mode 100644 index 000000000000..d892dedfc4c5 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/serversitescontroller_client.go @@ -0,0 +1,1102 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ServerSitesControllerClient contains the methods for the ServerSitesController group. +// Don't use this type directly, use NewServerSitesControllerClient() instead. +type ServerSitesControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewServerSitesControllerClient creates a new instance of ServerSitesControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewServerSitesControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ServerSitesControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ServerSitesControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// ComputeErrorSummary - Get the error summary for a server site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - body - The content of the action request +// - options - ServerSitesControllerClientComputeErrorSummaryOptions contains the optional parameters for the ServerSitesControllerClient.ComputeErrorSummary +// method. +func (client *ServerSitesControllerClient) ComputeErrorSummary(ctx context.Context, resourceGroupName string, siteName string, body any, options *ServerSitesControllerClientComputeErrorSummaryOptions) (ServerSitesControllerClientComputeErrorSummaryResponse, error) { + var err error + const operationName = "ServerSitesControllerClient.ComputeErrorSummary" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.computeErrorSummaryCreateRequest(ctx, resourceGroupName, siteName, body, options) + if err != nil { + return ServerSitesControllerClientComputeErrorSummaryResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ServerSitesControllerClientComputeErrorSummaryResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServerSitesControllerClientComputeErrorSummaryResponse{}, err + } + resp, err := client.computeErrorSummaryHandleResponse(httpResp) + return resp, err +} + +// computeErrorSummaryCreateRequest creates the ComputeErrorSummary request. +func (client *ServerSitesControllerClient) computeErrorSummaryCreateRequest(ctx context.Context, resourceGroupName string, siteName string, body any, options *ServerSitesControllerClientComputeErrorSummaryOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/serverSites/{siteName}/computeErrorSummary" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// computeErrorSummaryHandleResponse handles the ComputeErrorSummary response. +func (client *ServerSitesControllerClient) computeErrorSummaryHandleResponse(resp *http.Response) (ServerSitesControllerClientComputeErrorSummaryResponse, error) { + result := ServerSitesControllerClientComputeErrorSummaryResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SiteErrorSummary); err != nil { + return ServerSitesControllerClientComputeErrorSummaryResponse{}, err + } + return result, nil +} + +// Computeusage - Get a serve site usage. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - body - The content of the action request +// - options - ServerSitesControllerClientComputeusageOptions contains the optional parameters for the ServerSitesControllerClient.Computeusage +// method. +func (client *ServerSitesControllerClient) Computeusage(ctx context.Context, resourceGroupName string, siteName string, body any, options *ServerSitesControllerClientComputeusageOptions) (ServerSitesControllerClientComputeusageResponse, error) { + var err error + const operationName = "ServerSitesControllerClient.Computeusage" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.computeusageCreateRequest(ctx, resourceGroupName, siteName, body, options) + if err != nil { + return ServerSitesControllerClientComputeusageResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ServerSitesControllerClientComputeusageResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServerSitesControllerClientComputeusageResponse{}, err + } + resp, err := client.computeusageHandleResponse(httpResp) + return resp, err +} + +// computeusageCreateRequest creates the Computeusage request. +func (client *ServerSitesControllerClient) computeusageCreateRequest(ctx context.Context, resourceGroupName string, siteName string, body any, options *ServerSitesControllerClientComputeusageOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/serverSites/{siteName}/computeusage" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// computeusageHandleResponse handles the Computeusage response. +func (client *ServerSitesControllerClient) computeusageHandleResponse(resp *http.Response) (ServerSitesControllerClientComputeusageResponse, error) { + result := ServerSitesControllerClientComputeusageResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ServerSiteUsageResponse); err != nil { + return ServerSitesControllerClientComputeusageResponse{}, err + } + return result, nil +} + +// BeginCreate - Create a ServerSiteResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - body - Resource create parameters. +// - options - ServerSitesControllerClientBeginCreateOptions contains the optional parameters for the ServerSitesControllerClient.BeginCreate +// method. +func (client *ServerSitesControllerClient) BeginCreate(ctx context.Context, resourceGroupName string, siteName string, body ServerSiteResource, options *ServerSitesControllerClientBeginCreateOptions) (*runtime.Poller[ServerSitesControllerClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, siteName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ServerSitesControllerClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ServerSitesControllerClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Create a ServerSiteResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *ServerSitesControllerClient) create(ctx context.Context, resourceGroupName string, siteName string, body ServerSiteResource, options *ServerSitesControllerClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "ServerSitesControllerClient.BeginCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, siteName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createCreateRequest creates the Create request. +func (client *ServerSitesControllerClient) createCreateRequest(ctx context.Context, resourceGroupName string, siteName string, body ServerSiteResource, options *ServerSitesControllerClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/serverSites/{siteName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// Delete - Delete a ServerSiteResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - options - ServerSitesControllerClientDeleteOptions contains the optional parameters for the ServerSitesControllerClient.Delete +// method. +func (client *ServerSitesControllerClient) Delete(ctx context.Context, resourceGroupName string, siteName string, options *ServerSitesControllerClientDeleteOptions) (ServerSitesControllerClientDeleteResponse, error) { + var err error + const operationName = "ServerSitesControllerClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, siteName, options) + if err != nil { + return ServerSitesControllerClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ServerSitesControllerClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return ServerSitesControllerClientDeleteResponse{}, err + } + return ServerSitesControllerClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ServerSitesControllerClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *ServerSitesControllerClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/serverSites/{siteName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginExportApplications - Method to generate report containing machine and the deep discovery of the application installed +// in the machine. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - body - The content of the action request +// - options - ServerSitesControllerClientBeginExportApplicationsOptions contains the optional parameters for the ServerSitesControllerClient.BeginExportApplications +// method. +func (client *ServerSitesControllerClient) BeginExportApplications(ctx context.Context, resourceGroupName string, siteName string, body any, options *ServerSitesControllerClientBeginExportApplicationsOptions) (*runtime.Poller[ServerSitesControllerClientExportApplicationsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.exportApplications(ctx, resourceGroupName, siteName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ServerSitesControllerClientExportApplicationsResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ServerSitesControllerClientExportApplicationsResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ExportApplications - Method to generate report containing machine and the deep discovery of the application installed in +// the machine. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *ServerSitesControllerClient) exportApplications(ctx context.Context, resourceGroupName string, siteName string, body any, options *ServerSitesControllerClientBeginExportApplicationsOptions) (*http.Response, error) { + var err error + const operationName = "ServerSitesControllerClient.BeginExportApplications" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.exportApplicationsCreateRequest(ctx, resourceGroupName, siteName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// exportApplicationsCreateRequest creates the ExportApplications request. +func (client *ServerSitesControllerClient) exportApplicationsCreateRequest(ctx context.Context, resourceGroupName string, siteName string, body any, options *ServerSitesControllerClientBeginExportApplicationsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/serverSites/{siteName}/exportApplications" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// BeginExportMachineErrors - Method to generate report containing machine and the errors encountered during guest discovery +// of the machine. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - body - The content of the action request +// - options - ServerSitesControllerClientBeginExportMachineErrorsOptions contains the optional parameters for the ServerSitesControllerClient.BeginExportMachineErrors +// method. +func (client *ServerSitesControllerClient) BeginExportMachineErrors(ctx context.Context, resourceGroupName string, siteName string, body ExportMachineErrorsRequest, options *ServerSitesControllerClientBeginExportMachineErrorsOptions) (*runtime.Poller[ServerSitesControllerClientExportMachineErrorsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.exportMachineErrors(ctx, resourceGroupName, siteName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ServerSitesControllerClientExportMachineErrorsResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ServerSitesControllerClientExportMachineErrorsResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ExportMachineErrors - Method to generate report containing machine and the errors encountered during guest discovery of +// the machine. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *ServerSitesControllerClient) exportMachineErrors(ctx context.Context, resourceGroupName string, siteName string, body ExportMachineErrorsRequest, options *ServerSitesControllerClientBeginExportMachineErrorsOptions) (*http.Response, error) { + var err error + const operationName = "ServerSitesControllerClient.BeginExportMachineErrors" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.exportMachineErrorsCreateRequest(ctx, resourceGroupName, siteName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// exportMachineErrorsCreateRequest creates the ExportMachineErrors request. +func (client *ServerSitesControllerClient) exportMachineErrorsCreateRequest(ctx context.Context, resourceGroupName string, siteName string, body ExportMachineErrorsRequest, options *ServerSitesControllerClientBeginExportMachineErrorsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/serverSites/{siteName}/exportMachineErrors" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// Get - Get a ServerSiteResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - options - ServerSitesControllerClientGetOptions contains the optional parameters for the ServerSitesControllerClient.Get +// method. +func (client *ServerSitesControllerClient) Get(ctx context.Context, resourceGroupName string, siteName string, options *ServerSitesControllerClientGetOptions) (ServerSitesControllerClientGetResponse, error) { + var err error + const operationName = "ServerSitesControllerClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, siteName, options) + if err != nil { + return ServerSitesControllerClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ServerSitesControllerClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServerSitesControllerClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ServerSitesControllerClient) getCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *ServerSitesControllerClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/serverSites/{siteName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ServerSitesControllerClient) getHandleResponse(resp *http.Response) (ServerSitesControllerClientGetResponse, error) { + result := ServerSitesControllerClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ServerSiteResource); err != nil { + return ServerSitesControllerClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List ServerSiteResource resources by resource group +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - ServerSitesControllerClientListByResourceGroupOptions contains the optional parameters for the ServerSitesControllerClient.NewListByResourceGroupPager +// method. +func (client *ServerSitesControllerClient) NewListByResourceGroupPager(resourceGroupName string, options *ServerSitesControllerClientListByResourceGroupOptions) *runtime.Pager[ServerSitesControllerClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[ServerSitesControllerClientListByResourceGroupResponse]{ + More: func(page ServerSitesControllerClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ServerSitesControllerClientListByResourceGroupResponse) (ServerSitesControllerClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ServerSitesControllerClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return ServerSitesControllerClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *ServerSitesControllerClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ServerSitesControllerClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/serverSites" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *ServerSitesControllerClient) listByResourceGroupHandleResponse(resp *http.Response) (ServerSitesControllerClientListByResourceGroupResponse, error) { + result := ServerSitesControllerClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ServerSiteResourceListResult); err != nil { + return ServerSitesControllerClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List ServerSiteResource resources by subscription ID +// +// Generated from API version 2023-10-01-preview +// - options - ServerSitesControllerClientListBySubscriptionOptions contains the optional parameters for the ServerSitesControllerClient.NewListBySubscriptionPager +// method. +func (client *ServerSitesControllerClient) NewListBySubscriptionPager(options *ServerSitesControllerClientListBySubscriptionOptions) *runtime.Pager[ServerSitesControllerClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[ServerSitesControllerClientListBySubscriptionResponse]{ + More: func(page ServerSitesControllerClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ServerSitesControllerClientListBySubscriptionResponse) (ServerSitesControllerClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ServerSitesControllerClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return ServerSitesControllerClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *ServerSitesControllerClient) listBySubscriptionCreateRequest(ctx context.Context, options *ServerSitesControllerClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.OffAzure/serverSites" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *ServerSitesControllerClient) listBySubscriptionHandleResponse(resp *http.Response) (ServerSitesControllerClientListBySubscriptionResponse, error) { + result := ServerSitesControllerClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ServerSiteResourceListResult); err != nil { + return ServerSitesControllerClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// ListHealthSummary - Method to get site health summary. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - options - ServerSitesControllerClientListHealthSummaryOptions contains the optional parameters for the ServerSitesControllerClient.ListHealthSummary +// method. +func (client *ServerSitesControllerClient) ListHealthSummary(ctx context.Context, resourceGroupName string, siteName string, options *ServerSitesControllerClientListHealthSummaryOptions) (ServerSitesControllerClientListHealthSummaryResponse, error) { + var err error + const operationName = "ServerSitesControllerClient.ListHealthSummary" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listHealthSummaryCreateRequest(ctx, resourceGroupName, siteName, options) + if err != nil { + return ServerSitesControllerClientListHealthSummaryResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ServerSitesControllerClientListHealthSummaryResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServerSitesControllerClientListHealthSummaryResponse{}, err + } + resp, err := client.listHealthSummaryHandleResponse(httpResp) + return resp, err +} + +// listHealthSummaryCreateRequest creates the ListHealthSummary request. +func (client *ServerSitesControllerClient) listHealthSummaryCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *ServerSitesControllerClientListHealthSummaryOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/serverSites/{siteName}/listHealthSummary" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHealthSummaryHandleResponse handles the ListHealthSummary response. +func (client *ServerSitesControllerClient) listHealthSummaryHandleResponse(resp *http.Response) (ServerSitesControllerClientListHealthSummaryResponse, error) { + result := ServerSitesControllerClientListHealthSummaryResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SiteHealthSummaryCollection); err != nil { + return ServerSitesControllerClientListHealthSummaryResponse{}, err + } + return result, nil +} + +// BeginRefreshSite - Operation to refresh a site +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - options - ServerSitesControllerClientBeginRefreshSiteOptions contains the optional parameters for the ServerSitesControllerClient.BeginRefreshSite +// method. +func (client *ServerSitesControllerClient) BeginRefreshSite(ctx context.Context, resourceGroupName string, siteName string, options *ServerSitesControllerClientBeginRefreshSiteOptions) (*runtime.Poller[ServerSitesControllerClientRefreshSiteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.refreshSite(ctx, resourceGroupName, siteName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ServerSitesControllerClientRefreshSiteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ServerSitesControllerClientRefreshSiteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// RefreshSite - Operation to refresh a site +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *ServerSitesControllerClient) refreshSite(ctx context.Context, resourceGroupName string, siteName string, options *ServerSitesControllerClientBeginRefreshSiteOptions) (*http.Response, error) { + var err error + const operationName = "ServerSitesControllerClient.BeginRefreshSite" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.refreshSiteCreateRequest(ctx, resourceGroupName, siteName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// refreshSiteCreateRequest creates the RefreshSite request. +func (client *ServerSitesControllerClient) refreshSiteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *ServerSitesControllerClientBeginRefreshSiteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/serverSites/{siteName}/refreshSite" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Summary - Method to get site usage. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - options - ServerSitesControllerClientSummaryOptions contains the optional parameters for the ServerSitesControllerClient.Summary +// method. +func (client *ServerSitesControllerClient) Summary(ctx context.Context, resourceGroupName string, siteName string, options *ServerSitesControllerClientSummaryOptions) (ServerSitesControllerClientSummaryResponse, error) { + var err error + const operationName = "ServerSitesControllerClient.Summary" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.summaryCreateRequest(ctx, resourceGroupName, siteName, options) + if err != nil { + return ServerSitesControllerClientSummaryResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ServerSitesControllerClientSummaryResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServerSitesControllerClientSummaryResponse{}, err + } + resp, err := client.summaryHandleResponse(httpResp) + return resp, err +} + +// summaryCreateRequest creates the Summary request. +func (client *ServerSitesControllerClient) summaryCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *ServerSitesControllerClientSummaryOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/serverSites/{siteName}/summary" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// summaryHandleResponse handles the Summary response. +func (client *ServerSitesControllerClient) summaryHandleResponse(resp *http.Response) (ServerSitesControllerClientSummaryResponse, error) { + result := ServerSitesControllerClientSummaryResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ServerSiteUsage); err != nil { + return ServerSitesControllerClientSummaryResponse{}, err + } + return result, nil +} + +// Update - Update a ServerSiteResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - body - The resource properties to be updated. +// - options - ServerSitesControllerClientUpdateOptions contains the optional parameters for the ServerSitesControllerClient.Update +// method. +func (client *ServerSitesControllerClient) Update(ctx context.Context, resourceGroupName string, siteName string, body ServerSiteResourceUpdate, options *ServerSitesControllerClientUpdateOptions) (ServerSitesControllerClientUpdateResponse, error) { + var err error + const operationName = "ServerSitesControllerClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, siteName, body, options) + if err != nil { + return ServerSitesControllerClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ServerSitesControllerClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServerSitesControllerClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *ServerSitesControllerClient) updateCreateRequest(ctx context.Context, resourceGroupName string, siteName string, body ServerSiteResourceUpdate, options *ServerSitesControllerClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/serverSites/{siteName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *ServerSitesControllerClient) updateHandleResponse(resp *http.Response) (ServerSitesControllerClientUpdateResponse, error) { + result := ServerSitesControllerClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ServerSiteResource); err != nil { + return ServerSitesControllerClientUpdateResponse{}, err + } + return result, nil +} + +// BeginUpdateDependencyMapStatus - Method to enable disable dependency map status for machines in a site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - mapRequest - The content of the action request +// - options - ServerSitesControllerClientBeginUpdateDependencyMapStatusOptions contains the optional parameters for the ServerSitesControllerClient.BeginUpdateDependencyMapStatus +// method. +func (client *ServerSitesControllerClient) BeginUpdateDependencyMapStatus(ctx context.Context, resourceGroupName string, siteName string, mapRequest UpdateMachineDepMapStatus, options *ServerSitesControllerClientBeginUpdateDependencyMapStatusOptions) (*runtime.Poller[ServerSitesControllerClientUpdateDependencyMapStatusResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.updateDependencyMapStatus(ctx, resourceGroupName, siteName, mapRequest, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ServerSitesControllerClientUpdateDependencyMapStatusResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ServerSitesControllerClientUpdateDependencyMapStatusResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// UpdateDependencyMapStatus - Method to enable disable dependency map status for machines in a site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *ServerSitesControllerClient) updateDependencyMapStatus(ctx context.Context, resourceGroupName string, siteName string, mapRequest UpdateMachineDepMapStatus, options *ServerSitesControllerClientBeginUpdateDependencyMapStatusOptions) (*http.Response, error) { + var err error + const operationName = "ServerSitesControllerClient.BeginUpdateDependencyMapStatus" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateDependencyMapStatusCreateRequest(ctx, resourceGroupName, siteName, mapRequest, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateDependencyMapStatusCreateRequest creates the UpdateDependencyMapStatus request. +func (client *ServerSitesControllerClient) updateDependencyMapStatusCreateRequest(ctx context.Context, resourceGroupName string, siteName string, mapRequest UpdateMachineDepMapStatus, options *ServerSitesControllerClientBeginUpdateDependencyMapStatusOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/serverSites/{siteName}/updateDependencyMapStatus" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, mapRequest); err != nil { + return nil, err + } + return req, nil +} + +// BeginUpdateProperties - Operation to update custom properties for servers +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - metaData - The content of the action request +// - options - ServerSitesControllerClientBeginUpdatePropertiesOptions contains the optional parameters for the ServerSitesControllerClient.BeginUpdateProperties +// method. +func (client *ServerSitesControllerClient) BeginUpdateProperties(ctx context.Context, resourceGroupName string, siteName string, metaData MachineMetadataCollection, options *ServerSitesControllerClientBeginUpdatePropertiesOptions) (*runtime.Poller[ServerSitesControllerClientUpdatePropertiesResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.updateProperties(ctx, resourceGroupName, siteName, metaData, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ServerSitesControllerClientUpdatePropertiesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ServerSitesControllerClientUpdatePropertiesResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// UpdateProperties - Operation to update custom properties for servers +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *ServerSitesControllerClient) updateProperties(ctx context.Context, resourceGroupName string, siteName string, metaData MachineMetadataCollection, options *ServerSitesControllerClientBeginUpdatePropertiesOptions) (*http.Response, error) { + var err error + const operationName = "ServerSitesControllerClient.BeginUpdateProperties" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updatePropertiesCreateRequest(ctx, resourceGroupName, siteName, metaData, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updatePropertiesCreateRequest creates the UpdateProperties request. +func (client *ServerSitesControllerClient) updatePropertiesCreateRequest(ctx context.Context, resourceGroupName string, siteName string, metaData MachineMetadataCollection, options *ServerSitesControllerClientBeginUpdatePropertiesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/serverSites/{siteName}/updateProperties" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, metaData); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/serversoftwareinventoriescontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/serversoftwareinventoriescontroller_client.go new file mode 100644 index 000000000000..1a0d6b270f17 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/serversoftwareinventoriescontroller_client.go @@ -0,0 +1,189 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ServerSoftwareInventoriesControllerClient contains the methods for the ServerSoftwareInventoriesController group. +// Don't use this type directly, use NewServerSoftwareInventoriesControllerClient() instead. +type ServerSoftwareInventoriesControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewServerSoftwareInventoriesControllerClient creates a new instance of ServerSoftwareInventoriesControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewServerSoftwareInventoriesControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ServerSoftwareInventoriesControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ServerSoftwareInventoriesControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// GetMachineSoftwareInventory - Method to get a machines software inventory like applications and roles. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - machineName - A server machine name +// - defaultParam - Default value. +// - options - ServerSoftwareInventoriesControllerClientGetMachineSoftwareInventoryOptions contains the optional parameters +// for the ServerSoftwareInventoriesControllerClient.GetMachineSoftwareInventory method. +func (client *ServerSoftwareInventoriesControllerClient) GetMachineSoftwareInventory(ctx context.Context, resourceGroupName string, siteName string, machineName string, defaultParam Default, options *ServerSoftwareInventoriesControllerClientGetMachineSoftwareInventoryOptions) (ServerSoftwareInventoriesControllerClientGetMachineSoftwareInventoryResponse, error) { + var err error + const operationName = "ServerSoftwareInventoriesControllerClient.GetMachineSoftwareInventory" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getMachineSoftwareInventoryCreateRequest(ctx, resourceGroupName, siteName, machineName, defaultParam, options) + if err != nil { + return ServerSoftwareInventoriesControllerClientGetMachineSoftwareInventoryResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ServerSoftwareInventoriesControllerClientGetMachineSoftwareInventoryResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServerSoftwareInventoriesControllerClientGetMachineSoftwareInventoryResponse{}, err + } + resp, err := client.getMachineSoftwareInventoryHandleResponse(httpResp) + return resp, err +} + +// getMachineSoftwareInventoryCreateRequest creates the GetMachineSoftwareInventory request. +func (client *ServerSoftwareInventoriesControllerClient) getMachineSoftwareInventoryCreateRequest(ctx context.Context, resourceGroupName string, siteName string, machineName string, defaultParam Default, options *ServerSoftwareInventoriesControllerClientGetMachineSoftwareInventoryOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/serverSites/{siteName}/machines/{machineName}/softwareInventories/{default}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if machineName == "" { + return nil, errors.New("parameter machineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{machineName}", url.PathEscape(machineName)) + if defaultParam == "" { + return nil, errors.New("parameter defaultParam cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{default}", url.PathEscape(string(defaultParam))) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getMachineSoftwareInventoryHandleResponse handles the GetMachineSoftwareInventory response. +func (client *ServerSoftwareInventoriesControllerClient) getMachineSoftwareInventoryHandleResponse(resp *http.Response) (ServerSoftwareInventoriesControllerClientGetMachineSoftwareInventoryResponse, error) { + result := ServerSoftwareInventoriesControllerClientGetMachineSoftwareInventoryResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ServerSoftwareInventory); err != nil { + return ServerSoftwareInventoriesControllerClientGetMachineSoftwareInventoryResponse{}, err + } + return result, nil +} + +// NewListByServerPager - List ServerSoftwareInventory resources by Server +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - machineName - A server machine name +// - options - ServerSoftwareInventoriesControllerClientListByServerOptions contains the optional parameters for the ServerSoftwareInventoriesControllerClient.NewListByServerPager +// method. +func (client *ServerSoftwareInventoriesControllerClient) NewListByServerPager(resourceGroupName string, siteName string, machineName string, options *ServerSoftwareInventoriesControllerClientListByServerOptions) *runtime.Pager[ServerSoftwareInventoriesControllerClientListByServerResponse] { + return runtime.NewPager(runtime.PagingHandler[ServerSoftwareInventoriesControllerClientListByServerResponse]{ + More: func(page ServerSoftwareInventoriesControllerClientListByServerResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ServerSoftwareInventoriesControllerClientListByServerResponse) (ServerSoftwareInventoriesControllerClientListByServerResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ServerSoftwareInventoriesControllerClient.NewListByServerPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByServerCreateRequest(ctx, resourceGroupName, siteName, machineName, options) + }, nil) + if err != nil { + return ServerSoftwareInventoriesControllerClientListByServerResponse{}, err + } + return client.listByServerHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByServerCreateRequest creates the ListByServer request. +func (client *ServerSoftwareInventoriesControllerClient) listByServerCreateRequest(ctx context.Context, resourceGroupName string, siteName string, machineName string, options *ServerSoftwareInventoriesControllerClientListByServerOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/serverSites/{siteName}/machines/{machineName}/softwareinventories" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if machineName == "" { + return nil, errors.New("parameter machineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{machineName}", url.PathEscape(machineName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByServerHandleResponse handles the ListByServer response. +func (client *ServerSoftwareInventoriesControllerClient) listByServerHandleResponse(resp *http.Response) (ServerSoftwareInventoriesControllerClientListByServerResponse, error) { + result := ServerSoftwareInventoriesControllerClientListByServerResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ServerSoftwareInventoryListResult); err != nil { + return ServerSoftwareInventoriesControllerClientListByServerResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/sitescontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/sitescontroller_client.go new file mode 100644 index 000000000000..eadade29e27e --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/sitescontroller_client.go @@ -0,0 +1,938 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// SitesControllerClient contains the methods for the SitesController group. +// Don't use this type directly, use NewSitesControllerClient() instead. +type SitesControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSitesControllerClient creates a new instance of SitesControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewSitesControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SitesControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SitesControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// ComputeErrorSummary - Method to get site error summary. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - body - The content of the action request +// - options - SitesControllerClientComputeErrorSummaryOptions contains the optional parameters for the SitesControllerClient.ComputeErrorSummary +// method. +func (client *SitesControllerClient) ComputeErrorSummary(ctx context.Context, resourceGroupName string, siteName string, body any, options *SitesControllerClientComputeErrorSummaryOptions) (SitesControllerClientComputeErrorSummaryResponse, error) { + var err error + const operationName = "SitesControllerClient.ComputeErrorSummary" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.computeErrorSummaryCreateRequest(ctx, resourceGroupName, siteName, body, options) + if err != nil { + return SitesControllerClientComputeErrorSummaryResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SitesControllerClientComputeErrorSummaryResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SitesControllerClientComputeErrorSummaryResponse{}, err + } + resp, err := client.computeErrorSummaryHandleResponse(httpResp) + return resp, err +} + +// computeErrorSummaryCreateRequest creates the ComputeErrorSummary request. +func (client *SitesControllerClient) computeErrorSummaryCreateRequest(ctx context.Context, resourceGroupName string, siteName string, body any, options *SitesControllerClientComputeErrorSummaryOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/vmwareSites/{siteName}/computeErrorSummary" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// computeErrorSummaryHandleResponse handles the ComputeErrorSummary response. +func (client *SitesControllerClient) computeErrorSummaryHandleResponse(resp *http.Response) (SitesControllerClientComputeErrorSummaryResponse, error) { + result := SitesControllerClientComputeErrorSummaryResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SiteErrorSummary); err != nil { + return SitesControllerClientComputeErrorSummaryResponse{}, err + } + return result, nil +} + +// Computeusage - Method to get site error summary. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - body - The content of the action request +// - options - SitesControllerClientComputeusageOptions contains the optional parameters for the SitesControllerClient.Computeusage +// method. +func (client *SitesControllerClient) Computeusage(ctx context.Context, resourceGroupName string, siteName string, body any, options *SitesControllerClientComputeusageOptions) (SitesControllerClientComputeusageResponse, error) { + var err error + const operationName = "SitesControllerClient.Computeusage" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.computeusageCreateRequest(ctx, resourceGroupName, siteName, body, options) + if err != nil { + return SitesControllerClientComputeusageResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SitesControllerClientComputeusageResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SitesControllerClientComputeusageResponse{}, err + } + resp, err := client.computeusageHandleResponse(httpResp) + return resp, err +} + +// computeusageCreateRequest creates the Computeusage request. +func (client *SitesControllerClient) computeusageCreateRequest(ctx context.Context, resourceGroupName string, siteName string, body any, options *SitesControllerClientComputeusageOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/vmwareSites/{siteName}/computeusage" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// computeusageHandleResponse handles the Computeusage response. +func (client *SitesControllerClient) computeusageHandleResponse(resp *http.Response) (SitesControllerClientComputeusageResponse, error) { + result := SitesControllerClientComputeusageResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VmwareSiteUsage); err != nil { + return SitesControllerClientComputeusageResponse{}, err + } + return result, nil +} + +// Create - Create a VmwareSite +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - body - Resource create parameters. +// - options - SitesControllerClientCreateOptions contains the optional parameters for the SitesControllerClient.Create method. +func (client *SitesControllerClient) Create(ctx context.Context, resourceGroupName string, siteName string, body VmwareSite, options *SitesControllerClientCreateOptions) (SitesControllerClientCreateResponse, error) { + var err error + const operationName = "SitesControllerClient.Create" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, siteName, body, options) + if err != nil { + return SitesControllerClientCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SitesControllerClientCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return SitesControllerClientCreateResponse{}, err + } + resp, err := client.createHandleResponse(httpResp) + return resp, err +} + +// createCreateRequest creates the Create request. +func (client *SitesControllerClient) createCreateRequest(ctx context.Context, resourceGroupName string, siteName string, body VmwareSite, options *SitesControllerClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/vmwareSites/{siteName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *SitesControllerClient) createHandleResponse(resp *http.Response) (SitesControllerClientCreateResponse, error) { + result := SitesControllerClientCreateResponse{} + if val := resp.Header.Get("Retry-After"); val != "" { + retryAfter32, err := strconv.ParseInt(val, 10, 32) + retryAfter := int32(retryAfter32) + if err != nil { + return SitesControllerClientCreateResponse{}, err + } + result.RetryAfter = &retryAfter + } + if err := runtime.UnmarshalAsJSON(resp, &result.VmwareSite); err != nil { + return SitesControllerClientCreateResponse{}, err + } + return result, nil +} + +// Delete - Delete a VmwareSite +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - options - SitesControllerClientDeleteOptions contains the optional parameters for the SitesControllerClient.Delete method. +func (client *SitesControllerClient) Delete(ctx context.Context, resourceGroupName string, siteName string, options *SitesControllerClientDeleteOptions) (SitesControllerClientDeleteResponse, error) { + var err error + const operationName = "SitesControllerClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, siteName, options) + if err != nil { + return SitesControllerClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SitesControllerClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return SitesControllerClientDeleteResponse{}, err + } + return SitesControllerClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *SitesControllerClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *SitesControllerClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/vmwareSites/{siteName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginExportApplications - Method to generate report containing machine and the deep discovery of the application installed +// in the machine. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - body - The content of the action request +// - options - SitesControllerClientBeginExportApplicationsOptions contains the optional parameters for the SitesControllerClient.BeginExportApplications +// method. +func (client *SitesControllerClient) BeginExportApplications(ctx context.Context, resourceGroupName string, siteName string, body any, options *SitesControllerClientBeginExportApplicationsOptions) (*runtime.Poller[SitesControllerClientExportApplicationsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.exportApplications(ctx, resourceGroupName, siteName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SitesControllerClientExportApplicationsResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SitesControllerClientExportApplicationsResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ExportApplications - Method to generate report containing machine and the deep discovery of the application installed in +// the machine. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *SitesControllerClient) exportApplications(ctx context.Context, resourceGroupName string, siteName string, body any, options *SitesControllerClientBeginExportApplicationsOptions) (*http.Response, error) { + var err error + const operationName = "SitesControllerClient.BeginExportApplications" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.exportApplicationsCreateRequest(ctx, resourceGroupName, siteName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// exportApplicationsCreateRequest creates the ExportApplications request. +func (client *SitesControllerClient) exportApplicationsCreateRequest(ctx context.Context, resourceGroupName string, siteName string, body any, options *SitesControllerClientBeginExportApplicationsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/vmwareSites/{siteName}/exportApplications" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// BeginExportMachineErrors - Method to generate report containing machine and the errors encountered during guest discovery +// of the machine. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - body - The content of the action request +// - options - SitesControllerClientBeginExportMachineErrorsOptions contains the optional parameters for the SitesControllerClient.BeginExportMachineErrors +// method. +func (client *SitesControllerClient) BeginExportMachineErrors(ctx context.Context, resourceGroupName string, siteName string, body ExportMachineErrorsRequest, options *SitesControllerClientBeginExportMachineErrorsOptions) (*runtime.Poller[SitesControllerClientExportMachineErrorsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.exportMachineErrors(ctx, resourceGroupName, siteName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SitesControllerClientExportMachineErrorsResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SitesControllerClientExportMachineErrorsResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ExportMachineErrors - Method to generate report containing machine and the errors encountered during guest discovery of +// the machine. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *SitesControllerClient) exportMachineErrors(ctx context.Context, resourceGroupName string, siteName string, body ExportMachineErrorsRequest, options *SitesControllerClientBeginExportMachineErrorsOptions) (*http.Response, error) { + var err error + const operationName = "SitesControllerClient.BeginExportMachineErrors" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.exportMachineErrorsCreateRequest(ctx, resourceGroupName, siteName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// exportMachineErrorsCreateRequest creates the ExportMachineErrors request. +func (client *SitesControllerClient) exportMachineErrorsCreateRequest(ctx context.Context, resourceGroupName string, siteName string, body ExportMachineErrorsRequest, options *SitesControllerClientBeginExportMachineErrorsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/vmwareSites/{siteName}/exportMachineErrors" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// BeginExportMachines - Method to generate report containing machine and the deep discovery of the application installed +// in the machine. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - body - The content of the action request +// - options - SitesControllerClientBeginExportMachinesOptions contains the optional parameters for the SitesControllerClient.BeginExportMachines +// method. +func (client *SitesControllerClient) BeginExportMachines(ctx context.Context, resourceGroupName string, siteName string, body ExportMachinesRequest, options *SitesControllerClientBeginExportMachinesOptions) (*runtime.Poller[SitesControllerClientExportMachinesResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.exportMachines(ctx, resourceGroupName, siteName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SitesControllerClientExportMachinesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SitesControllerClientExportMachinesResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ExportMachines - Method to generate report containing machine and the deep discovery of the application installed in the +// machine. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *SitesControllerClient) exportMachines(ctx context.Context, resourceGroupName string, siteName string, body ExportMachinesRequest, options *SitesControllerClientBeginExportMachinesOptions) (*http.Response, error) { + var err error + const operationName = "SitesControllerClient.BeginExportMachines" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.exportMachinesCreateRequest(ctx, resourceGroupName, siteName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// exportMachinesCreateRequest creates the ExportMachines request. +func (client *SitesControllerClient) exportMachinesCreateRequest(ctx context.Context, resourceGroupName string, siteName string, body ExportMachinesRequest, options *SitesControllerClientBeginExportMachinesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/vmwareSites/{siteName}/exportMachines" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// Get - Get a VmwareSite +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - options - SitesControllerClientGetOptions contains the optional parameters for the SitesControllerClient.Get method. +func (client *SitesControllerClient) Get(ctx context.Context, resourceGroupName string, siteName string, options *SitesControllerClientGetOptions) (SitesControllerClientGetResponse, error) { + var err error + const operationName = "SitesControllerClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, siteName, options) + if err != nil { + return SitesControllerClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SitesControllerClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SitesControllerClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *SitesControllerClient) getCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *SitesControllerClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/vmwareSites/{siteName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SitesControllerClient) getHandleResponse(resp *http.Response) (SitesControllerClientGetResponse, error) { + result := SitesControllerClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VmwareSite); err != nil { + return SitesControllerClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Get all the vmware sites in the resource group. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - SitesControllerClientListByResourceGroupOptions contains the optional parameters for the SitesControllerClient.NewListByResourceGroupPager +// method. +func (client *SitesControllerClient) NewListByResourceGroupPager(resourceGroupName string, options *SitesControllerClientListByResourceGroupOptions) *runtime.Pager[SitesControllerClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[SitesControllerClientListByResourceGroupResponse]{ + More: func(page SitesControllerClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SitesControllerClientListByResourceGroupResponse) (SitesControllerClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SitesControllerClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return SitesControllerClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *SitesControllerClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *SitesControllerClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/vmwareSites" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *SitesControllerClient) listByResourceGroupHandleResponse(resp *http.Response) (SitesControllerClientListByResourceGroupResponse, error) { + result := SitesControllerClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VmwareSiteListResult); err != nil { + return SitesControllerClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - Get all the vmware sites in the subscription. +// +// Generated from API version 2023-10-01-preview +// - options - SitesControllerClientListBySubscriptionOptions contains the optional parameters for the SitesControllerClient.NewListBySubscriptionPager +// method. +func (client *SitesControllerClient) NewListBySubscriptionPager(options *SitesControllerClientListBySubscriptionOptions) *runtime.Pager[SitesControllerClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[SitesControllerClientListBySubscriptionResponse]{ + More: func(page SitesControllerClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SitesControllerClientListBySubscriptionResponse) (SitesControllerClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SitesControllerClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return SitesControllerClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *SitesControllerClient) listBySubscriptionCreateRequest(ctx context.Context, options *SitesControllerClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.OffAzure/vmwareSites" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *SitesControllerClient) listBySubscriptionHandleResponse(resp *http.Response) (SitesControllerClientListBySubscriptionResponse, error) { + result := SitesControllerClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VmwareSiteListResult); err != nil { + return SitesControllerClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// ListHealthSummary - Method to get site health summary. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - options - SitesControllerClientListHealthSummaryOptions contains the optional parameters for the SitesControllerClient.ListHealthSummary +// method. +func (client *SitesControllerClient) ListHealthSummary(ctx context.Context, resourceGroupName string, siteName string, options *SitesControllerClientListHealthSummaryOptions) (SitesControllerClientListHealthSummaryResponse, error) { + var err error + const operationName = "SitesControllerClient.ListHealthSummary" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listHealthSummaryCreateRequest(ctx, resourceGroupName, siteName, options) + if err != nil { + return SitesControllerClientListHealthSummaryResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SitesControllerClientListHealthSummaryResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SitesControllerClientListHealthSummaryResponse{}, err + } + resp, err := client.listHealthSummaryHandleResponse(httpResp) + return resp, err +} + +// listHealthSummaryCreateRequest creates the ListHealthSummary request. +func (client *SitesControllerClient) listHealthSummaryCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *SitesControllerClientListHealthSummaryOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/vmwareSites/{siteName}/listHealthSummary" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHealthSummaryHandleResponse handles the ListHealthSummary response. +func (client *SitesControllerClient) listHealthSummaryHandleResponse(resp *http.Response) (SitesControllerClientListHealthSummaryResponse, error) { + result := SitesControllerClientListHealthSummaryResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SiteHealthSummaryCollection); err != nil { + return SitesControllerClientListHealthSummaryResponse{}, err + } + return result, nil +} + +// Summary - Method to get site usage/summary. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - options - SitesControllerClientSummaryOptions contains the optional parameters for the SitesControllerClient.Summary method. +func (client *SitesControllerClient) Summary(ctx context.Context, resourceGroupName string, siteName string, options *SitesControllerClientSummaryOptions) (SitesControllerClientSummaryResponse, error) { + var err error + const operationName = "SitesControllerClient.Summary" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.summaryCreateRequest(ctx, resourceGroupName, siteName, options) + if err != nil { + return SitesControllerClientSummaryResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SitesControllerClientSummaryResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SitesControllerClientSummaryResponse{}, err + } + resp, err := client.summaryHandleResponse(httpResp) + return resp, err +} + +// summaryCreateRequest creates the Summary request. +func (client *SitesControllerClient) summaryCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *SitesControllerClientSummaryOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/vmwareSites/{siteName}/summary" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// summaryHandleResponse handles the Summary response. +func (client *SitesControllerClient) summaryHandleResponse(resp *http.Response) (SitesControllerClientSummaryResponse, error) { + result := SitesControllerClientSummaryResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VmwareSiteUsage); err != nil { + return SitesControllerClientSummaryResponse{}, err + } + return result, nil +} + +// Update - Update a VmwareSite +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - body - The resource properties to be updated. +// - options - SitesControllerClientUpdateOptions contains the optional parameters for the SitesControllerClient.Update method. +func (client *SitesControllerClient) Update(ctx context.Context, resourceGroupName string, siteName string, body VmwareSiteUpdate, options *SitesControllerClientUpdateOptions) (SitesControllerClientUpdateResponse, error) { + var err error + const operationName = "SitesControllerClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, siteName, body, options) + if err != nil { + return SitesControllerClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SitesControllerClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SitesControllerClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *SitesControllerClient) updateCreateRequest(ctx context.Context, resourceGroupName string, siteName string, body VmwareSiteUpdate, options *SitesControllerClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/vmwareSites/{siteName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *SitesControllerClient) updateHandleResponse(resp *http.Response) (SitesControllerClientUpdateResponse, error) { + result := SitesControllerClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VmwareSite); err != nil { + return SitesControllerClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/sqlavailabilitygroupscontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/sqlavailabilitygroupscontroller_client.go new file mode 100644 index 000000000000..f9f4789f96be --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/sqlavailabilitygroupscontroller_client.go @@ -0,0 +1,202 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// SQLAvailabilityGroupsControllerClient contains the methods for the SQLAvailabilityGroupsController group. +// Don't use this type directly, use NewSQLAvailabilityGroupsControllerClient() instead. +type SQLAvailabilityGroupsControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSQLAvailabilityGroupsControllerClient creates a new instance of SQLAvailabilityGroupsControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewSQLAvailabilityGroupsControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SQLAvailabilityGroupsControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SQLAvailabilityGroupsControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Gets the sql availability group. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - sqlSiteName - SQL site name. +// - sqlAvailabilityGroupName - SQL availability group name. +// - options - SQLAvailabilityGroupsControllerClientGetOptions contains the optional parameters for the SQLAvailabilityGroupsControllerClient.Get +// method. +func (client *SQLAvailabilityGroupsControllerClient) Get(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, sqlAvailabilityGroupName string, options *SQLAvailabilityGroupsControllerClientGetOptions) (SQLAvailabilityGroupsControllerClientGetResponse, error) { + var err error + const operationName = "SQLAvailabilityGroupsControllerClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, siteName, sqlSiteName, sqlAvailabilityGroupName, options) + if err != nil { + return SQLAvailabilityGroupsControllerClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SQLAvailabilityGroupsControllerClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SQLAvailabilityGroupsControllerClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *SQLAvailabilityGroupsControllerClient) getCreateRequest(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, sqlAvailabilityGroupName string, options *SQLAvailabilityGroupsControllerClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/sqlSites/{sqlSiteName}/sqlAvailabilityGroups/{sqlAvailabilityGroupName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if sqlSiteName == "" { + return nil, errors.New("parameter sqlSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlSiteName}", url.PathEscape(sqlSiteName)) + if sqlAvailabilityGroupName == "" { + return nil, errors.New("parameter sqlAvailabilityGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlAvailabilityGroupName}", url.PathEscape(sqlAvailabilityGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SQLAvailabilityGroupsControllerClient) getHandleResponse(resp *http.Response) (SQLAvailabilityGroupsControllerClientGetResponse, error) { + result := SQLAvailabilityGroupsControllerClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SQLAvailabilityGroup); err != nil { + return SQLAvailabilityGroupsControllerClientGetResponse{}, err + } + return result, nil +} + +// NewListBySQLSitePager - Gets the sql availability groups. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - sqlSiteName - SQL site name. +// - options - SQLAvailabilityGroupsControllerClientListBySQLSiteOptions contains the optional parameters for the SQLAvailabilityGroupsControllerClient.NewListBySQLSitePager +// method. +func (client *SQLAvailabilityGroupsControllerClient) NewListBySQLSitePager(resourceGroupName string, siteName string, sqlSiteName string, options *SQLAvailabilityGroupsControllerClientListBySQLSiteOptions) *runtime.Pager[SQLAvailabilityGroupsControllerClientListBySQLSiteResponse] { + return runtime.NewPager(runtime.PagingHandler[SQLAvailabilityGroupsControllerClientListBySQLSiteResponse]{ + More: func(page SQLAvailabilityGroupsControllerClientListBySQLSiteResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SQLAvailabilityGroupsControllerClientListBySQLSiteResponse) (SQLAvailabilityGroupsControllerClientListBySQLSiteResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SQLAvailabilityGroupsControllerClient.NewListBySQLSitePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySQLSiteCreateRequest(ctx, resourceGroupName, siteName, sqlSiteName, options) + }, nil) + if err != nil { + return SQLAvailabilityGroupsControllerClientListBySQLSiteResponse{}, err + } + return client.listBySQLSiteHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySQLSiteCreateRequest creates the ListBySQLSite request. +func (client *SQLAvailabilityGroupsControllerClient) listBySQLSiteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, options *SQLAvailabilityGroupsControllerClientListBySQLSiteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/sqlSites/{sqlSiteName}/sqlAvailabilityGroups" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if sqlSiteName == "" { + return nil, errors.New("parameter sqlSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlSiteName}", url.PathEscape(sqlSiteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + if options != nil && options.Filter != nil { + reqQP.Set("filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("top", *options.Top) + } + if options != nil && options.ContinuationToken != nil { + reqQP.Set("continuationToken", *options.ContinuationToken) + } + if options != nil && options.TotalRecordCount != nil { + reqQP.Set("totalRecordCount", strconv.FormatInt(int64(*options.TotalRecordCount), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySQLSiteHandleResponse handles the ListBySQLSite response. +func (client *SQLAvailabilityGroupsControllerClient) listBySQLSiteHandleResponse(resp *http.Response) (SQLAvailabilityGroupsControllerClientListBySQLSiteResponse, error) { + result := SQLAvailabilityGroupsControllerClientListBySQLSiteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SQLAvailabilityGroupListResult); err != nil { + return SQLAvailabilityGroupsControllerClientListBySQLSiteResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/sqldatabasescontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/sqldatabasescontroller_client.go new file mode 100644 index 000000000000..755b08629612 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/sqldatabasescontroller_client.go @@ -0,0 +1,202 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// SQLDatabasesControllerClient contains the methods for the SQLDatabasesController group. +// Don't use this type directly, use NewSQLDatabasesControllerClient() instead. +type SQLDatabasesControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSQLDatabasesControllerClient creates a new instance of SQLDatabasesControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewSQLDatabasesControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SQLDatabasesControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SQLDatabasesControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Gets the sql Database. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - sqlSiteName - SQL site name. +// - sqlDatabaseName - SQL Database name. +// - options - SQLDatabasesControllerClientGetOptions contains the optional parameters for the SQLDatabasesControllerClient.Get +// method. +func (client *SQLDatabasesControllerClient) Get(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, sqlDatabaseName string, options *SQLDatabasesControllerClientGetOptions) (SQLDatabasesControllerClientGetResponse, error) { + var err error + const operationName = "SQLDatabasesControllerClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, siteName, sqlSiteName, sqlDatabaseName, options) + if err != nil { + return SQLDatabasesControllerClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SQLDatabasesControllerClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SQLDatabasesControllerClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *SQLDatabasesControllerClient) getCreateRequest(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, sqlDatabaseName string, options *SQLDatabasesControllerClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/sqlSites/{sqlSiteName}/sqlDatabases/{sqlDatabaseName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if sqlSiteName == "" { + return nil, errors.New("parameter sqlSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlSiteName}", url.PathEscape(sqlSiteName)) + if sqlDatabaseName == "" { + return nil, errors.New("parameter sqlDatabaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlDatabaseName}", url.PathEscape(sqlDatabaseName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SQLDatabasesControllerClient) getHandleResponse(resp *http.Response) (SQLDatabasesControllerClientGetResponse, error) { + result := SQLDatabasesControllerClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SQLDatabaseV2); err != nil { + return SQLDatabasesControllerClientGetResponse{}, err + } + return result, nil +} + +// NewListBySQLSitePager - Gets the sql Databases. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - sqlSiteName - SQL site name. +// - options - SQLDatabasesControllerClientListBySQLSiteOptions contains the optional parameters for the SQLDatabasesControllerClient.NewListBySQLSitePager +// method. +func (client *SQLDatabasesControllerClient) NewListBySQLSitePager(resourceGroupName string, siteName string, sqlSiteName string, options *SQLDatabasesControllerClientListBySQLSiteOptions) *runtime.Pager[SQLDatabasesControllerClientListBySQLSiteResponse] { + return runtime.NewPager(runtime.PagingHandler[SQLDatabasesControllerClientListBySQLSiteResponse]{ + More: func(page SQLDatabasesControllerClientListBySQLSiteResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SQLDatabasesControllerClientListBySQLSiteResponse) (SQLDatabasesControllerClientListBySQLSiteResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SQLDatabasesControllerClient.NewListBySQLSitePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySQLSiteCreateRequest(ctx, resourceGroupName, siteName, sqlSiteName, options) + }, nil) + if err != nil { + return SQLDatabasesControllerClientListBySQLSiteResponse{}, err + } + return client.listBySQLSiteHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySQLSiteCreateRequest creates the ListBySQLSite request. +func (client *SQLDatabasesControllerClient) listBySQLSiteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, options *SQLDatabasesControllerClientListBySQLSiteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/sqlSites/{sqlSiteName}/sqlDatabases" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if sqlSiteName == "" { + return nil, errors.New("parameter sqlSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlSiteName}", url.PathEscape(sqlSiteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + if options != nil && options.Filter != nil { + reqQP.Set("filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("top", *options.Top) + } + if options != nil && options.ContinuationToken != nil { + reqQP.Set("continuationToken", *options.ContinuationToken) + } + if options != nil && options.TotalRecordCount != nil { + reqQP.Set("totalRecordCount", strconv.FormatInt(int64(*options.TotalRecordCount), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySQLSiteHandleResponse handles the ListBySQLSite response. +func (client *SQLDatabasesControllerClient) listBySQLSiteHandleResponse(resp *http.Response) (SQLDatabasesControllerClientListBySQLSiteResponse, error) { + result := SQLDatabasesControllerClientListBySQLSiteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SQLDatabaseV2ListResult); err != nil { + return SQLDatabasesControllerClientListBySQLSiteResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/sqldiscoverysitedatasourcecontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/sqldiscoverysitedatasourcecontroller_client.go new file mode 100644 index 000000000000..8b62baa6c7a2 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/sqldiscoverysitedatasourcecontroller_client.go @@ -0,0 +1,345 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// SQLDiscoverySiteDataSourceControllerClient contains the methods for the SQLDiscoverySiteDataSourceController group. +// Don't use this type directly, use NewSQLDiscoverySiteDataSourceControllerClient() instead. +type SQLDiscoverySiteDataSourceControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSQLDiscoverySiteDataSourceControllerClient creates a new instance of SQLDiscoverySiteDataSourceControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewSQLDiscoverySiteDataSourceControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SQLDiscoverySiteDataSourceControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SQLDiscoverySiteDataSourceControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreate - Create a SqlDiscoverySiteDataSource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - sqlSiteName - SQL site name. +// - discoverySiteDataSourceName - SQL Discovery site data source name. +// - body - Resource create parameters. +// - options - SQLDiscoverySiteDataSourceControllerClientBeginCreateOptions contains the optional parameters for the SQLDiscoverySiteDataSourceControllerClient.BeginCreate +// method. +func (client *SQLDiscoverySiteDataSourceControllerClient) BeginCreate(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, discoverySiteDataSourceName string, body SQLDiscoverySiteDataSource, options *SQLDiscoverySiteDataSourceControllerClientBeginCreateOptions) (*runtime.Poller[SQLDiscoverySiteDataSourceControllerClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, siteName, sqlSiteName, discoverySiteDataSourceName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SQLDiscoverySiteDataSourceControllerClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SQLDiscoverySiteDataSourceControllerClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Create a SqlDiscoverySiteDataSource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *SQLDiscoverySiteDataSourceControllerClient) create(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, discoverySiteDataSourceName string, body SQLDiscoverySiteDataSource, options *SQLDiscoverySiteDataSourceControllerClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "SQLDiscoverySiteDataSourceControllerClient.BeginCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, siteName, sqlSiteName, discoverySiteDataSourceName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createCreateRequest creates the Create request. +func (client *SQLDiscoverySiteDataSourceControllerClient) createCreateRequest(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, discoverySiteDataSourceName string, body SQLDiscoverySiteDataSource, options *SQLDiscoverySiteDataSourceControllerClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/sqlSites/{sqlSiteName}/discoverySiteDataSources/{discoverySiteDataSourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if sqlSiteName == "" { + return nil, errors.New("parameter sqlSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlSiteName}", url.PathEscape(sqlSiteName)) + if discoverySiteDataSourceName == "" { + return nil, errors.New("parameter discoverySiteDataSourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{discoverySiteDataSourceName}", url.PathEscape(discoverySiteDataSourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// Delete - Delete a SqlDiscoverySiteDataSource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - sqlSiteName - SQL site name. +// - discoverySiteDataSourceName - SQL Discovery site data source name. +// - options - SQLDiscoverySiteDataSourceControllerClientDeleteOptions contains the optional parameters for the SQLDiscoverySiteDataSourceControllerClient.Delete +// method. +func (client *SQLDiscoverySiteDataSourceControllerClient) Delete(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, discoverySiteDataSourceName string, options *SQLDiscoverySiteDataSourceControllerClientDeleteOptions) (SQLDiscoverySiteDataSourceControllerClientDeleteResponse, error) { + var err error + const operationName = "SQLDiscoverySiteDataSourceControllerClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, siteName, sqlSiteName, discoverySiteDataSourceName, options) + if err != nil { + return SQLDiscoverySiteDataSourceControllerClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SQLDiscoverySiteDataSourceControllerClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return SQLDiscoverySiteDataSourceControllerClientDeleteResponse{}, err + } + return SQLDiscoverySiteDataSourceControllerClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *SQLDiscoverySiteDataSourceControllerClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, discoverySiteDataSourceName string, options *SQLDiscoverySiteDataSourceControllerClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/sqlSites/{sqlSiteName}/discoverySiteDataSources/{discoverySiteDataSourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if sqlSiteName == "" { + return nil, errors.New("parameter sqlSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlSiteName}", url.PathEscape(sqlSiteName)) + if discoverySiteDataSourceName == "" { + return nil, errors.New("parameter discoverySiteDataSourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{discoverySiteDataSourceName}", url.PathEscape(discoverySiteDataSourceName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a SqlDiscoverySiteDataSource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - sqlSiteName - SQL site name. +// - discoverySiteDataSourceName - SQL Discovery site data source name. +// - options - SQLDiscoverySiteDataSourceControllerClientGetOptions contains the optional parameters for the SQLDiscoverySiteDataSourceControllerClient.Get +// method. +func (client *SQLDiscoverySiteDataSourceControllerClient) Get(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, discoverySiteDataSourceName string, options *SQLDiscoverySiteDataSourceControllerClientGetOptions) (SQLDiscoverySiteDataSourceControllerClientGetResponse, error) { + var err error + const operationName = "SQLDiscoverySiteDataSourceControllerClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, siteName, sqlSiteName, discoverySiteDataSourceName, options) + if err != nil { + return SQLDiscoverySiteDataSourceControllerClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SQLDiscoverySiteDataSourceControllerClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SQLDiscoverySiteDataSourceControllerClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *SQLDiscoverySiteDataSourceControllerClient) getCreateRequest(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, discoverySiteDataSourceName string, options *SQLDiscoverySiteDataSourceControllerClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/sqlSites/{sqlSiteName}/discoverySiteDataSources/{discoverySiteDataSourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if sqlSiteName == "" { + return nil, errors.New("parameter sqlSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlSiteName}", url.PathEscape(sqlSiteName)) + if discoverySiteDataSourceName == "" { + return nil, errors.New("parameter discoverySiteDataSourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{discoverySiteDataSourceName}", url.PathEscape(discoverySiteDataSourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SQLDiscoverySiteDataSourceControllerClient) getHandleResponse(resp *http.Response) (SQLDiscoverySiteDataSourceControllerClientGetResponse, error) { + result := SQLDiscoverySiteDataSourceControllerClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SQLDiscoverySiteDataSource); err != nil { + return SQLDiscoverySiteDataSourceControllerClientGetResponse{}, err + } + return result, nil +} + +// NewListBySQLSitePager - List SqlDiscoverySiteDataSource resources by SqlSite +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - sqlSiteName - SQL site name. +// - options - SQLDiscoverySiteDataSourceControllerClientListBySQLSiteOptions contains the optional parameters for the SQLDiscoverySiteDataSourceControllerClient.NewListBySQLSitePager +// method. +func (client *SQLDiscoverySiteDataSourceControllerClient) NewListBySQLSitePager(resourceGroupName string, siteName string, sqlSiteName string, options *SQLDiscoverySiteDataSourceControllerClientListBySQLSiteOptions) *runtime.Pager[SQLDiscoverySiteDataSourceControllerClientListBySQLSiteResponse] { + return runtime.NewPager(runtime.PagingHandler[SQLDiscoverySiteDataSourceControllerClientListBySQLSiteResponse]{ + More: func(page SQLDiscoverySiteDataSourceControllerClientListBySQLSiteResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SQLDiscoverySiteDataSourceControllerClientListBySQLSiteResponse) (SQLDiscoverySiteDataSourceControllerClientListBySQLSiteResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SQLDiscoverySiteDataSourceControllerClient.NewListBySQLSitePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySQLSiteCreateRequest(ctx, resourceGroupName, siteName, sqlSiteName, options) + }, nil) + if err != nil { + return SQLDiscoverySiteDataSourceControllerClientListBySQLSiteResponse{}, err + } + return client.listBySQLSiteHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySQLSiteCreateRequest creates the ListBySQLSite request. +func (client *SQLDiscoverySiteDataSourceControllerClient) listBySQLSiteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, options *SQLDiscoverySiteDataSourceControllerClientListBySQLSiteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/sqlSites/{sqlSiteName}/discoverySiteDataSources" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if sqlSiteName == "" { + return nil, errors.New("parameter sqlSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlSiteName}", url.PathEscape(sqlSiteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySQLSiteHandleResponse handles the ListBySQLSite response. +func (client *SQLDiscoverySiteDataSourceControllerClient) listBySQLSiteHandleResponse(resp *http.Response) (SQLDiscoverySiteDataSourceControllerClientListBySQLSiteResponse, error) { + result := SQLDiscoverySiteDataSourceControllerClientListBySQLSiteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SQLDiscoverySiteDataSourceListResult); err != nil { + return SQLDiscoverySiteDataSourceControllerClientListBySQLSiteResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/sqljobscontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/sqljobscontroller_client.go new file mode 100644 index 000000000000..c4c081bd8896 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/sqljobscontroller_client.go @@ -0,0 +1,188 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// SQLJobsControllerClient contains the methods for the SQLJobsController group. +// Don't use this type directly, use NewSQLJobsControllerClient() instead. +type SQLJobsControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSQLJobsControllerClient creates a new instance of SQLJobsControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewSQLJobsControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SQLJobsControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SQLJobsControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get a SqlJob +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - sqlSiteName - SQL site name. +// - jobName - SQL Job name. +// - options - SQLJobsControllerClientGetOptions contains the optional parameters for the SQLJobsControllerClient.Get method. +func (client *SQLJobsControllerClient) Get(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, jobName string, options *SQLJobsControllerClientGetOptions) (SQLJobsControllerClientGetResponse, error) { + var err error + const operationName = "SQLJobsControllerClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, siteName, sqlSiteName, jobName, options) + if err != nil { + return SQLJobsControllerClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SQLJobsControllerClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SQLJobsControllerClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *SQLJobsControllerClient) getCreateRequest(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, jobName string, options *SQLJobsControllerClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/sqlSites/{sqlSiteName}/jobs/{jobName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if sqlSiteName == "" { + return nil, errors.New("parameter sqlSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlSiteName}", url.PathEscape(sqlSiteName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SQLJobsControllerClient) getHandleResponse(resp *http.Response) (SQLJobsControllerClientGetResponse, error) { + result := SQLJobsControllerClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SQLJob); err != nil { + return SQLJobsControllerClientGetResponse{}, err + } + return result, nil +} + +// NewListBySQLSitePager - List SqlJob resources by SqlSite +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - sqlSiteName - SQL site name. +// - options - SQLJobsControllerClientListBySQLSiteOptions contains the optional parameters for the SQLJobsControllerClient.NewListBySQLSitePager +// method. +func (client *SQLJobsControllerClient) NewListBySQLSitePager(resourceGroupName string, siteName string, sqlSiteName string, options *SQLJobsControllerClientListBySQLSiteOptions) *runtime.Pager[SQLJobsControllerClientListBySQLSiteResponse] { + return runtime.NewPager(runtime.PagingHandler[SQLJobsControllerClientListBySQLSiteResponse]{ + More: func(page SQLJobsControllerClientListBySQLSiteResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SQLJobsControllerClientListBySQLSiteResponse) (SQLJobsControllerClientListBySQLSiteResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SQLJobsControllerClient.NewListBySQLSitePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySQLSiteCreateRequest(ctx, resourceGroupName, siteName, sqlSiteName, options) + }, nil) + if err != nil { + return SQLJobsControllerClientListBySQLSiteResponse{}, err + } + return client.listBySQLSiteHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySQLSiteCreateRequest creates the ListBySQLSite request. +func (client *SQLJobsControllerClient) listBySQLSiteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, options *SQLJobsControllerClientListBySQLSiteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/sqlSites/{sqlSiteName}/jobs" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if sqlSiteName == "" { + return nil, errors.New("parameter sqlSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlSiteName}", url.PathEscape(sqlSiteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySQLSiteHandleResponse handles the ListBySQLSite response. +func (client *SQLJobsControllerClient) listBySQLSiteHandleResponse(resp *http.Response) (SQLJobsControllerClientListBySQLSiteResponse, error) { + result := SQLJobsControllerClientListBySQLSiteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SQLJobListResult); err != nil { + return SQLJobsControllerClientListBySQLSiteResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/sqloperationsstatuscontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/sqloperationsstatuscontroller_client.go new file mode 100644 index 000000000000..3f214eff616e --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/sqloperationsstatuscontroller_client.go @@ -0,0 +1,119 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// SQLOperationsStatusControllerClient contains the methods for the SQLOperationsStatusController group. +// Don't use this type directly, use NewSQLOperationsStatusControllerClient() instead. +type SQLOperationsStatusControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSQLOperationsStatusControllerClient creates a new instance of SQLOperationsStatusControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewSQLOperationsStatusControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SQLOperationsStatusControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SQLOperationsStatusControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// GetSQLOperationStatus - Method to get operation status. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - sqlSiteName - SQL site name. +// - operationStatusName - Operation status Arm Name. +// - options - SQLOperationsStatusControllerClientGetSQLOperationStatusOptions contains the optional parameters for the SQLOperationsStatusControllerClient.GetSQLOperationStatus +// method. +func (client *SQLOperationsStatusControllerClient) GetSQLOperationStatus(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, operationStatusName string, options *SQLOperationsStatusControllerClientGetSQLOperationStatusOptions) (SQLOperationsStatusControllerClientGetSQLOperationStatusResponse, error) { + var err error + const operationName = "SQLOperationsStatusControllerClient.GetSQLOperationStatus" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getSQLOperationStatusCreateRequest(ctx, resourceGroupName, siteName, sqlSiteName, operationStatusName, options) + if err != nil { + return SQLOperationsStatusControllerClientGetSQLOperationStatusResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SQLOperationsStatusControllerClientGetSQLOperationStatusResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SQLOperationsStatusControllerClientGetSQLOperationStatusResponse{}, err + } + resp, err := client.getSQLOperationStatusHandleResponse(httpResp) + return resp, err +} + +// getSQLOperationStatusCreateRequest creates the GetSQLOperationStatus request. +func (client *SQLOperationsStatusControllerClient) getSQLOperationStatusCreateRequest(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, operationStatusName string, options *SQLOperationsStatusControllerClientGetSQLOperationStatusOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/sqlSites/{sqlSiteName}/operationsStatus/{operationStatusName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if sqlSiteName == "" { + return nil, errors.New("parameter sqlSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlSiteName}", url.PathEscape(sqlSiteName)) + if operationStatusName == "" { + return nil, errors.New("parameter operationStatusName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{operationStatusName}", url.PathEscape(operationStatusName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getSQLOperationStatusHandleResponse handles the GetSQLOperationStatus response. +func (client *SQLOperationsStatusControllerClient) getSQLOperationStatusHandleResponse(resp *http.Response) (SQLOperationsStatusControllerClientGetSQLOperationStatusResponse, error) { + result := SQLOperationsStatusControllerClientGetSQLOperationStatusResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { + return SQLOperationsStatusControllerClientGetSQLOperationStatusResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/sqlrunasaccountscontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/sqlrunasaccountscontroller_client.go new file mode 100644 index 000000000000..8b08e19a5d24 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/sqlrunasaccountscontroller_client.go @@ -0,0 +1,189 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// SQLRunAsAccountsControllerClient contains the methods for the SQLRunAsAccountsController group. +// Don't use this type directly, use NewSQLRunAsAccountsControllerClient() instead. +type SQLRunAsAccountsControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSQLRunAsAccountsControllerClient creates a new instance of SQLRunAsAccountsControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewSQLRunAsAccountsControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SQLRunAsAccountsControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SQLRunAsAccountsControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get a SqlRunAsAccount +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - sqlSiteName - SQL site name. +// - accountName - SQL RunAsAccounts name +// - options - SQLRunAsAccountsControllerClientGetOptions contains the optional parameters for the SQLRunAsAccountsControllerClient.Get +// method. +func (client *SQLRunAsAccountsControllerClient) Get(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, accountName string, options *SQLRunAsAccountsControllerClientGetOptions) (SQLRunAsAccountsControllerClientGetResponse, error) { + var err error + const operationName = "SQLRunAsAccountsControllerClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, siteName, sqlSiteName, accountName, options) + if err != nil { + return SQLRunAsAccountsControllerClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SQLRunAsAccountsControllerClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SQLRunAsAccountsControllerClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *SQLRunAsAccountsControllerClient) getCreateRequest(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, accountName string, options *SQLRunAsAccountsControllerClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/sqlSites/{sqlSiteName}/runAsAccounts/{accountName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if sqlSiteName == "" { + return nil, errors.New("parameter sqlSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlSiteName}", url.PathEscape(sqlSiteName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SQLRunAsAccountsControllerClient) getHandleResponse(resp *http.Response) (SQLRunAsAccountsControllerClientGetResponse, error) { + result := SQLRunAsAccountsControllerClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SQLRunAsAccount); err != nil { + return SQLRunAsAccountsControllerClientGetResponse{}, err + } + return result, nil +} + +// NewListBySQLSitePager - List SqlRunAsAccount resources by SqlSite +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - sqlSiteName - SQL site name. +// - options - SQLRunAsAccountsControllerClientListBySQLSiteOptions contains the optional parameters for the SQLRunAsAccountsControllerClient.NewListBySQLSitePager +// method. +func (client *SQLRunAsAccountsControllerClient) NewListBySQLSitePager(resourceGroupName string, siteName string, sqlSiteName string, options *SQLRunAsAccountsControllerClientListBySQLSiteOptions) *runtime.Pager[SQLRunAsAccountsControllerClientListBySQLSiteResponse] { + return runtime.NewPager(runtime.PagingHandler[SQLRunAsAccountsControllerClientListBySQLSiteResponse]{ + More: func(page SQLRunAsAccountsControllerClientListBySQLSiteResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SQLRunAsAccountsControllerClientListBySQLSiteResponse) (SQLRunAsAccountsControllerClientListBySQLSiteResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SQLRunAsAccountsControllerClient.NewListBySQLSitePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySQLSiteCreateRequest(ctx, resourceGroupName, siteName, sqlSiteName, options) + }, nil) + if err != nil { + return SQLRunAsAccountsControllerClientListBySQLSiteResponse{}, err + } + return client.listBySQLSiteHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySQLSiteCreateRequest creates the ListBySQLSite request. +func (client *SQLRunAsAccountsControllerClient) listBySQLSiteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, options *SQLRunAsAccountsControllerClientListBySQLSiteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/sqlSites/{sqlSiteName}/runAsAccounts" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if sqlSiteName == "" { + return nil, errors.New("parameter sqlSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlSiteName}", url.PathEscape(sqlSiteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySQLSiteHandleResponse handles the ListBySQLSite response. +func (client *SQLRunAsAccountsControllerClient) listBySQLSiteHandleResponse(resp *http.Response) (SQLRunAsAccountsControllerClientListBySQLSiteResponse, error) { + result := SQLRunAsAccountsControllerClientListBySQLSiteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SQLRunAsAccountListResult); err != nil { + return SQLRunAsAccountsControllerClientListBySQLSiteResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/sqlserverscontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/sqlserverscontroller_client.go new file mode 100644 index 000000000000..8abe9818e663 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/sqlserverscontroller_client.go @@ -0,0 +1,281 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// SQLServersControllerClient contains the methods for the SQLServersController group. +// Don't use this type directly, use NewSQLServersControllerClient() instead. +type SQLServersControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSQLServersControllerClient creates a new instance of SQLServersControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewSQLServersControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SQLServersControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SQLServersControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Gets the sql server. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - sqlSiteName - SQL site name. +// - sqlServerName - SQL server name. +// - options - SQLServersControllerClientGetOptions contains the optional parameters for the SQLServersControllerClient.Get +// method. +func (client *SQLServersControllerClient) Get(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, sqlServerName string, options *SQLServersControllerClientGetOptions) (SQLServersControllerClientGetResponse, error) { + var err error + const operationName = "SQLServersControllerClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, siteName, sqlSiteName, sqlServerName, options) + if err != nil { + return SQLServersControllerClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SQLServersControllerClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SQLServersControllerClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *SQLServersControllerClient) getCreateRequest(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, sqlServerName string, options *SQLServersControllerClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/sqlSites/{sqlSiteName}/sqlServers/{sqlServerName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if sqlSiteName == "" { + return nil, errors.New("parameter sqlSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlSiteName}", url.PathEscape(sqlSiteName)) + if sqlServerName == "" { + return nil, errors.New("parameter sqlServerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlServerName}", url.PathEscape(sqlServerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SQLServersControllerClient) getHandleResponse(resp *http.Response) (SQLServersControllerClientGetResponse, error) { + result := SQLServersControllerClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SQLServerV2); err != nil { + return SQLServersControllerClientGetResponse{}, err + } + return result, nil +} + +// NewListBySQLSitePager - Gets the sql servers. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - sqlSiteName - SQL site name. +// - options - SQLServersControllerClientListBySQLSiteOptions contains the optional parameters for the SQLServersControllerClient.NewListBySQLSitePager +// method. +func (client *SQLServersControllerClient) NewListBySQLSitePager(resourceGroupName string, siteName string, sqlSiteName string, options *SQLServersControllerClientListBySQLSiteOptions) *runtime.Pager[SQLServersControllerClientListBySQLSiteResponse] { + return runtime.NewPager(runtime.PagingHandler[SQLServersControllerClientListBySQLSiteResponse]{ + More: func(page SQLServersControllerClientListBySQLSiteResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SQLServersControllerClientListBySQLSiteResponse) (SQLServersControllerClientListBySQLSiteResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SQLServersControllerClient.NewListBySQLSitePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySQLSiteCreateRequest(ctx, resourceGroupName, siteName, sqlSiteName, options) + }, nil) + if err != nil { + return SQLServersControllerClientListBySQLSiteResponse{}, err + } + return client.listBySQLSiteHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySQLSiteCreateRequest creates the ListBySQLSite request. +func (client *SQLServersControllerClient) listBySQLSiteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, options *SQLServersControllerClientListBySQLSiteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/sqlSites/{sqlSiteName}/sqlServers" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if sqlSiteName == "" { + return nil, errors.New("parameter sqlSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlSiteName}", url.PathEscape(sqlSiteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + if options != nil && options.Filter != nil { + reqQP.Set("filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("top", *options.Top) + } + if options != nil && options.ContinuationToken != nil { + reqQP.Set("continuationToken", *options.ContinuationToken) + } + if options != nil && options.TotalRecordCount != nil { + reqQP.Set("totalRecordCount", strconv.FormatInt(int64(*options.TotalRecordCount), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySQLSiteHandleResponse handles the ListBySQLSite response. +func (client *SQLServersControllerClient) listBySQLSiteHandleResponse(resp *http.Response) (SQLServersControllerClientListBySQLSiteResponse, error) { + result := SQLServersControllerClientListBySQLSiteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SQLServerV2ListResult); err != nil { + return SQLServersControllerClientListBySQLSiteResponse{}, err + } + return result, nil +} + +// Update - Updates the sql server tags. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - sqlSiteName - SQL site name. +// - sqlServerName - SQL server name. +// - body - The resource properties to be updated. +// - options - SQLServersControllerClientUpdateOptions contains the optional parameters for the SQLServersControllerClient.Update +// method. +func (client *SQLServersControllerClient) Update(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, sqlServerName string, body SQLServerV2Update, options *SQLServersControllerClientUpdateOptions) (SQLServersControllerClientUpdateResponse, error) { + var err error + const operationName = "SQLServersControllerClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, siteName, sqlSiteName, sqlServerName, body, options) + if err != nil { + return SQLServersControllerClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SQLServersControllerClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SQLServersControllerClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *SQLServersControllerClient) updateCreateRequest(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, sqlServerName string, body SQLServerV2Update, options *SQLServersControllerClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/sqlSites/{sqlSiteName}/sqlServers/{sqlServerName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if sqlSiteName == "" { + return nil, errors.New("parameter sqlSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlSiteName}", url.PathEscape(sqlSiteName)) + if sqlServerName == "" { + return nil, errors.New("parameter sqlServerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlServerName}", url.PathEscape(sqlServerName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *SQLServersControllerClient) updateHandleResponse(resp *http.Response) (SQLServersControllerClientUpdateResponse, error) { + result := SQLServersControllerClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SQLServerV2); err != nil { + return SQLServersControllerClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/sqlsitescontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/sqlsitescontroller_client.go new file mode 100644 index 000000000000..271ef057eba9 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/sqlsitescontroller_client.go @@ -0,0 +1,809 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// SQLSitesControllerClient contains the methods for the SQLSitesController group. +// Don't use this type directly, use NewSQLSitesControllerClient() instead. +type SQLSitesControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSQLSitesControllerClient creates a new instance of SQLSitesControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewSQLSitesControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SQLSitesControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SQLSitesControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Create - Method to create a SQL site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - sqlSiteName - SQL site name. +// - body - Resource create parameters. +// - options - SQLSitesControllerClientCreateOptions contains the optional parameters for the SQLSitesControllerClient.Create +// method. +func (client *SQLSitesControllerClient) Create(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, body SQLSite, options *SQLSitesControllerClientCreateOptions) (SQLSitesControllerClientCreateResponse, error) { + var err error + const operationName = "SQLSitesControllerClient.Create" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, siteName, sqlSiteName, body, options) + if err != nil { + return SQLSitesControllerClientCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SQLSitesControllerClientCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return SQLSitesControllerClientCreateResponse{}, err + } + resp, err := client.createHandleResponse(httpResp) + return resp, err +} + +// createCreateRequest creates the Create request. +func (client *SQLSitesControllerClient) createCreateRequest(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, body SQLSite, options *SQLSitesControllerClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/sqlSites/{sqlSiteName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if sqlSiteName == "" { + return nil, errors.New("parameter sqlSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlSiteName}", url.PathEscape(sqlSiteName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *SQLSitesControllerClient) createHandleResponse(resp *http.Response) (SQLSitesControllerClientCreateResponse, error) { + result := SQLSitesControllerClientCreateResponse{} + if val := resp.Header.Get("Retry-After"); val != "" { + retryAfter32, err := strconv.ParseInt(val, 10, 32) + retryAfter := int32(retryAfter32) + if err != nil { + return SQLSitesControllerClientCreateResponse{}, err + } + result.RetryAfter = &retryAfter + } + if err := runtime.UnmarshalAsJSON(resp, &result.SQLSite); err != nil { + return SQLSitesControllerClientCreateResponse{}, err + } + return result, nil +} + +// Delete - Deletes the SQL site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - sqlSiteName - SQL site name. +// - options - SQLSitesControllerClientDeleteOptions contains the optional parameters for the SQLSitesControllerClient.Delete +// method. +func (client *SQLSitesControllerClient) Delete(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, options *SQLSitesControllerClientDeleteOptions) (SQLSitesControllerClientDeleteResponse, error) { + var err error + const operationName = "SQLSitesControllerClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, siteName, sqlSiteName, options) + if err != nil { + return SQLSitesControllerClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SQLSitesControllerClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return SQLSitesControllerClientDeleteResponse{}, err + } + return SQLSitesControllerClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *SQLSitesControllerClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, options *SQLSitesControllerClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/sqlSites/{sqlSiteName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if sqlSiteName == "" { + return nil, errors.New("parameter sqlSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlSiteName}", url.PathEscape(sqlSiteName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// ErrorSummary - Method to get error summary from SQL site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - sqlSiteName - SQL site name. +// - body - The content of the action request +// - options - SQLSitesControllerClientErrorSummaryOptions contains the optional parameters for the SQLSitesControllerClient.ErrorSummary +// method. +func (client *SQLSitesControllerClient) ErrorSummary(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, body ErrorSummaryRequest, options *SQLSitesControllerClientErrorSummaryOptions) (SQLSitesControllerClientErrorSummaryResponse, error) { + var err error + const operationName = "SQLSitesControllerClient.ErrorSummary" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.errorSummaryCreateRequest(ctx, resourceGroupName, siteName, sqlSiteName, body, options) + if err != nil { + return SQLSitesControllerClientErrorSummaryResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SQLSitesControllerClientErrorSummaryResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SQLSitesControllerClientErrorSummaryResponse{}, err + } + resp, err := client.errorSummaryHandleResponse(httpResp) + return resp, err +} + +// errorSummaryCreateRequest creates the ErrorSummary request. +func (client *SQLSitesControllerClient) errorSummaryCreateRequest(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, body ErrorSummaryRequest, options *SQLSitesControllerClientErrorSummaryOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/sqlSites/{sqlSiteName}/errorSummary" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if sqlSiteName == "" { + return nil, errors.New("parameter sqlSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlSiteName}", url.PathEscape(sqlSiteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// errorSummaryHandleResponse handles the ErrorSummary response. +func (client *SQLSitesControllerClient) errorSummaryHandleResponse(resp *http.Response) (SQLSitesControllerClientErrorSummaryResponse, error) { + result := SQLSitesControllerClientErrorSummaryResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SiteErrorSummary); err != nil { + return SQLSitesControllerClientErrorSummaryResponse{}, err + } + return result, nil +} + +// BeginExportSQLServerErrors - Method to generate report containing SQL servers. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - sqlSiteName - SQL site name. +// - body - The content of the action request +// - options - SQLSitesControllerClientBeginExportSQLServerErrorsOptions contains the optional parameters for the SQLSitesControllerClient.BeginExportSQLServerErrors +// method. +func (client *SQLSitesControllerClient) BeginExportSQLServerErrors(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, body any, options *SQLSitesControllerClientBeginExportSQLServerErrorsOptions) (*runtime.Poller[SQLSitesControllerClientExportSQLServerErrorsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.exportSQLServerErrors(ctx, resourceGroupName, siteName, sqlSiteName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SQLSitesControllerClientExportSQLServerErrorsResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SQLSitesControllerClientExportSQLServerErrorsResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ExportSQLServerErrors - Method to generate report containing SQL servers. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *SQLSitesControllerClient) exportSQLServerErrors(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, body any, options *SQLSitesControllerClientBeginExportSQLServerErrorsOptions) (*http.Response, error) { + var err error + const operationName = "SQLSitesControllerClient.BeginExportSQLServerErrors" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.exportSQLServerErrorsCreateRequest(ctx, resourceGroupName, siteName, sqlSiteName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// exportSQLServerErrorsCreateRequest creates the ExportSQLServerErrors request. +func (client *SQLSitesControllerClient) exportSQLServerErrorsCreateRequest(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, body any, options *SQLSitesControllerClientBeginExportSQLServerErrorsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/sqlSites/{sqlSiteName}/exportSqlServerErrors" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if sqlSiteName == "" { + return nil, errors.New("parameter sqlSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlSiteName}", url.PathEscape(sqlSiteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// BeginExportSQLServers - Method to generate report containing SQL servers. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - sqlSiteName - SQL site name. +// - body - The content of the action request +// - options - SQLSitesControllerClientBeginExportSQLServersOptions contains the optional parameters for the SQLSitesControllerClient.BeginExportSQLServers +// method. +func (client *SQLSitesControllerClient) BeginExportSQLServers(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, body ExportSQLServersRequest, options *SQLSitesControllerClientBeginExportSQLServersOptions) (*runtime.Poller[SQLSitesControllerClientExportSQLServersResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.exportSQLServers(ctx, resourceGroupName, siteName, sqlSiteName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SQLSitesControllerClientExportSQLServersResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SQLSitesControllerClientExportSQLServersResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ExportSQLServers - Method to generate report containing SQL servers. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *SQLSitesControllerClient) exportSQLServers(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, body ExportSQLServersRequest, options *SQLSitesControllerClientBeginExportSQLServersOptions) (*http.Response, error) { + var err error + const operationName = "SQLSitesControllerClient.BeginExportSQLServers" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.exportSQLServersCreateRequest(ctx, resourceGroupName, siteName, sqlSiteName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// exportSQLServersCreateRequest creates the ExportSQLServers request. +func (client *SQLSitesControllerClient) exportSQLServersCreateRequest(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, body ExportSQLServersRequest, options *SQLSitesControllerClientBeginExportSQLServersOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/sqlSites/{sqlSiteName}/exportSqlServers" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if sqlSiteName == "" { + return nil, errors.New("parameter sqlSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlSiteName}", url.PathEscape(sqlSiteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// Get - Method to get a site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - sqlSiteName - SQL site name. +// - options - SQLSitesControllerClientGetOptions contains the optional parameters for the SQLSitesControllerClient.Get method. +func (client *SQLSitesControllerClient) Get(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, options *SQLSitesControllerClientGetOptions) (SQLSitesControllerClientGetResponse, error) { + var err error + const operationName = "SQLSitesControllerClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, siteName, sqlSiteName, options) + if err != nil { + return SQLSitesControllerClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SQLSitesControllerClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SQLSitesControllerClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *SQLSitesControllerClient) getCreateRequest(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, options *SQLSitesControllerClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/sqlSites/{sqlSiteName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if sqlSiteName == "" { + return nil, errors.New("parameter sqlSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlSiteName}", url.PathEscape(sqlSiteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SQLSitesControllerClient) getHandleResponse(resp *http.Response) (SQLSitesControllerClientGetResponse, error) { + result := SQLSitesControllerClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SQLSite); err != nil { + return SQLSitesControllerClientGetResponse{}, err + } + return result, nil +} + +// NewListByMasterSitePager - Method to get all sites. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - options - SQLSitesControllerClientListByMasterSiteOptions contains the optional parameters for the SQLSitesControllerClient.NewListByMasterSitePager +// method. +func (client *SQLSitesControllerClient) NewListByMasterSitePager(resourceGroupName string, siteName string, options *SQLSitesControllerClientListByMasterSiteOptions) *runtime.Pager[SQLSitesControllerClientListByMasterSiteResponse] { + return runtime.NewPager(runtime.PagingHandler[SQLSitesControllerClientListByMasterSiteResponse]{ + More: func(page SQLSitesControllerClientListByMasterSiteResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SQLSitesControllerClientListByMasterSiteResponse) (SQLSitesControllerClientListByMasterSiteResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SQLSitesControllerClient.NewListByMasterSitePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByMasterSiteCreateRequest(ctx, resourceGroupName, siteName, options) + }, nil) + if err != nil { + return SQLSitesControllerClientListByMasterSiteResponse{}, err + } + return client.listByMasterSiteHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByMasterSiteCreateRequest creates the ListByMasterSite request. +func (client *SQLSitesControllerClient) listByMasterSiteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *SQLSitesControllerClientListByMasterSiteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/sqlSites" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByMasterSiteHandleResponse handles the ListByMasterSite response. +func (client *SQLSitesControllerClient) listByMasterSiteHandleResponse(resp *http.Response) (SQLSitesControllerClientListByMasterSiteResponse, error) { + result := SQLSitesControllerClientListByMasterSiteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SQLSiteListResult); err != nil { + return SQLSitesControllerClientListByMasterSiteResponse{}, err + } + return result, nil +} + +// BeginRefresh - Method to refresh a site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - sqlSiteName - SQL site name. +// - body - The content of the action request +// - options - SQLSitesControllerClientBeginRefreshOptions contains the optional parameters for the SQLSitesControllerClient.BeginRefresh +// method. +func (client *SQLSitesControllerClient) BeginRefresh(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, body SQLSiteRefreshBody, options *SQLSitesControllerClientBeginRefreshOptions) (*runtime.Poller[SQLSitesControllerClientRefreshResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.refresh(ctx, resourceGroupName, siteName, sqlSiteName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SQLSitesControllerClientRefreshResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SQLSitesControllerClientRefreshResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Refresh - Method to refresh a site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *SQLSitesControllerClient) refresh(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, body SQLSiteRefreshBody, options *SQLSitesControllerClientBeginRefreshOptions) (*http.Response, error) { + var err error + const operationName = "SQLSitesControllerClient.BeginRefresh" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.refreshCreateRequest(ctx, resourceGroupName, siteName, sqlSiteName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// refreshCreateRequest creates the Refresh request. +func (client *SQLSitesControllerClient) refreshCreateRequest(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, body SQLSiteRefreshBody, options *SQLSitesControllerClientBeginRefreshOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/sqlSites/{sqlSiteName}/refresh" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if sqlSiteName == "" { + return nil, errors.New("parameter sqlSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlSiteName}", url.PathEscape(sqlSiteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// Summary - Method to get site usage/summary. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - sqlSiteName - SQL site name. +// - options - SQLSitesControllerClientSummaryOptions contains the optional parameters for the SQLSitesControllerClient.Summary +// method. +func (client *SQLSitesControllerClient) Summary(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, options *SQLSitesControllerClientSummaryOptions) (SQLSitesControllerClientSummaryResponse, error) { + var err error + const operationName = "SQLSitesControllerClient.Summary" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.summaryCreateRequest(ctx, resourceGroupName, siteName, sqlSiteName, options) + if err != nil { + return SQLSitesControllerClientSummaryResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SQLSitesControllerClientSummaryResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SQLSitesControllerClientSummaryResponse{}, err + } + resp, err := client.summaryHandleResponse(httpResp) + return resp, err +} + +// summaryCreateRequest creates the Summary request. +func (client *SQLSitesControllerClient) summaryCreateRequest(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, options *SQLSitesControllerClientSummaryOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/sqlSites/{sqlSiteName}/summary" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if sqlSiteName == "" { + return nil, errors.New("parameter sqlSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlSiteName}", url.PathEscape(sqlSiteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// summaryHandleResponse handles the Summary response. +func (client *SQLSitesControllerClient) summaryHandleResponse(resp *http.Response) (SQLSitesControllerClientSummaryResponse, error) { + result := SQLSitesControllerClientSummaryResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SQLSiteUsage); err != nil { + return SQLSitesControllerClientSummaryResponse{}, err + } + return result, nil +} + +// BeginUpdate - Method to update an existing site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - sqlSiteName - SQL site name. +// - properties - The resource properties to be updated. +// - options - SQLSitesControllerClientBeginUpdateOptions contains the optional parameters for the SQLSitesControllerClient.BeginUpdate +// method. +func (client *SQLSitesControllerClient) BeginUpdate(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, properties SQLSiteUpdate, options *SQLSitesControllerClientBeginUpdateOptions) (*runtime.Poller[SQLSitesControllerClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, siteName, sqlSiteName, properties, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SQLSitesControllerClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SQLSitesControllerClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Method to update an existing site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *SQLSitesControllerClient) update(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, properties SQLSiteUpdate, options *SQLSitesControllerClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "SQLSitesControllerClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, siteName, sqlSiteName, properties, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *SQLSitesControllerClient) updateCreateRequest(ctx context.Context, resourceGroupName string, siteName string, sqlSiteName string, properties SQLSiteUpdate, options *SQLSitesControllerClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/sqlSites/{sqlSiteName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if sqlSiteName == "" { + return nil, errors.New("parameter sqlSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlSiteName}", url.PathEscape(sqlSiteName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/tomcatwebapplicationscontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/tomcatwebapplicationscontroller_client.go new file mode 100644 index 000000000000..3792dcb18da0 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/tomcatwebapplicationscontroller_client.go @@ -0,0 +1,281 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// TomcatWebApplicationsControllerClient contains the methods for the TomcatWebApplicationsController group. +// Don't use this type directly, use NewTomcatWebApplicationsControllerClient() instead. +type TomcatWebApplicationsControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewTomcatWebApplicationsControllerClient creates a new instance of TomcatWebApplicationsControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewTomcatWebApplicationsControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TomcatWebApplicationsControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &TomcatWebApplicationsControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Method to get an Tomcat web application. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - webAppSiteName - Web app site name. +// - webApplicationName - Web application name. +// - options - TomcatWebApplicationsControllerClientGetOptions contains the optional parameters for the TomcatWebApplicationsControllerClient.Get +// method. +func (client *TomcatWebApplicationsControllerClient) Get(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, webApplicationName string, options *TomcatWebApplicationsControllerClientGetOptions) (TomcatWebApplicationsControllerClientGetResponse, error) { + var err error + const operationName = "TomcatWebApplicationsControllerClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, siteName, webAppSiteName, webApplicationName, options) + if err != nil { + return TomcatWebApplicationsControllerClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TomcatWebApplicationsControllerClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TomcatWebApplicationsControllerClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *TomcatWebApplicationsControllerClient) getCreateRequest(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, webApplicationName string, options *TomcatWebApplicationsControllerClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/webAppSites/{webAppSiteName}/tomcatWebApplications/{webApplicationName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if webAppSiteName == "" { + return nil, errors.New("parameter webAppSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{webAppSiteName}", url.PathEscape(webAppSiteName)) + if webApplicationName == "" { + return nil, errors.New("parameter webApplicationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{webApplicationName}", url.PathEscape(webApplicationName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *TomcatWebApplicationsControllerClient) getHandleResponse(resp *http.Response) (TomcatWebApplicationsControllerClientGetResponse, error) { + result := TomcatWebApplicationsControllerClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TomcatWebApplications); err != nil { + return TomcatWebApplicationsControllerClientGetResponse{}, err + } + return result, nil +} + +// NewListByWebAppSitePager - Method to get all Tomcat web application. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - webAppSiteName - Web app site name. +// - options - TomcatWebApplicationsControllerClientListByWebAppSiteOptions contains the optional parameters for the TomcatWebApplicationsControllerClient.NewListByWebAppSitePager +// method. +func (client *TomcatWebApplicationsControllerClient) NewListByWebAppSitePager(resourceGroupName string, siteName string, webAppSiteName string, options *TomcatWebApplicationsControllerClientListByWebAppSiteOptions) *runtime.Pager[TomcatWebApplicationsControllerClientListByWebAppSiteResponse] { + return runtime.NewPager(runtime.PagingHandler[TomcatWebApplicationsControllerClientListByWebAppSiteResponse]{ + More: func(page TomcatWebApplicationsControllerClientListByWebAppSiteResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *TomcatWebApplicationsControllerClientListByWebAppSiteResponse) (TomcatWebApplicationsControllerClientListByWebAppSiteResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "TomcatWebApplicationsControllerClient.NewListByWebAppSitePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByWebAppSiteCreateRequest(ctx, resourceGroupName, siteName, webAppSiteName, options) + }, nil) + if err != nil { + return TomcatWebApplicationsControllerClientListByWebAppSiteResponse{}, err + } + return client.listByWebAppSiteHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByWebAppSiteCreateRequest creates the ListByWebAppSite request. +func (client *TomcatWebApplicationsControllerClient) listByWebAppSiteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, options *TomcatWebApplicationsControllerClientListByWebAppSiteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/webAppSites/{webAppSiteName}/tomcatWebApplications" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if webAppSiteName == "" { + return nil, errors.New("parameter webAppSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{webAppSiteName}", url.PathEscape(webAppSiteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + if options != nil && options.Filter != nil { + reqQP.Set("filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("top", *options.Top) + } + if options != nil && options.ContinuationToken != nil { + reqQP.Set("continuationToken", *options.ContinuationToken) + } + if options != nil && options.TotalRecordCount != nil { + reqQP.Set("totalRecordCount", strconv.FormatInt(int64(*options.TotalRecordCount), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByWebAppSiteHandleResponse handles the ListByWebAppSite response. +func (client *TomcatWebApplicationsControllerClient) listByWebAppSiteHandleResponse(resp *http.Response) (TomcatWebApplicationsControllerClientListByWebAppSiteResponse, error) { + result := TomcatWebApplicationsControllerClientListByWebAppSiteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TomcatWebApplicationsListResult); err != nil { + return TomcatWebApplicationsControllerClientListByWebAppSiteResponse{}, err + } + return result, nil +} + +// Update - Updates the Tomcat web application tags. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - webAppSiteName - Web app site name. +// - webApplicationName - Web application name. +// - body - The resource properties to be updated. +// - options - TomcatWebApplicationsControllerClientUpdateOptions contains the optional parameters for the TomcatWebApplicationsControllerClient.Update +// method. +func (client *TomcatWebApplicationsControllerClient) Update(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, webApplicationName string, body any, options *TomcatWebApplicationsControllerClientUpdateOptions) (TomcatWebApplicationsControllerClientUpdateResponse, error) { + var err error + const operationName = "TomcatWebApplicationsControllerClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, siteName, webAppSiteName, webApplicationName, body, options) + if err != nil { + return TomcatWebApplicationsControllerClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TomcatWebApplicationsControllerClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TomcatWebApplicationsControllerClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *TomcatWebApplicationsControllerClient) updateCreateRequest(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, webApplicationName string, body any, options *TomcatWebApplicationsControllerClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/webAppSites/{webAppSiteName}/tomcatWebApplications/{webApplicationName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if webAppSiteName == "" { + return nil, errors.New("parameter webAppSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{webAppSiteName}", url.PathEscape(webAppSiteName)) + if webApplicationName == "" { + return nil, errors.New("parameter webApplicationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{webApplicationName}", url.PathEscape(webApplicationName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *TomcatWebApplicationsControllerClient) updateHandleResponse(resp *http.Response) (TomcatWebApplicationsControllerClientUpdateResponse, error) { + result := TomcatWebApplicationsControllerClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TomcatWebApplications); err != nil { + return TomcatWebApplicationsControllerClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/tomcatwebserverscontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/tomcatwebserverscontroller_client.go new file mode 100644 index 000000000000..f93395f9f696 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/tomcatwebserverscontroller_client.go @@ -0,0 +1,202 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// TomcatWebServersControllerClient contains the methods for the TomcatWebServersController group. +// Don't use this type directly, use NewTomcatWebServersControllerClient() instead. +type TomcatWebServersControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewTomcatWebServersControllerClient creates a new instance of TomcatWebServersControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewTomcatWebServersControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TomcatWebServersControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &TomcatWebServersControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Method to get an Tomcat web server. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - webAppSiteName - Web app site name. +// - webServerName - Web server name. +// - options - TomcatWebServersControllerClientGetOptions contains the optional parameters for the TomcatWebServersControllerClient.Get +// method. +func (client *TomcatWebServersControllerClient) Get(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, webServerName string, options *TomcatWebServersControllerClientGetOptions) (TomcatWebServersControllerClientGetResponse, error) { + var err error + const operationName = "TomcatWebServersControllerClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, siteName, webAppSiteName, webServerName, options) + if err != nil { + return TomcatWebServersControllerClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TomcatWebServersControllerClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TomcatWebServersControllerClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *TomcatWebServersControllerClient) getCreateRequest(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, webServerName string, options *TomcatWebServersControllerClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/webAppSites/{webAppSiteName}/tomcatWebServers/{webServerName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if webAppSiteName == "" { + return nil, errors.New("parameter webAppSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{webAppSiteName}", url.PathEscape(webAppSiteName)) + if webServerName == "" { + return nil, errors.New("parameter webServerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{webServerName}", url.PathEscape(webServerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *TomcatWebServersControllerClient) getHandleResponse(resp *http.Response) (TomcatWebServersControllerClientGetResponse, error) { + result := TomcatWebServersControllerClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TomcatWebServers); err != nil { + return TomcatWebServersControllerClientGetResponse{}, err + } + return result, nil +} + +// NewListByWebAppSitePager - Method to get all Tomcat web servers. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - webAppSiteName - Web app site name. +// - options - TomcatWebServersControllerClientListByWebAppSiteOptions contains the optional parameters for the TomcatWebServersControllerClient.NewListByWebAppSitePager +// method. +func (client *TomcatWebServersControllerClient) NewListByWebAppSitePager(resourceGroupName string, siteName string, webAppSiteName string, options *TomcatWebServersControllerClientListByWebAppSiteOptions) *runtime.Pager[TomcatWebServersControllerClientListByWebAppSiteResponse] { + return runtime.NewPager(runtime.PagingHandler[TomcatWebServersControllerClientListByWebAppSiteResponse]{ + More: func(page TomcatWebServersControllerClientListByWebAppSiteResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *TomcatWebServersControllerClientListByWebAppSiteResponse) (TomcatWebServersControllerClientListByWebAppSiteResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "TomcatWebServersControllerClient.NewListByWebAppSitePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByWebAppSiteCreateRequest(ctx, resourceGroupName, siteName, webAppSiteName, options) + }, nil) + if err != nil { + return TomcatWebServersControllerClientListByWebAppSiteResponse{}, err + } + return client.listByWebAppSiteHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByWebAppSiteCreateRequest creates the ListByWebAppSite request. +func (client *TomcatWebServersControllerClient) listByWebAppSiteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, options *TomcatWebServersControllerClientListByWebAppSiteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/webAppSites/{webAppSiteName}/tomcatWebServers" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if webAppSiteName == "" { + return nil, errors.New("parameter webAppSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{webAppSiteName}", url.PathEscape(webAppSiteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + if options != nil && options.Filter != nil { + reqQP.Set("filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("top", *options.Top) + } + if options != nil && options.ContinuationToken != nil { + reqQP.Set("continuationToken", *options.ContinuationToken) + } + if options != nil && options.TotalRecordCount != nil { + reqQP.Set("totalRecordCount", strconv.FormatInt(int64(*options.TotalRecordCount), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByWebAppSiteHandleResponse handles the ListByWebAppSite response. +func (client *TomcatWebServersControllerClient) listByWebAppSiteHandleResponse(resp *http.Response) (TomcatWebServersControllerClientListByWebAppSiteResponse, error) { + result := TomcatWebServersControllerClientListByWebAppSiteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TomcatWebServersListResult); err != nil { + return TomcatWebServersControllerClientListByWebAppSiteResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/vcentercontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/vcentercontroller_client.go new file mode 100644 index 000000000000..a5ae7916e1b2 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/vcentercontroller_client.go @@ -0,0 +1,327 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VcenterControllerClient contains the methods for the VcenterController group. +// Don't use this type directly, use NewVcenterControllerClient() instead. +type VcenterControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewVcenterControllerClient creates a new instance of VcenterControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewVcenterControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VcenterControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VcenterControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreate - Create a Vcenter +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - vcenterName - VCenters name +// - body - Resource create parameters. +// - options - VcenterControllerClientBeginCreateOptions contains the optional parameters for the VcenterControllerClient.BeginCreate +// method. +func (client *VcenterControllerClient) BeginCreate(ctx context.Context, resourceGroupName string, siteName string, vcenterName string, body Vcenter, options *VcenterControllerClientBeginCreateOptions) (*runtime.Poller[VcenterControllerClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, siteName, vcenterName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VcenterControllerClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VcenterControllerClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Create a Vcenter +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *VcenterControllerClient) create(ctx context.Context, resourceGroupName string, siteName string, vcenterName string, body Vcenter, options *VcenterControllerClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "VcenterControllerClient.BeginCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, siteName, vcenterName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createCreateRequest creates the Create request. +func (client *VcenterControllerClient) createCreateRequest(ctx context.Context, resourceGroupName string, siteName string, vcenterName string, body Vcenter, options *VcenterControllerClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/vmwareSites/{siteName}/vcenters/{vcenterName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if vcenterName == "" { + return nil, errors.New("parameter vcenterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vcenterName}", url.PathEscape(vcenterName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// Delete - Delete a Vcenter +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - vcenterName - VCenters name +// - options - VcenterControllerClientDeleteOptions contains the optional parameters for the VcenterControllerClient.Delete +// method. +func (client *VcenterControllerClient) Delete(ctx context.Context, resourceGroupName string, siteName string, vcenterName string, options *VcenterControllerClientDeleteOptions) (VcenterControllerClientDeleteResponse, error) { + var err error + const operationName = "VcenterControllerClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, siteName, vcenterName, options) + if err != nil { + return VcenterControllerClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VcenterControllerClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return VcenterControllerClientDeleteResponse{}, err + } + return VcenterControllerClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *VcenterControllerClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, vcenterName string, options *VcenterControllerClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/vmwareSites/{siteName}/vcenters/{vcenterName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if vcenterName == "" { + return nil, errors.New("parameter vcenterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vcenterName}", url.PathEscape(vcenterName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a Vcenter +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - vcenterName - VCenters name +// - options - VcenterControllerClientGetOptions contains the optional parameters for the VcenterControllerClient.Get method. +func (client *VcenterControllerClient) Get(ctx context.Context, resourceGroupName string, siteName string, vcenterName string, options *VcenterControllerClientGetOptions) (VcenterControllerClientGetResponse, error) { + var err error + const operationName = "VcenterControllerClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, siteName, vcenterName, options) + if err != nil { + return VcenterControllerClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VcenterControllerClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VcenterControllerClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *VcenterControllerClient) getCreateRequest(ctx context.Context, resourceGroupName string, siteName string, vcenterName string, options *VcenterControllerClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/vmwareSites/{siteName}/vcenters/{vcenterName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if vcenterName == "" { + return nil, errors.New("parameter vcenterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vcenterName}", url.PathEscape(vcenterName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VcenterControllerClient) getHandleResponse(resp *http.Response) (VcenterControllerClientGetResponse, error) { + result := VcenterControllerClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Vcenter); err != nil { + return VcenterControllerClientGetResponse{}, err + } + return result, nil +} + +// NewListByVmwareSitePager - List Vcenter resources by VmwareSite +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - options - VcenterControllerClientListByVmwareSiteOptions contains the optional parameters for the VcenterControllerClient.NewListByVmwareSitePager +// method. +func (client *VcenterControllerClient) NewListByVmwareSitePager(resourceGroupName string, siteName string, options *VcenterControllerClientListByVmwareSiteOptions) *runtime.Pager[VcenterControllerClientListByVmwareSiteResponse] { + return runtime.NewPager(runtime.PagingHandler[VcenterControllerClientListByVmwareSiteResponse]{ + More: func(page VcenterControllerClientListByVmwareSiteResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VcenterControllerClientListByVmwareSiteResponse) (VcenterControllerClientListByVmwareSiteResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "VcenterControllerClient.NewListByVmwareSitePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByVmwareSiteCreateRequest(ctx, resourceGroupName, siteName, options) + }, nil) + if err != nil { + return VcenterControllerClientListByVmwareSiteResponse{}, err + } + return client.listByVmwareSiteHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByVmwareSiteCreateRequest creates the ListByVmwareSite request. +func (client *VcenterControllerClient) listByVmwareSiteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *VcenterControllerClientListByVmwareSiteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/vmwareSites/{siteName}/vcenters" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + if options != nil && options.Filter != nil { + reqQP.Set("filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByVmwareSiteHandleResponse handles the ListByVmwareSite response. +func (client *VcenterControllerClient) listByVmwareSiteHandleResponse(resp *http.Response) (VcenterControllerClientListByVmwareSiteResponse, error) { + result := VcenterControllerClientListByVmwareSiteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VcenterListResult); err != nil { + return VcenterControllerClientListByVmwareSiteResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/vmwarecollectors_client.go b/sdk/resourcemanager/migrate/armmigrate/vmwarecollectors_client.go deleted file mode 100644 index 082ec10ad6e9..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/vmwarecollectors_client.go +++ /dev/null @@ -1,332 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmigrate - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// VMwareCollectorsClient contains the methods for the VMwareCollectors group. -// Don't use this type directly, use NewVMwareCollectorsClient() instead. -type VMwareCollectorsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewVMwareCollectorsClient creates a new instance of VMwareCollectorsClient with the specified values. -// - subscriptionID - Azure Subscription Id in which project was created. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewVMwareCollectorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VMwareCollectorsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &VMwareCollectorsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Create - Create or Update VMware collector -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - vmWareCollectorName - Unique name of a VMware collector within a project. -// - options - VMwareCollectorsClientCreateOptions contains the optional parameters for the VMwareCollectorsClient.Create method. -func (client *VMwareCollectorsClient) Create(ctx context.Context, resourceGroupName string, projectName string, vmWareCollectorName string, options *VMwareCollectorsClientCreateOptions) (VMwareCollectorsClientCreateResponse, error) { - var err error - const operationName = "VMwareCollectorsClient.Create" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createCreateRequest(ctx, resourceGroupName, projectName, vmWareCollectorName, options) - if err != nil { - return VMwareCollectorsClientCreateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return VMwareCollectorsClientCreateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return VMwareCollectorsClientCreateResponse{}, err - } - resp, err := client.createHandleResponse(httpResp) - return resp, err -} - -// createCreateRequest creates the Create request. -func (client *VMwareCollectorsClient) createCreateRequest(ctx context.Context, resourceGroupName string, projectName string, vmWareCollectorName string, options *VMwareCollectorsClientCreateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/vmwarecollectors/{vmWareCollectorName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if vmWareCollectorName == "" { - return nil, errors.New("parameter vmWareCollectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vmWareCollectorName}", url.PathEscape(vmWareCollectorName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.CollectorBody != nil { - if err := runtime.MarshalAsJSON(req, *options.CollectorBody); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// createHandleResponse handles the Create response. -func (client *VMwareCollectorsClient) createHandleResponse(resp *http.Response) (VMwareCollectorsClientCreateResponse, error) { - result := VMwareCollectorsClientCreateResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.VMwareCollector); err != nil { - return VMwareCollectorsClientCreateResponse{}, err - } - return result, nil -} - -// Delete - Delete a VMware collector from the project. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - vmWareCollectorName - Unique name of a VMware collector within a project. -// - options - VMwareCollectorsClientDeleteOptions contains the optional parameters for the VMwareCollectorsClient.Delete method. -func (client *VMwareCollectorsClient) Delete(ctx context.Context, resourceGroupName string, projectName string, vmWareCollectorName string, options *VMwareCollectorsClientDeleteOptions) (VMwareCollectorsClientDeleteResponse, error) { - var err error - const operationName = "VMwareCollectorsClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, projectName, vmWareCollectorName, options) - if err != nil { - return VMwareCollectorsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return VMwareCollectorsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return VMwareCollectorsClientDeleteResponse{}, err - } - resp, err := client.deleteHandleResponse(httpResp) - return resp, err -} - -// deleteCreateRequest creates the Delete request. -func (client *VMwareCollectorsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, projectName string, vmWareCollectorName string, options *VMwareCollectorsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/vmwarecollectors/{vmWareCollectorName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if vmWareCollectorName == "" { - return nil, errors.New("parameter vmWareCollectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vmWareCollectorName}", url.PathEscape(vmWareCollectorName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// deleteHandleResponse handles the Delete response. -func (client *VMwareCollectorsClient) deleteHandleResponse(resp *http.Response) (VMwareCollectorsClientDeleteResponse, error) { - result := VMwareCollectorsClientDeleteResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - return result, nil -} - -// Get - Get a VMware collector. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - vmWareCollectorName - Unique name of a VMware collector within a project. -// - options - VMwareCollectorsClientGetOptions contains the optional parameters for the VMwareCollectorsClient.Get method. -func (client *VMwareCollectorsClient) Get(ctx context.Context, resourceGroupName string, projectName string, vmWareCollectorName string, options *VMwareCollectorsClientGetOptions) (VMwareCollectorsClientGetResponse, error) { - var err error - const operationName = "VMwareCollectorsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, vmWareCollectorName, options) - if err != nil { - return VMwareCollectorsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return VMwareCollectorsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return VMwareCollectorsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *VMwareCollectorsClient) getCreateRequest(ctx context.Context, resourceGroupName string, projectName string, vmWareCollectorName string, options *VMwareCollectorsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/vmwarecollectors/{vmWareCollectorName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if vmWareCollectorName == "" { - return nil, errors.New("parameter vmWareCollectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vmWareCollectorName}", url.PathEscape(vmWareCollectorName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *VMwareCollectorsClient) getHandleResponse(resp *http.Response) (VMwareCollectorsClientGetResponse, error) { - result := VMwareCollectorsClientGetResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.VMwareCollector); err != nil { - return VMwareCollectorsClientGetResponse{}, err - } - return result, nil -} - -// NewListByProjectPager - Get a list of VMware collector. -// -// Generated from API version 2019-10-01 -// - resourceGroupName - Name of the Azure Resource Group that project is part of. -// - projectName - Name of the Azure Migrate project. -// - options - VMwareCollectorsClientListByProjectOptions contains the optional parameters for the VMwareCollectorsClient.NewListByProjectPager -// method. -func (client *VMwareCollectorsClient) NewListByProjectPager(resourceGroupName string, projectName string, options *VMwareCollectorsClientListByProjectOptions) *runtime.Pager[VMwareCollectorsClientListByProjectResponse] { - return runtime.NewPager(runtime.PagingHandler[VMwareCollectorsClientListByProjectResponse]{ - More: func(page VMwareCollectorsClientListByProjectResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *VMwareCollectorsClientListByProjectResponse) (VMwareCollectorsClientListByProjectResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "VMwareCollectorsClient.NewListByProjectPager") - req, err := client.listByProjectCreateRequest(ctx, resourceGroupName, projectName, options) - if err != nil { - return VMwareCollectorsClientListByProjectResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return VMwareCollectorsClientListByProjectResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return VMwareCollectorsClientListByProjectResponse{}, runtime.NewResponseError(resp) - } - return client.listByProjectHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByProjectCreateRequest creates the ListByProject request. -func (client *VMwareCollectorsClient) listByProjectCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *VMwareCollectorsClientListByProjectOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/vmwarecollectors" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByProjectHandleResponse handles the ListByProject response. -func (client *VMwareCollectorsClient) listByProjectHandleResponse(resp *http.Response) (VMwareCollectorsClientListByProjectResponse, error) { - result := VMwareCollectorsClientListByProjectResponse{} - if val := resp.Header.Get("x-ms-request-id"); val != "" { - result.XMSRequestID = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.VMwareCollectorList); err != nil { - return VMwareCollectorsClientListByProjectResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/migrate/armmigrate/vmwarecollectors_client_example_test.go b/sdk/resourcemanager/migrate/armmigrate/vmwarecollectors_client_example_test.go deleted file mode 100644 index c21c07c2be7e..000000000000 --- a/sdk/resourcemanager/migrate/armmigrate/vmwarecollectors_client_example_test.go +++ /dev/null @@ -1,188 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmigrate_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/VMwareCollectors_ListByProject.json -func ExampleVMwareCollectorsClient_NewListByProjectPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVMwareCollectorsClient().NewListByProjectPager("abgoyal-westEurope", "abgoyalWEselfhostb72bproject", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VMwareCollectorList = armmigrate.VMwareCollectorList{ - // Value: []*armmigrate.VMwareCollector{ - // { - // Name: to.Ptr("PortalvCenterbc2fcollector"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/vmwarecollectors"), - // ETag: to.Ptr("\"01003d32-0000-0d00-0000-5d74d2e50000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/vmwarecollectors/PortalvCenterbc2fcollector"), - // Properties: &armmigrate.CollectorProperties{ - // AgentProperties: &armmigrate.CollectorAgentProperties{ - // ID: to.Ptr("75b0f71e-1272-4f29-a801-29cfa4b34a6e"), - // LastHeartbeatUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-28T06:21:28.779Z"); return t}()), - // SpnDetails: &armmigrate.CollectorBodyAgentSpnProperties{ - // ApplicationID: to.Ptr("fc717575-8173-4b21-92a5-658b655e613e"), - // Audience: to.Ptr("https://72f988bf-86f1-41af-91ab-2d7cd011db47/PortalvCenterbc2fagentauthaadapp"), - // Authority: to.Ptr("https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47"), - // ObjectID: to.Ptr("29d94f38-db94-4980-aec0-0cfd55ab1cd0"), - // TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), - // }, - // Version: to.Ptr("1.0.8.227"), - // }, - // CreatedTimestamp: to.Ptr("2019-05-09T09:58:21.4988104Z"), - // DiscoverySiteID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westEurope/providers/Microsoft.OffAzure/VMwareSites/PortalvCenterbc2fsite"), - // UpdatedTimestamp: to.Ptr("2019-09-08T10:07:33.1996006Z"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/VMwareCollectors_Get.json -func ExampleVMwareCollectorsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVMwareCollectorsClient().Get(ctx, "abgoyal-westEurope", "abgoyalWEselfhostb72bproject", "PortalvCenterbc2fcollector", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VMwareCollector = armmigrate.VMwareCollector{ - // Name: to.Ptr("PortalvCenterbc2fcollector"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/vmwarecollectors"), - // ETag: to.Ptr("\"01003d32-0000-0d00-0000-5d74d2e50000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/vmwarecollectors/PortalvCenterbc2fcollector"), - // Properties: &armmigrate.CollectorProperties{ - // AgentProperties: &armmigrate.CollectorAgentProperties{ - // ID: to.Ptr("75b0f71e-1272-4f29-a801-29cfa4b34a6e"), - // LastHeartbeatUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-28T06:21:28.779Z"); return t}()), - // SpnDetails: &armmigrate.CollectorBodyAgentSpnProperties{ - // ApplicationID: to.Ptr("fc717575-8173-4b21-92a5-658b655e613e"), - // Audience: to.Ptr("https://72f988bf-86f1-41af-91ab-2d7cd011db47/PortalvCenterbc2fagentauthaadapp"), - // Authority: to.Ptr("https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47"), - // ObjectID: to.Ptr("29d94f38-db94-4980-aec0-0cfd55ab1cd0"), - // TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), - // }, - // Version: to.Ptr("1.0.8.227"), - // }, - // CreatedTimestamp: to.Ptr("2019-05-09T09:58:21.4988104Z"), - // DiscoverySiteID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westEurope/providers/Microsoft.OffAzure/VMwareSites/PortalvCenterbc2fsite"), - // UpdatedTimestamp: to.Ptr("2019-09-08T10:07:33.1996006Z"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/VMwareCollectors_Create.json -func ExampleVMwareCollectorsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVMwareCollectorsClient().Create(ctx, "abgoyal-westEurope", "abgoyalWEselfhostb72bproject", "PortalvCenterbc2fcollector", &armmigrate.VMwareCollectorsClientCreateOptions{CollectorBody: &armmigrate.VMwareCollector{ - ETag: to.Ptr("\"01003d32-0000-0d00-0000-5d74d2e50000\""), - Properties: &armmigrate.CollectorProperties{ - AgentProperties: &armmigrate.CollectorAgentProperties{ - SpnDetails: &armmigrate.CollectorBodyAgentSpnProperties{ - ApplicationID: to.Ptr("fc717575-8173-4b21-92a5-658b655e613e"), - Audience: to.Ptr("https://72f988bf-86f1-41af-91ab-2d7cd011db47/PortalvCenterbc2fagentauthaadapp"), - Authority: to.Ptr("https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47"), - ObjectID: to.Ptr("29d94f38-db94-4980-aec0-0cfd55ab1cd0"), - TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), - }, - }, - DiscoverySiteID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westEurope/providers/Microsoft.OffAzure/VMwareSites/PortalvCenterbc2fsite"), - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VMwareCollector = armmigrate.VMwareCollector{ - // Name: to.Ptr("PortalvCenterbc2fcollector"), - // Type: to.Ptr("Microsoft.Migrate/assessmentprojects/vmwarecollectors"), - // ETag: to.Ptr("\"01003d32-0000-0d00-0000-5d74d2e50000\""), - // ID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westeurope/providers/Microsoft.Migrate/assessmentprojects/abgoyalWEselfhostb72bproject/vmwarecollectors/PortalvCenterbc2fcollector"), - // Properties: &armmigrate.CollectorProperties{ - // AgentProperties: &armmigrate.CollectorAgentProperties{ - // ID: to.Ptr("75b0f71e-1272-4f29-a801-29cfa4b34a6e"), - // LastHeartbeatUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-28T06:21:28.779Z"); return t}()), - // SpnDetails: &armmigrate.CollectorBodyAgentSpnProperties{ - // ApplicationID: to.Ptr("fc717575-8173-4b21-92a5-658b655e613e"), - // Audience: to.Ptr("https://72f988bf-86f1-41af-91ab-2d7cd011db47/PortalvCenterbc2fagentauthaadapp"), - // Authority: to.Ptr("https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47"), - // ObjectID: to.Ptr("29d94f38-db94-4980-aec0-0cfd55ab1cd0"), - // TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), - // }, - // Version: to.Ptr("1.0.8.227"), - // }, - // CreatedTimestamp: to.Ptr("2019-05-09T09:58:21.4988104Z"), - // DiscoverySiteID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westEurope/providers/Microsoft.OffAzure/VMwareSites/PortalvCenterbc2fsite"), - // UpdatedTimestamp: to.Ptr("2019-09-08T10:07:33.1996006Z"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/VMwareCollectors_Delete.json -func ExampleVMwareCollectorsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrate.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewVMwareCollectorsClient().Delete(ctx, "abgoyal-westEurope", "abgoyalWEselfhostb72bproject", "PortalvCenterbc2fcollector", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/migrate/armmigrate/vmwarehostcontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/vmwarehostcontroller_client.go new file mode 100644 index 000000000000..55f96ef4a75c --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/vmwarehostcontroller_client.go @@ -0,0 +1,179 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VmwareHostControllerClient contains the methods for the VmwareHostController group. +// Don't use this type directly, use NewVmwareHostControllerClient() instead. +type VmwareHostControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewVmwareHostControllerClient creates a new instance of VmwareHostControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewVmwareHostControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VmwareHostControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VmwareHostControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get a VmwareHost +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - hostName - Hosts name +// - options - VmwareHostControllerClientGetOptions contains the optional parameters for the VmwareHostControllerClient.Get +// method. +func (client *VmwareHostControllerClient) Get(ctx context.Context, resourceGroupName string, siteName string, hostName string, options *VmwareHostControllerClientGetOptions) (VmwareHostControllerClientGetResponse, error) { + var err error + const operationName = "VmwareHostControllerClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, siteName, hostName, options) + if err != nil { + return VmwareHostControllerClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VmwareHostControllerClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VmwareHostControllerClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *VmwareHostControllerClient) getCreateRequest(ctx context.Context, resourceGroupName string, siteName string, hostName string, options *VmwareHostControllerClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/vmwareSites/{siteName}/hosts/{hostName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if hostName == "" { + return nil, errors.New("parameter hostName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hostName}", url.PathEscape(hostName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VmwareHostControllerClient) getHandleResponse(resp *http.Response) (VmwareHostControllerClientGetResponse, error) { + result := VmwareHostControllerClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VmwareHost); err != nil { + return VmwareHostControllerClientGetResponse{}, err + } + return result, nil +} + +// NewListByVmwareSitePager - List VmwareHost resources by VmwareSite +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - options - VmwareHostControllerClientListByVmwareSiteOptions contains the optional parameters for the VmwareHostControllerClient.NewListByVmwareSitePager +// method. +func (client *VmwareHostControllerClient) NewListByVmwareSitePager(resourceGroupName string, siteName string, options *VmwareHostControllerClientListByVmwareSiteOptions) *runtime.Pager[VmwareHostControllerClientListByVmwareSiteResponse] { + return runtime.NewPager(runtime.PagingHandler[VmwareHostControllerClientListByVmwareSiteResponse]{ + More: func(page VmwareHostControllerClientListByVmwareSiteResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VmwareHostControllerClientListByVmwareSiteResponse) (VmwareHostControllerClientListByVmwareSiteResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "VmwareHostControllerClient.NewListByVmwareSitePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByVmwareSiteCreateRequest(ctx, resourceGroupName, siteName, options) + }, nil) + if err != nil { + return VmwareHostControllerClientListByVmwareSiteResponse{}, err + } + return client.listByVmwareSiteHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByVmwareSiteCreateRequest creates the ListByVmwareSite request. +func (client *VmwareHostControllerClient) listByVmwareSiteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *VmwareHostControllerClientListByVmwareSiteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/vmwareSites/{siteName}/hosts" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByVmwareSiteHandleResponse handles the ListByVmwareSite response. +func (client *VmwareHostControllerClient) listByVmwareSiteHandleResponse(resp *http.Response) (VmwareHostControllerClientListByVmwareSiteResponse, error) { + result := VmwareHostControllerClientListByVmwareSiteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VmwareHostListResult); err != nil { + return VmwareHostControllerClientListByVmwareSiteResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/vmwareoperationsstatus_client.go b/sdk/resourcemanager/migrate/armmigrate/vmwareoperationsstatus_client.go new file mode 100644 index 000000000000..a55df3594ca7 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/vmwareoperationsstatus_client.go @@ -0,0 +1,114 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VmwareOperationsStatusClient contains the methods for the VmwareOperationsStatus group. +// Don't use this type directly, use NewVmwareOperationsStatusClient() instead. +type VmwareOperationsStatusClient struct { + internal *arm.Client + subscriptionID string +} + +// NewVmwareOperationsStatusClient creates a new instance of VmwareOperationsStatusClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewVmwareOperationsStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VmwareOperationsStatusClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VmwareOperationsStatusClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// GetVmwareOperationStatus - A operation status resource belonging to a site resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - operationStatusName - Operation status Arm Name. +// - options - VmwareOperationsStatusClientGetVmwareOperationStatusOptions contains the optional parameters for the VmwareOperationsStatusClient.GetVmwareOperationStatus +// method. +func (client *VmwareOperationsStatusClient) GetVmwareOperationStatus(ctx context.Context, resourceGroupName string, siteName string, operationStatusName string, options *VmwareOperationsStatusClientGetVmwareOperationStatusOptions) (VmwareOperationsStatusClientGetVmwareOperationStatusResponse, error) { + var err error + const operationName = "VmwareOperationsStatusClient.GetVmwareOperationStatus" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getVmwareOperationStatusCreateRequest(ctx, resourceGroupName, siteName, operationStatusName, options) + if err != nil { + return VmwareOperationsStatusClientGetVmwareOperationStatusResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VmwareOperationsStatusClientGetVmwareOperationStatusResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VmwareOperationsStatusClientGetVmwareOperationStatusResponse{}, err + } + resp, err := client.getVmwareOperationStatusHandleResponse(httpResp) + return resp, err +} + +// getVmwareOperationStatusCreateRequest creates the GetVmwareOperationStatus request. +func (client *VmwareOperationsStatusClient) getVmwareOperationStatusCreateRequest(ctx context.Context, resourceGroupName string, siteName string, operationStatusName string, options *VmwareOperationsStatusClientGetVmwareOperationStatusOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/vmwareSites/{siteName}/operationsStatus/{operationStatusName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if operationStatusName == "" { + return nil, errors.New("parameter operationStatusName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{operationStatusName}", url.PathEscape(operationStatusName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getVmwareOperationStatusHandleResponse handles the GetVmwareOperationStatus response. +func (client *VmwareOperationsStatusClient) getVmwareOperationStatusHandleResponse(resp *http.Response) (VmwareOperationsStatusClientGetVmwareOperationStatusResponse, error) { + result := VmwareOperationsStatusClientGetVmwareOperationStatusResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { + return VmwareOperationsStatusClientGetVmwareOperationStatusResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/vmwarepropertiescontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/vmwarepropertiescontroller_client.go new file mode 100644 index 000000000000..a8e4701784ef --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/vmwarepropertiescontroller_client.go @@ -0,0 +1,368 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VmwarePropertiesControllerClient contains the methods for the VmwarePropertiesController group. +// Don't use this type directly, use NewVmwarePropertiesControllerClient() instead. +type VmwarePropertiesControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewVmwarePropertiesControllerClient creates a new instance of VmwarePropertiesControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewVmwarePropertiesControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VmwarePropertiesControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VmwarePropertiesControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginUpdateDependencyMapStatus - Method to enable disable dependency map status for machines in a site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - updateMachineDepMapStatus - The content of the action request +// - options - VmwarePropertiesControllerClientBeginUpdateDependencyMapStatusOptions contains the optional parameters for the +// VmwarePropertiesControllerClient.BeginUpdateDependencyMapStatus method. +func (client *VmwarePropertiesControllerClient) BeginUpdateDependencyMapStatus(ctx context.Context, resourceGroupName string, siteName string, updateMachineDepMapStatus UpdateMachineDepMapStatus, options *VmwarePropertiesControllerClientBeginUpdateDependencyMapStatusOptions) (*runtime.Poller[VmwarePropertiesControllerClientUpdateDependencyMapStatusResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.updateDependencyMapStatus(ctx, resourceGroupName, siteName, updateMachineDepMapStatus, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VmwarePropertiesControllerClientUpdateDependencyMapStatusResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VmwarePropertiesControllerClientUpdateDependencyMapStatusResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// UpdateDependencyMapStatus - Method to enable disable dependency map status for machines in a site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *VmwarePropertiesControllerClient) updateDependencyMapStatus(ctx context.Context, resourceGroupName string, siteName string, updateMachineDepMapStatus UpdateMachineDepMapStatus, options *VmwarePropertiesControllerClientBeginUpdateDependencyMapStatusOptions) (*http.Response, error) { + var err error + const operationName = "VmwarePropertiesControllerClient.BeginUpdateDependencyMapStatus" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateDependencyMapStatusCreateRequest(ctx, resourceGroupName, siteName, updateMachineDepMapStatus, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateDependencyMapStatusCreateRequest creates the UpdateDependencyMapStatus request. +func (client *VmwarePropertiesControllerClient) updateDependencyMapStatusCreateRequest(ctx context.Context, resourceGroupName string, siteName string, updateMachineDepMapStatus UpdateMachineDepMapStatus, options *VmwarePropertiesControllerClientBeginUpdateDependencyMapStatusOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/vmwareSites/{siteName}/updateDependencyMapStatus" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, updateMachineDepMapStatus); err != nil { + return nil, err + } + return req, nil +} + +// BeginUpdateProperties - Method to update properties for machines in a site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - metaData - The content of the action request +// - options - VmwarePropertiesControllerClientBeginUpdatePropertiesOptions contains the optional parameters for the VmwarePropertiesControllerClient.BeginUpdateProperties +// method. +func (client *VmwarePropertiesControllerClient) BeginUpdateProperties(ctx context.Context, resourceGroupName string, siteName string, metaData MachineMetadataCollection, options *VmwarePropertiesControllerClientBeginUpdatePropertiesOptions) (*runtime.Poller[VmwarePropertiesControllerClientUpdatePropertiesResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.updateProperties(ctx, resourceGroupName, siteName, metaData, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VmwarePropertiesControllerClientUpdatePropertiesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VmwarePropertiesControllerClientUpdatePropertiesResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// UpdateProperties - Method to update properties for machines in a site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *VmwarePropertiesControllerClient) updateProperties(ctx context.Context, resourceGroupName string, siteName string, metaData MachineMetadataCollection, options *VmwarePropertiesControllerClientBeginUpdatePropertiesOptions) (*http.Response, error) { + var err error + const operationName = "VmwarePropertiesControllerClient.BeginUpdateProperties" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updatePropertiesCreateRequest(ctx, resourceGroupName, siteName, metaData, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updatePropertiesCreateRequest creates the UpdateProperties request. +func (client *VmwarePropertiesControllerClient) updatePropertiesCreateRequest(ctx context.Context, resourceGroupName string, siteName string, metaData MachineMetadataCollection, options *VmwarePropertiesControllerClientBeginUpdatePropertiesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/vmwareSites/{siteName}/updateProperties" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, metaData); err != nil { + return nil, err + } + return req, nil +} + +// BeginUpdateRunAsAccount - Method to associate Run as account to machine in a site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - updateMachineRunAsAccount - The content of the action request +// - options - VmwarePropertiesControllerClientBeginUpdateRunAsAccountOptions contains the optional parameters for the VmwarePropertiesControllerClient.BeginUpdateRunAsAccount +// method. +func (client *VmwarePropertiesControllerClient) BeginUpdateRunAsAccount(ctx context.Context, resourceGroupName string, siteName string, updateMachineRunAsAccount UpdateMachineRunAsAccount, options *VmwarePropertiesControllerClientBeginUpdateRunAsAccountOptions) (*runtime.Poller[VmwarePropertiesControllerClientUpdateRunAsAccountResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.updateRunAsAccount(ctx, resourceGroupName, siteName, updateMachineRunAsAccount, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VmwarePropertiesControllerClientUpdateRunAsAccountResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VmwarePropertiesControllerClientUpdateRunAsAccountResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// UpdateRunAsAccount - Method to associate Run as account to machine in a site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *VmwarePropertiesControllerClient) updateRunAsAccount(ctx context.Context, resourceGroupName string, siteName string, updateMachineRunAsAccount UpdateMachineRunAsAccount, options *VmwarePropertiesControllerClientBeginUpdateRunAsAccountOptions) (*http.Response, error) { + var err error + const operationName = "VmwarePropertiesControllerClient.BeginUpdateRunAsAccount" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateRunAsAccountCreateRequest(ctx, resourceGroupName, siteName, updateMachineRunAsAccount, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateRunAsAccountCreateRequest creates the UpdateRunAsAccount request. +func (client *VmwarePropertiesControllerClient) updateRunAsAccountCreateRequest(ctx context.Context, resourceGroupName string, siteName string, updateMachineRunAsAccount UpdateMachineRunAsAccount, options *VmwarePropertiesControllerClientBeginUpdateRunAsAccountOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/vmwareSites/{siteName}/updateRunAsAccount" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, updateMachineRunAsAccount); err != nil { + return nil, err + } + return req, nil +} + +// BeginUpdateTags - Method to associate Run as account to machine in a site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - updateMachineTags - The content of the action request +// - options - VmwarePropertiesControllerClientBeginUpdateTagsOptions contains the optional parameters for the VmwarePropertiesControllerClient.BeginUpdateTags +// method. +func (client *VmwarePropertiesControllerClient) BeginUpdateTags(ctx context.Context, resourceGroupName string, siteName string, updateMachineTags UpdateMachineTags, options *VmwarePropertiesControllerClientBeginUpdateTagsOptions) (*runtime.Poller[VmwarePropertiesControllerClientUpdateTagsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.updateTags(ctx, resourceGroupName, siteName, updateMachineTags, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VmwarePropertiesControllerClientUpdateTagsResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VmwarePropertiesControllerClientUpdateTagsResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// UpdateTags - Method to associate Run as account to machine in a site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *VmwarePropertiesControllerClient) updateTags(ctx context.Context, resourceGroupName string, siteName string, updateMachineTags UpdateMachineTags, options *VmwarePropertiesControllerClientBeginUpdateTagsOptions) (*http.Response, error) { + var err error + const operationName = "VmwarePropertiesControllerClient.BeginUpdateTags" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, siteName, updateMachineTags, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *VmwarePropertiesControllerClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, siteName string, updateMachineTags UpdateMachineTags, options *VmwarePropertiesControllerClientBeginUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/vmwareSites/{siteName}/updateTags" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, updateMachineTags); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/vmwaresoftwareinventoriescontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/vmwaresoftwareinventoriescontroller_client.go new file mode 100644 index 000000000000..d2df6d9087bd --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/vmwaresoftwareinventoriescontroller_client.go @@ -0,0 +1,189 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VmwareSoftwareInventoriesControllerClient contains the methods for the VmwareSoftwareInventoriesController group. +// Don't use this type directly, use NewVmwareSoftwareInventoriesControllerClient() instead. +type VmwareSoftwareInventoriesControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewVmwareSoftwareInventoriesControllerClient creates a new instance of VmwareSoftwareInventoriesControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewVmwareSoftwareInventoriesControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VmwareSoftwareInventoriesControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VmwareSoftwareInventoriesControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// GetMachineSoftwareInventory - Method to get a machines software inventory like applications and roles. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - machineName - Machine name +// - defaultParam - Default value. +// - options - VmwareSoftwareInventoriesControllerClientGetMachineSoftwareInventoryOptions contains the optional parameters +// for the VmwareSoftwareInventoriesControllerClient.GetMachineSoftwareInventory method. +func (client *VmwareSoftwareInventoriesControllerClient) GetMachineSoftwareInventory(ctx context.Context, resourceGroupName string, siteName string, machineName string, defaultParam Default, options *VmwareSoftwareInventoriesControllerClientGetMachineSoftwareInventoryOptions) (VmwareSoftwareInventoriesControllerClientGetMachineSoftwareInventoryResponse, error) { + var err error + const operationName = "VmwareSoftwareInventoriesControllerClient.GetMachineSoftwareInventory" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getMachineSoftwareInventoryCreateRequest(ctx, resourceGroupName, siteName, machineName, defaultParam, options) + if err != nil { + return VmwareSoftwareInventoriesControllerClientGetMachineSoftwareInventoryResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VmwareSoftwareInventoriesControllerClientGetMachineSoftwareInventoryResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VmwareSoftwareInventoriesControllerClientGetMachineSoftwareInventoryResponse{}, err + } + resp, err := client.getMachineSoftwareInventoryHandleResponse(httpResp) + return resp, err +} + +// getMachineSoftwareInventoryCreateRequest creates the GetMachineSoftwareInventory request. +func (client *VmwareSoftwareInventoriesControllerClient) getMachineSoftwareInventoryCreateRequest(ctx context.Context, resourceGroupName string, siteName string, machineName string, defaultParam Default, options *VmwareSoftwareInventoriesControllerClientGetMachineSoftwareInventoryOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/vmwareSites/{siteName}/machines/{machineName}/softwareInventories/{default}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if machineName == "" { + return nil, errors.New("parameter machineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{machineName}", url.PathEscape(machineName)) + if defaultParam == "" { + return nil, errors.New("parameter defaultParam cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{default}", url.PathEscape(string(defaultParam))) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getMachineSoftwareInventoryHandleResponse handles the GetMachineSoftwareInventory response. +func (client *VmwareSoftwareInventoriesControllerClient) getMachineSoftwareInventoryHandleResponse(resp *http.Response) (VmwareSoftwareInventoriesControllerClientGetMachineSoftwareInventoryResponse, error) { + result := VmwareSoftwareInventoriesControllerClientGetMachineSoftwareInventoryResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VmwareMachineSoftwareInventory); err != nil { + return VmwareSoftwareInventoriesControllerClientGetMachineSoftwareInventoryResponse{}, err + } + return result, nil +} + +// NewListByMachineResourcePager - List VmwareMachineSoftwareInventory resources by MachineResource +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - machineName - Machine name +// - options - VmwareSoftwareInventoriesControllerClientListByMachineResourceOptions contains the optional parameters for the +// VmwareSoftwareInventoriesControllerClient.NewListByMachineResourcePager method. +func (client *VmwareSoftwareInventoriesControllerClient) NewListByMachineResourcePager(resourceGroupName string, siteName string, machineName string, options *VmwareSoftwareInventoriesControllerClientListByMachineResourceOptions) *runtime.Pager[VmwareSoftwareInventoriesControllerClientListByMachineResourceResponse] { + return runtime.NewPager(runtime.PagingHandler[VmwareSoftwareInventoriesControllerClientListByMachineResourceResponse]{ + More: func(page VmwareSoftwareInventoriesControllerClientListByMachineResourceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VmwareSoftwareInventoriesControllerClientListByMachineResourceResponse) (VmwareSoftwareInventoriesControllerClientListByMachineResourceResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "VmwareSoftwareInventoriesControllerClient.NewListByMachineResourcePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByMachineResourceCreateRequest(ctx, resourceGroupName, siteName, machineName, options) + }, nil) + if err != nil { + return VmwareSoftwareInventoriesControllerClientListByMachineResourceResponse{}, err + } + return client.listByMachineResourceHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByMachineResourceCreateRequest creates the ListByMachineResource request. +func (client *VmwareSoftwareInventoriesControllerClient) listByMachineResourceCreateRequest(ctx context.Context, resourceGroupName string, siteName string, machineName string, options *VmwareSoftwareInventoriesControllerClientListByMachineResourceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/vmwareSites/{siteName}/machines/{machineName}/softwareinventories" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if machineName == "" { + return nil, errors.New("parameter machineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{machineName}", url.PathEscape(machineName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByMachineResourceHandleResponse handles the ListByMachineResource response. +func (client *VmwareSoftwareInventoriesControllerClient) listByMachineResourceHandleResponse(resp *http.Response) (VmwareSoftwareInventoriesControllerClientListByMachineResourceResponse, error) { + result := VmwareSoftwareInventoriesControllerClientListByMachineResourceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VmwareMachineSoftwareInventoryListResult); err != nil { + return VmwareSoftwareInventoriesControllerClientListByMachineResourceResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/webappdiscoverysitedatasourcescontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/webappdiscoverysitedatasourcescontroller_client.go new file mode 100644 index 000000000000..403dc2fb222c --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/webappdiscoverysitedatasourcescontroller_client.go @@ -0,0 +1,367 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// WebAppDiscoverySiteDataSourcesControllerClient contains the methods for the WebAppDiscoverySiteDataSourcesController group. +// Don't use this type directly, use NewWebAppDiscoverySiteDataSourcesControllerClient() instead. +type WebAppDiscoverySiteDataSourcesControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewWebAppDiscoverySiteDataSourcesControllerClient creates a new instance of WebAppDiscoverySiteDataSourcesControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewWebAppDiscoverySiteDataSourcesControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WebAppDiscoverySiteDataSourcesControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WebAppDiscoverySiteDataSourcesControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreate - Method to create or update a Web app data source in site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - webAppSiteName - Web app site name. +// - discoverySiteDataSourceName - Data Source ARM name. +// - body - Resource create parameters. +// - options - WebAppDiscoverySiteDataSourcesControllerClientBeginCreateOptions contains the optional parameters for the WebAppDiscoverySiteDataSourcesControllerClient.BeginCreate +// method. +func (client *WebAppDiscoverySiteDataSourcesControllerClient) BeginCreate(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, discoverySiteDataSourceName string, body DiscoverySiteDataSource, options *WebAppDiscoverySiteDataSourcesControllerClientBeginCreateOptions) (*runtime.Poller[WebAppDiscoverySiteDataSourcesControllerClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, siteName, webAppSiteName, discoverySiteDataSourceName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[WebAppDiscoverySiteDataSourcesControllerClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[WebAppDiscoverySiteDataSourcesControllerClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Method to create or update a Web app data source in site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *WebAppDiscoverySiteDataSourcesControllerClient) create(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, discoverySiteDataSourceName string, body DiscoverySiteDataSource, options *WebAppDiscoverySiteDataSourcesControllerClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "WebAppDiscoverySiteDataSourcesControllerClient.BeginCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, siteName, webAppSiteName, discoverySiteDataSourceName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createCreateRequest creates the Create request. +func (client *WebAppDiscoverySiteDataSourcesControllerClient) createCreateRequest(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, discoverySiteDataSourceName string, body DiscoverySiteDataSource, options *WebAppDiscoverySiteDataSourcesControllerClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/webAppSites/{webAppSiteName}/discoverySiteDataSources/{discoverySiteDataSourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if webAppSiteName == "" { + return nil, errors.New("parameter webAppSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{webAppSiteName}", url.PathEscape(webAppSiteName)) + if discoverySiteDataSourceName == "" { + return nil, errors.New("parameter discoverySiteDataSourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{discoverySiteDataSourceName}", url.PathEscape(discoverySiteDataSourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Method to delete a Web app data source in site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - webAppSiteName - Web app site name. +// - discoverySiteDataSourceName - Data Source ARM name. +// - options - WebAppDiscoverySiteDataSourcesControllerClientBeginDeleteOptions contains the optional parameters for the WebAppDiscoverySiteDataSourcesControllerClient.BeginDelete +// method. +func (client *WebAppDiscoverySiteDataSourcesControllerClient) BeginDelete(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, discoverySiteDataSourceName string, options *WebAppDiscoverySiteDataSourcesControllerClientBeginDeleteOptions) (*runtime.Poller[WebAppDiscoverySiteDataSourcesControllerClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, siteName, webAppSiteName, discoverySiteDataSourceName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[WebAppDiscoverySiteDataSourcesControllerClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[WebAppDiscoverySiteDataSourcesControllerClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Method to delete a Web app data source in site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *WebAppDiscoverySiteDataSourcesControllerClient) deleteOperation(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, discoverySiteDataSourceName string, options *WebAppDiscoverySiteDataSourcesControllerClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "WebAppDiscoverySiteDataSourcesControllerClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, siteName, webAppSiteName, discoverySiteDataSourceName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *WebAppDiscoverySiteDataSourcesControllerClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, discoverySiteDataSourceName string, options *WebAppDiscoverySiteDataSourcesControllerClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/webAppSites/{webAppSiteName}/discoverySiteDataSources/{discoverySiteDataSourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if webAppSiteName == "" { + return nil, errors.New("parameter webAppSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{webAppSiteName}", url.PathEscape(webAppSiteName)) + if discoverySiteDataSourceName == "" { + return nil, errors.New("parameter discoverySiteDataSourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{discoverySiteDataSourceName}", url.PathEscape(discoverySiteDataSourceName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Method to get a Web app data source in site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - webAppSiteName - Web app site name. +// - discoverySiteDataSourceName - Data Source ARM name. +// - options - WebAppDiscoverySiteDataSourcesControllerClientGetOptions contains the optional parameters for the WebAppDiscoverySiteDataSourcesControllerClient.Get +// method. +func (client *WebAppDiscoverySiteDataSourcesControllerClient) Get(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, discoverySiteDataSourceName string, options *WebAppDiscoverySiteDataSourcesControllerClientGetOptions) (WebAppDiscoverySiteDataSourcesControllerClientGetResponse, error) { + var err error + const operationName = "WebAppDiscoverySiteDataSourcesControllerClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, siteName, webAppSiteName, discoverySiteDataSourceName, options) + if err != nil { + return WebAppDiscoverySiteDataSourcesControllerClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WebAppDiscoverySiteDataSourcesControllerClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return WebAppDiscoverySiteDataSourcesControllerClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *WebAppDiscoverySiteDataSourcesControllerClient) getCreateRequest(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, discoverySiteDataSourceName string, options *WebAppDiscoverySiteDataSourcesControllerClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/webAppSites/{webAppSiteName}/discoverySiteDataSources/{discoverySiteDataSourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if webAppSiteName == "" { + return nil, errors.New("parameter webAppSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{webAppSiteName}", url.PathEscape(webAppSiteName)) + if discoverySiteDataSourceName == "" { + return nil, errors.New("parameter discoverySiteDataSourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{discoverySiteDataSourceName}", url.PathEscape(discoverySiteDataSourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *WebAppDiscoverySiteDataSourcesControllerClient) getHandleResponse(resp *http.Response) (WebAppDiscoverySiteDataSourcesControllerClientGetResponse, error) { + result := WebAppDiscoverySiteDataSourcesControllerClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DiscoverySiteDataSource); err != nil { + return WebAppDiscoverySiteDataSourcesControllerClientGetResponse{}, err + } + return result, nil +} + +// NewListByWebAppSitePager - Method to get all Web app data sources in site. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - webAppSiteName - Web app site name. +// - options - WebAppDiscoverySiteDataSourcesControllerClientListByWebAppSiteOptions contains the optional parameters for the +// WebAppDiscoverySiteDataSourcesControllerClient.NewListByWebAppSitePager method. +func (client *WebAppDiscoverySiteDataSourcesControllerClient) NewListByWebAppSitePager(resourceGroupName string, siteName string, webAppSiteName string, options *WebAppDiscoverySiteDataSourcesControllerClientListByWebAppSiteOptions) *runtime.Pager[WebAppDiscoverySiteDataSourcesControllerClientListByWebAppSiteResponse] { + return runtime.NewPager(runtime.PagingHandler[WebAppDiscoverySiteDataSourcesControllerClientListByWebAppSiteResponse]{ + More: func(page WebAppDiscoverySiteDataSourcesControllerClientListByWebAppSiteResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WebAppDiscoverySiteDataSourcesControllerClientListByWebAppSiteResponse) (WebAppDiscoverySiteDataSourcesControllerClientListByWebAppSiteResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "WebAppDiscoverySiteDataSourcesControllerClient.NewListByWebAppSitePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByWebAppSiteCreateRequest(ctx, resourceGroupName, siteName, webAppSiteName, options) + }, nil) + if err != nil { + return WebAppDiscoverySiteDataSourcesControllerClientListByWebAppSiteResponse{}, err + } + return client.listByWebAppSiteHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByWebAppSiteCreateRequest creates the ListByWebAppSite request. +func (client *WebAppDiscoverySiteDataSourcesControllerClient) listByWebAppSiteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, options *WebAppDiscoverySiteDataSourcesControllerClientListByWebAppSiteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/webAppSites/{webAppSiteName}/discoverySiteDataSources" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if webAppSiteName == "" { + return nil, errors.New("parameter webAppSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{webAppSiteName}", url.PathEscape(webAppSiteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByWebAppSiteHandleResponse handles the ListByWebAppSite response. +func (client *WebAppDiscoverySiteDataSourcesControllerClient) listByWebAppSiteHandleResponse(resp *http.Response) (WebAppDiscoverySiteDataSourcesControllerClientListByWebAppSiteResponse, error) { + result := WebAppDiscoverySiteDataSourcesControllerClientListByWebAppSiteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DiscoverySiteDataSourceListResult); err != nil { + return WebAppDiscoverySiteDataSourcesControllerClientListByWebAppSiteResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/webappextendedmachinescontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/webappextendedmachinescontroller_client.go new file mode 100644 index 000000000000..7566f90c1b98 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/webappextendedmachinescontroller_client.go @@ -0,0 +1,202 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// WebAppExtendedMachinesControllerClient contains the methods for the WebAppExtendedMachinesController group. +// Don't use this type directly, use NewWebAppExtendedMachinesControllerClient() instead. +type WebAppExtendedMachinesControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewWebAppExtendedMachinesControllerClient creates a new instance of WebAppExtendedMachinesControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewWebAppExtendedMachinesControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WebAppExtendedMachinesControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WebAppExtendedMachinesControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Method to get a extended machine. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - webAppSiteName - Web app site name. +// - extendedMachineName - Extended machine name. +// - options - WebAppExtendedMachinesControllerClientGetOptions contains the optional parameters for the WebAppExtendedMachinesControllerClient.Get +// method. +func (client *WebAppExtendedMachinesControllerClient) Get(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, extendedMachineName string, options *WebAppExtendedMachinesControllerClientGetOptions) (WebAppExtendedMachinesControllerClientGetResponse, error) { + var err error + const operationName = "WebAppExtendedMachinesControllerClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, siteName, webAppSiteName, extendedMachineName, options) + if err != nil { + return WebAppExtendedMachinesControllerClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WebAppExtendedMachinesControllerClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return WebAppExtendedMachinesControllerClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *WebAppExtendedMachinesControllerClient) getCreateRequest(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, extendedMachineName string, options *WebAppExtendedMachinesControllerClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/webAppSites/{webAppSiteName}/extendedMachines/{extendedMachineName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if webAppSiteName == "" { + return nil, errors.New("parameter webAppSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{webAppSiteName}", url.PathEscape(webAppSiteName)) + if extendedMachineName == "" { + return nil, errors.New("parameter extendedMachineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{extendedMachineName}", url.PathEscape(extendedMachineName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *WebAppExtendedMachinesControllerClient) getHandleResponse(resp *http.Response) (WebAppExtendedMachinesControllerClientGetResponse, error) { + result := WebAppExtendedMachinesControllerClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.WebAppExtendedMachine); err != nil { + return WebAppExtendedMachinesControllerClientGetResponse{}, err + } + return result, nil +} + +// NewListByWebAppSitePager - Method to get all extended machines. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - webAppSiteName - Web app site name. +// - options - WebAppExtendedMachinesControllerClientListByWebAppSiteOptions contains the optional parameters for the WebAppExtendedMachinesControllerClient.NewListByWebAppSitePager +// method. +func (client *WebAppExtendedMachinesControllerClient) NewListByWebAppSitePager(resourceGroupName string, siteName string, webAppSiteName string, options *WebAppExtendedMachinesControllerClientListByWebAppSiteOptions) *runtime.Pager[WebAppExtendedMachinesControllerClientListByWebAppSiteResponse] { + return runtime.NewPager(runtime.PagingHandler[WebAppExtendedMachinesControllerClientListByWebAppSiteResponse]{ + More: func(page WebAppExtendedMachinesControllerClientListByWebAppSiteResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WebAppExtendedMachinesControllerClientListByWebAppSiteResponse) (WebAppExtendedMachinesControllerClientListByWebAppSiteResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "WebAppExtendedMachinesControllerClient.NewListByWebAppSitePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByWebAppSiteCreateRequest(ctx, resourceGroupName, siteName, webAppSiteName, options) + }, nil) + if err != nil { + return WebAppExtendedMachinesControllerClientListByWebAppSiteResponse{}, err + } + return client.listByWebAppSiteHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByWebAppSiteCreateRequest creates the ListByWebAppSite request. +func (client *WebAppExtendedMachinesControllerClient) listByWebAppSiteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, options *WebAppExtendedMachinesControllerClientListByWebAppSiteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/webAppSites/{webAppSiteName}/extendedMachines" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if webAppSiteName == "" { + return nil, errors.New("parameter webAppSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{webAppSiteName}", url.PathEscape(webAppSiteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + if options != nil && options.Filter != nil { + reqQP.Set("filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("top", *options.Top) + } + if options != nil && options.ContinuationToken != nil { + reqQP.Set("continuationToken", *options.ContinuationToken) + } + if options != nil && options.TotalRecordCount != nil { + reqQP.Set("totalRecordCount", strconv.FormatInt(int64(*options.TotalRecordCount), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByWebAppSiteHandleResponse handles the ListByWebAppSite response. +func (client *WebAppExtendedMachinesControllerClient) listByWebAppSiteHandleResponse(resp *http.Response) (WebAppExtendedMachinesControllerClientListByWebAppSiteResponse, error) { + result := WebAppExtendedMachinesControllerClientListByWebAppSiteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.WebAppExtendedMachineListResult); err != nil { + return WebAppExtendedMachinesControllerClientListByWebAppSiteResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/webapplicationscontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/webapplicationscontroller_client.go new file mode 100644 index 000000000000..587c47dbf591 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/webapplicationscontroller_client.go @@ -0,0 +1,127 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// WebApplicationsControllerClient contains the methods for the WebApplicationsController group. +// Don't use this type directly, use NewWebApplicationsControllerClient() instead. +type WebApplicationsControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewWebApplicationsControllerClient creates a new instance of WebApplicationsControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewWebApplicationsControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WebApplicationsControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WebApplicationsControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListByWebAppSitePager - Method to get all IIS web applications. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - webAppSiteName - Web app site name. +// - options - WebApplicationsControllerClientListByWebAppSiteOptions contains the optional parameters for the WebApplicationsControllerClient.NewListByWebAppSitePager +// method. +func (client *WebApplicationsControllerClient) NewListByWebAppSitePager(resourceGroupName string, siteName string, webAppSiteName string, options *WebApplicationsControllerClientListByWebAppSiteOptions) *runtime.Pager[WebApplicationsControllerClientListByWebAppSiteResponse] { + return runtime.NewPager(runtime.PagingHandler[WebApplicationsControllerClientListByWebAppSiteResponse]{ + More: func(page WebApplicationsControllerClientListByWebAppSiteResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WebApplicationsControllerClientListByWebAppSiteResponse) (WebApplicationsControllerClientListByWebAppSiteResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "WebApplicationsControllerClient.NewListByWebAppSitePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByWebAppSiteCreateRequest(ctx, resourceGroupName, siteName, webAppSiteName, options) + }, nil) + if err != nil { + return WebApplicationsControllerClientListByWebAppSiteResponse{}, err + } + return client.listByWebAppSiteHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByWebAppSiteCreateRequest creates the ListByWebAppSite request. +func (client *WebApplicationsControllerClient) listByWebAppSiteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, options *WebApplicationsControllerClientListByWebAppSiteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/webAppSites/{webAppSiteName}/webApplications" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if webAppSiteName == "" { + return nil, errors.New("parameter webAppSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{webAppSiteName}", url.PathEscape(webAppSiteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + if options != nil && options.Filter != nil { + reqQP.Set("filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("top", *options.Top) + } + if options != nil && options.ContinuationToken != nil { + reqQP.Set("continuationToken", *options.ContinuationToken) + } + if options != nil && options.TotalRecordCount != nil { + reqQP.Set("totalRecordCount", strconv.FormatInt(int64(*options.TotalRecordCount), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByWebAppSiteHandleResponse handles the ListByWebAppSite response. +func (client *WebApplicationsControllerClient) listByWebAppSiteHandleResponse(resp *http.Response) (WebApplicationsControllerClientListByWebAppSiteResponse, error) { + result := WebApplicationsControllerClientListByWebAppSiteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.WebApplicationListResult); err != nil { + return WebApplicationsControllerClientListByWebAppSiteResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/webapppropertiescontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/webapppropertiescontroller_client.go new file mode 100644 index 000000000000..3f9b583faec4 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/webapppropertiescontroller_client.go @@ -0,0 +1,130 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// WebAppPropertiesControllerClient contains the methods for the WebAppPropertiesController group. +// Don't use this type directly, use NewWebAppPropertiesControllerClient() instead. +type WebAppPropertiesControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewWebAppPropertiesControllerClient creates a new instance of WebAppPropertiesControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewWebAppPropertiesControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WebAppPropertiesControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WebAppPropertiesControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginUpdateProperties - Method to update properties for web applications. in a site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - webAppSiteName - Web app site name. +// - body - The content of the action request +// - options - WebAppPropertiesControllerClientBeginUpdatePropertiesOptions contains the optional parameters for the WebAppPropertiesControllerClient.BeginUpdateProperties +// method. +func (client *WebAppPropertiesControllerClient) BeginUpdateProperties(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, body WebAppPropertiesCollection, options *WebAppPropertiesControllerClientBeginUpdatePropertiesOptions) (*runtime.Poller[WebAppPropertiesControllerClientUpdatePropertiesResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.updateProperties(ctx, resourceGroupName, siteName, webAppSiteName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[WebAppPropertiesControllerClientUpdatePropertiesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[WebAppPropertiesControllerClientUpdatePropertiesResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// UpdateProperties - Method to update properties for web applications. in a site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *WebAppPropertiesControllerClient) updateProperties(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, body WebAppPropertiesCollection, options *WebAppPropertiesControllerClientBeginUpdatePropertiesOptions) (*http.Response, error) { + var err error + const operationName = "WebAppPropertiesControllerClient.BeginUpdateProperties" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updatePropertiesCreateRequest(ctx, resourceGroupName, siteName, webAppSiteName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updatePropertiesCreateRequest creates the UpdateProperties request. +func (client *WebAppPropertiesControllerClient) updatePropertiesCreateRequest(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, body WebAppPropertiesCollection, options *WebAppPropertiesControllerClientBeginUpdatePropertiesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/webAppSites/{webAppSiteName}/updateProperties" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if webAppSiteName == "" { + return nil, errors.New("parameter webAppSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{webAppSiteName}", url.PathEscape(webAppSiteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/webapprunasaccountscontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/webapprunasaccountscontroller_client.go new file mode 100644 index 000000000000..6396e178cb65 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/webapprunasaccountscontroller_client.go @@ -0,0 +1,189 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// WebAppRunAsAccountsControllerClient contains the methods for the WebAppRunAsAccountsController group. +// Don't use this type directly, use NewWebAppRunAsAccountsControllerClient() instead. +type WebAppRunAsAccountsControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewWebAppRunAsAccountsControllerClient creates a new instance of WebAppRunAsAccountsControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewWebAppRunAsAccountsControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WebAppRunAsAccountsControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WebAppRunAsAccountsControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Method to get run as account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - webAppSiteName - Web app site name. +// - accountName - Run as account ARM name. +// - options - WebAppRunAsAccountsControllerClientGetOptions contains the optional parameters for the WebAppRunAsAccountsControllerClient.Get +// method. +func (client *WebAppRunAsAccountsControllerClient) Get(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, accountName string, options *WebAppRunAsAccountsControllerClientGetOptions) (WebAppRunAsAccountsControllerClientGetResponse, error) { + var err error + const operationName = "WebAppRunAsAccountsControllerClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, siteName, webAppSiteName, accountName, options) + if err != nil { + return WebAppRunAsAccountsControllerClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WebAppRunAsAccountsControllerClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return WebAppRunAsAccountsControllerClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *WebAppRunAsAccountsControllerClient) getCreateRequest(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, accountName string, options *WebAppRunAsAccountsControllerClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/webAppSites/{webAppSiteName}/runasaccounts/{accountName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if webAppSiteName == "" { + return nil, errors.New("parameter webAppSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{webAppSiteName}", url.PathEscape(webAppSiteName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *WebAppRunAsAccountsControllerClient) getHandleResponse(resp *http.Response) (WebAppRunAsAccountsControllerClientGetResponse, error) { + result := WebAppRunAsAccountsControllerClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.WebAppRunAsAccount); err != nil { + return WebAppRunAsAccountsControllerClientGetResponse{}, err + } + return result, nil +} + +// NewListByWebAppSitePager - Method to get all run as accounts. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - webAppSiteName - Web app site name. +// - options - WebAppRunAsAccountsControllerClientListByWebAppSiteOptions contains the optional parameters for the WebAppRunAsAccountsControllerClient.NewListByWebAppSitePager +// method. +func (client *WebAppRunAsAccountsControllerClient) NewListByWebAppSitePager(resourceGroupName string, siteName string, webAppSiteName string, options *WebAppRunAsAccountsControllerClientListByWebAppSiteOptions) *runtime.Pager[WebAppRunAsAccountsControllerClientListByWebAppSiteResponse] { + return runtime.NewPager(runtime.PagingHandler[WebAppRunAsAccountsControllerClientListByWebAppSiteResponse]{ + More: func(page WebAppRunAsAccountsControllerClientListByWebAppSiteResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WebAppRunAsAccountsControllerClientListByWebAppSiteResponse) (WebAppRunAsAccountsControllerClientListByWebAppSiteResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "WebAppRunAsAccountsControllerClient.NewListByWebAppSitePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByWebAppSiteCreateRequest(ctx, resourceGroupName, siteName, webAppSiteName, options) + }, nil) + if err != nil { + return WebAppRunAsAccountsControllerClientListByWebAppSiteResponse{}, err + } + return client.listByWebAppSiteHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByWebAppSiteCreateRequest creates the ListByWebAppSite request. +func (client *WebAppRunAsAccountsControllerClient) listByWebAppSiteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, options *WebAppRunAsAccountsControllerClientListByWebAppSiteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/webAppSites/{webAppSiteName}/runasaccounts" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if webAppSiteName == "" { + return nil, errors.New("parameter webAppSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{webAppSiteName}", url.PathEscape(webAppSiteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByWebAppSiteHandleResponse handles the ListByWebAppSite response. +func (client *WebAppRunAsAccountsControllerClient) listByWebAppSiteHandleResponse(resp *http.Response) (WebAppRunAsAccountsControllerClientListByWebAppSiteResponse, error) { + result := WebAppRunAsAccountsControllerClientListByWebAppSiteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.WebAppRunAsAccountListResult); err != nil { + return WebAppRunAsAccountsControllerClientListByWebAppSiteResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/webappsitescontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/webappsitescontroller_client.go new file mode 100644 index 000000000000..c1f8af53b9ef --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/webappsitescontroller_client.go @@ -0,0 +1,746 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// WebAppSitesControllerClient contains the methods for the WebAppSitesController group. +// Don't use this type directly, use NewWebAppSitesControllerClient() instead. +type WebAppSitesControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewWebAppSitesControllerClient creates a new instance of WebAppSitesControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewWebAppSitesControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WebAppSitesControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WebAppSitesControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Create - Method to create a WebApp site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - webAppSiteName - Web app site name. +// - body - Resource create parameters. +// - options - WebAppSitesControllerClientCreateOptions contains the optional parameters for the WebAppSitesControllerClient.Create +// method. +func (client *WebAppSitesControllerClient) Create(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, body WebAppSite, options *WebAppSitesControllerClientCreateOptions) (WebAppSitesControllerClientCreateResponse, error) { + var err error + const operationName = "WebAppSitesControllerClient.Create" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, siteName, webAppSiteName, body, options) + if err != nil { + return WebAppSitesControllerClientCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WebAppSitesControllerClientCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return WebAppSitesControllerClientCreateResponse{}, err + } + resp, err := client.createHandleResponse(httpResp) + return resp, err +} + +// createCreateRequest creates the Create request. +func (client *WebAppSitesControllerClient) createCreateRequest(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, body WebAppSite, options *WebAppSitesControllerClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/webAppSites/{webAppSiteName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if webAppSiteName == "" { + return nil, errors.New("parameter webAppSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{webAppSiteName}", url.PathEscape(webAppSiteName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *WebAppSitesControllerClient) createHandleResponse(resp *http.Response) (WebAppSitesControllerClientCreateResponse, error) { + result := WebAppSitesControllerClientCreateResponse{} + if val := resp.Header.Get("Retry-After"); val != "" { + retryAfter32, err := strconv.ParseInt(val, 10, 32) + retryAfter := int32(retryAfter32) + if err != nil { + return WebAppSitesControllerClientCreateResponse{}, err + } + result.RetryAfter = &retryAfter + } + if err := runtime.UnmarshalAsJSON(resp, &result.WebAppSite); err != nil { + return WebAppSitesControllerClientCreateResponse{}, err + } + return result, nil +} + +// BeginDelete - Deletes the WebApp site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - webAppSiteName - Web app site name. +// - options - WebAppSitesControllerClientBeginDeleteOptions contains the optional parameters for the WebAppSitesControllerClient.BeginDelete +// method. +func (client *WebAppSitesControllerClient) BeginDelete(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, options *WebAppSitesControllerClientBeginDeleteOptions) (*runtime.Poller[WebAppSitesControllerClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, siteName, webAppSiteName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[WebAppSitesControllerClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[WebAppSitesControllerClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes the WebApp site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *WebAppSitesControllerClient) deleteOperation(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, options *WebAppSitesControllerClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "WebAppSitesControllerClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, siteName, webAppSiteName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *WebAppSitesControllerClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, options *WebAppSitesControllerClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/webAppSites/{webAppSiteName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if webAppSiteName == "" { + return nil, errors.New("parameter webAppSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{webAppSiteName}", url.PathEscape(webAppSiteName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// ErrorSummary - MMethod to get error summary from web app site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - webAppSiteName - Web app site name. +// - body - The content of the action request +// - options - WebAppSitesControllerClientErrorSummaryOptions contains the optional parameters for the WebAppSitesControllerClient.ErrorSummary +// method. +func (client *WebAppSitesControllerClient) ErrorSummary(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, body ErrorSummaryRequest, options *WebAppSitesControllerClientErrorSummaryOptions) (WebAppSitesControllerClientErrorSummaryResponse, error) { + var err error + const operationName = "WebAppSitesControllerClient.ErrorSummary" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.errorSummaryCreateRequest(ctx, resourceGroupName, siteName, webAppSiteName, body, options) + if err != nil { + return WebAppSitesControllerClientErrorSummaryResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WebAppSitesControllerClientErrorSummaryResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return WebAppSitesControllerClientErrorSummaryResponse{}, err + } + resp, err := client.errorSummaryHandleResponse(httpResp) + return resp, err +} + +// errorSummaryCreateRequest creates the ErrorSummary request. +func (client *WebAppSitesControllerClient) errorSummaryCreateRequest(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, body ErrorSummaryRequest, options *WebAppSitesControllerClientErrorSummaryOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/webAppSites/{webAppSiteName}/errorSummary" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if webAppSiteName == "" { + return nil, errors.New("parameter webAppSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{webAppSiteName}", url.PathEscape(webAppSiteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// errorSummaryHandleResponse handles the ErrorSummary response. +func (client *WebAppSitesControllerClient) errorSummaryHandleResponse(resp *http.Response) (WebAppSitesControllerClientErrorSummaryResponse, error) { + result := WebAppSitesControllerClientErrorSummaryResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SiteErrorSummary); err != nil { + return WebAppSitesControllerClientErrorSummaryResponse{}, err + } + return result, nil +} + +// BeginExportInventory - Method to generate report containing web app inventory. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - webAppSiteName - Web app site name. +// - body - The content of the action request +// - options - WebAppSitesControllerClientBeginExportInventoryOptions contains the optional parameters for the WebAppSitesControllerClient.BeginExportInventory +// method. +func (client *WebAppSitesControllerClient) BeginExportInventory(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, body ExportWebAppsRequest, options *WebAppSitesControllerClientBeginExportInventoryOptions) (*runtime.Poller[WebAppSitesControllerClientExportInventoryResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.exportInventory(ctx, resourceGroupName, siteName, webAppSiteName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[WebAppSitesControllerClientExportInventoryResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[WebAppSitesControllerClientExportInventoryResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ExportInventory - Method to generate report containing web app inventory. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *WebAppSitesControllerClient) exportInventory(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, body ExportWebAppsRequest, options *WebAppSitesControllerClientBeginExportInventoryOptions) (*http.Response, error) { + var err error + const operationName = "WebAppSitesControllerClient.BeginExportInventory" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.exportInventoryCreateRequest(ctx, resourceGroupName, siteName, webAppSiteName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// exportInventoryCreateRequest creates the ExportInventory request. +func (client *WebAppSitesControllerClient) exportInventoryCreateRequest(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, body ExportWebAppsRequest, options *WebAppSitesControllerClientBeginExportInventoryOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/webAppSites/{webAppSiteName}/exportInventory" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if webAppSiteName == "" { + return nil, errors.New("parameter webAppSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{webAppSiteName}", url.PathEscape(webAppSiteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// Get - Method to get a site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - webAppSiteName - Web app site name. +// - options - WebAppSitesControllerClientGetOptions contains the optional parameters for the WebAppSitesControllerClient.Get +// method. +func (client *WebAppSitesControllerClient) Get(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, options *WebAppSitesControllerClientGetOptions) (WebAppSitesControllerClientGetResponse, error) { + var err error + const operationName = "WebAppSitesControllerClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, siteName, webAppSiteName, options) + if err != nil { + return WebAppSitesControllerClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WebAppSitesControllerClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return WebAppSitesControllerClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *WebAppSitesControllerClient) getCreateRequest(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, options *WebAppSitesControllerClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/webAppSites/{webAppSiteName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if webAppSiteName == "" { + return nil, errors.New("parameter webAppSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{webAppSiteName}", url.PathEscape(webAppSiteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *WebAppSitesControllerClient) getHandleResponse(resp *http.Response) (WebAppSitesControllerClientGetResponse, error) { + result := WebAppSitesControllerClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.WebAppSite); err != nil { + return WebAppSitesControllerClientGetResponse{}, err + } + return result, nil +} + +// NewListByMasterSitePager - Method to get all sites. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - options - WebAppSitesControllerClientListByMasterSiteOptions contains the optional parameters for the WebAppSitesControllerClient.NewListByMasterSitePager +// method. +func (client *WebAppSitesControllerClient) NewListByMasterSitePager(resourceGroupName string, siteName string, options *WebAppSitesControllerClientListByMasterSiteOptions) *runtime.Pager[WebAppSitesControllerClientListByMasterSiteResponse] { + return runtime.NewPager(runtime.PagingHandler[WebAppSitesControllerClientListByMasterSiteResponse]{ + More: func(page WebAppSitesControllerClientListByMasterSiteResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WebAppSitesControllerClientListByMasterSiteResponse) (WebAppSitesControllerClientListByMasterSiteResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "WebAppSitesControllerClient.NewListByMasterSitePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByMasterSiteCreateRequest(ctx, resourceGroupName, siteName, options) + }, nil) + if err != nil { + return WebAppSitesControllerClientListByMasterSiteResponse{}, err + } + return client.listByMasterSiteHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByMasterSiteCreateRequest creates the ListByMasterSite request. +func (client *WebAppSitesControllerClient) listByMasterSiteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, options *WebAppSitesControllerClientListByMasterSiteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/webAppSites" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByMasterSiteHandleResponse handles the ListByMasterSite response. +func (client *WebAppSitesControllerClient) listByMasterSiteHandleResponse(resp *http.Response) (WebAppSitesControllerClientListByMasterSiteResponse, error) { + result := WebAppSitesControllerClientListByMasterSiteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.WebAppSiteListResult); err != nil { + return WebAppSitesControllerClientListByMasterSiteResponse{}, err + } + return result, nil +} + +// BeginRefresh - Method to refresh a site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - webAppSiteName - Web app site name. +// - body - The content of the action request +// - options - WebAppSitesControllerClientBeginRefreshOptions contains the optional parameters for the WebAppSitesControllerClient.BeginRefresh +// method. +func (client *WebAppSitesControllerClient) BeginRefresh(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, body ProxySiteRefreshBody, options *WebAppSitesControllerClientBeginRefreshOptions) (*runtime.Poller[WebAppSitesControllerClientRefreshResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.refresh(ctx, resourceGroupName, siteName, webAppSiteName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[WebAppSitesControllerClientRefreshResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[WebAppSitesControllerClientRefreshResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Refresh - Method to refresh a site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *WebAppSitesControllerClient) refresh(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, body ProxySiteRefreshBody, options *WebAppSitesControllerClientBeginRefreshOptions) (*http.Response, error) { + var err error + const operationName = "WebAppSitesControllerClient.BeginRefresh" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.refreshCreateRequest(ctx, resourceGroupName, siteName, webAppSiteName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// refreshCreateRequest creates the Refresh request. +func (client *WebAppSitesControllerClient) refreshCreateRequest(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, body ProxySiteRefreshBody, options *WebAppSitesControllerClientBeginRefreshOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/webAppSites/{webAppSiteName}/refresh" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if webAppSiteName == "" { + return nil, errors.New("parameter webAppSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{webAppSiteName}", url.PathEscape(webAppSiteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// Summary - Method to get site usage/summary. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - webAppSiteName - Web app site name. +// - options - WebAppSitesControllerClientSummaryOptions contains the optional parameters for the WebAppSitesControllerClient.Summary +// method. +func (client *WebAppSitesControllerClient) Summary(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, options *WebAppSitesControllerClientSummaryOptions) (WebAppSitesControllerClientSummaryResponse, error) { + var err error + const operationName = "WebAppSitesControllerClient.Summary" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.summaryCreateRequest(ctx, resourceGroupName, siteName, webAppSiteName, options) + if err != nil { + return WebAppSitesControllerClientSummaryResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WebAppSitesControllerClientSummaryResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return WebAppSitesControllerClientSummaryResponse{}, err + } + resp, err := client.summaryHandleResponse(httpResp) + return resp, err +} + +// summaryCreateRequest creates the Summary request. +func (client *WebAppSitesControllerClient) summaryCreateRequest(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, options *WebAppSitesControllerClientSummaryOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/webAppSites/{webAppSiteName}/summary" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if webAppSiteName == "" { + return nil, errors.New("parameter webAppSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{webAppSiteName}", url.PathEscape(webAppSiteName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// summaryHandleResponse handles the Summary response. +func (client *WebAppSitesControllerClient) summaryHandleResponse(resp *http.Response) (WebAppSitesControllerClientSummaryResponse, error) { + result := WebAppSitesControllerClientSummaryResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.WebAppSiteUsage); err != nil { + return WebAppSitesControllerClientSummaryResponse{}, err + } + return result, nil +} + +// BeginUpdate - Method to update an existing site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - webAppSiteName - Web app site name. +// - properties - The resource properties to be updated. +// - options - WebAppSitesControllerClientBeginUpdateOptions contains the optional parameters for the WebAppSitesControllerClient.BeginUpdate +// method. +func (client *WebAppSitesControllerClient) BeginUpdate(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, properties WebAppSiteUpdate, options *WebAppSitesControllerClientBeginUpdateOptions) (*runtime.Poller[WebAppSitesControllerClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, siteName, webAppSiteName, properties, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[WebAppSitesControllerClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[WebAppSitesControllerClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Method to update an existing site. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *WebAppSitesControllerClient) update(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, properties WebAppSiteUpdate, options *WebAppSitesControllerClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "WebAppSitesControllerClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, siteName, webAppSiteName, properties, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *WebAppSitesControllerClient) updateCreateRequest(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, properties WebAppSiteUpdate, options *WebAppSitesControllerClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/webAppSites/{webAppSiteName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if webAppSiteName == "" { + return nil, errors.New("parameter webAppSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{webAppSiteName}", url.PathEscape(webAppSiteName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/webserverscontroller_client.go b/sdk/resourcemanager/migrate/armmigrate/webserverscontroller_client.go new file mode 100644 index 000000000000..abfb355296a1 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/webserverscontroller_client.go @@ -0,0 +1,127 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// WebServersControllerClient contains the methods for the WebServersController group. +// Don't use this type directly, use NewWebServersControllerClient() instead. +type WebServersControllerClient struct { + internal *arm.Client + subscriptionID string +} + +// NewWebServersControllerClient creates a new instance of WebServersControllerClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewWebServersControllerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WebServersControllerClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WebServersControllerClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListByWebAppSitePager - Method to get all web servers. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Site name +// - webAppSiteName - Web app site name. +// - options - WebServersControllerClientListByWebAppSiteOptions contains the optional parameters for the WebServersControllerClient.NewListByWebAppSitePager +// method. +func (client *WebServersControllerClient) NewListByWebAppSitePager(resourceGroupName string, siteName string, webAppSiteName string, options *WebServersControllerClientListByWebAppSiteOptions) *runtime.Pager[WebServersControllerClientListByWebAppSiteResponse] { + return runtime.NewPager(runtime.PagingHandler[WebServersControllerClientListByWebAppSiteResponse]{ + More: func(page WebServersControllerClientListByWebAppSiteResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WebServersControllerClientListByWebAppSiteResponse) (WebServersControllerClientListByWebAppSiteResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "WebServersControllerClient.NewListByWebAppSitePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByWebAppSiteCreateRequest(ctx, resourceGroupName, siteName, webAppSiteName, options) + }, nil) + if err != nil { + return WebServersControllerClientListByWebAppSiteResponse{}, err + } + return client.listByWebAppSiteHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByWebAppSiteCreateRequest creates the ListByWebAppSite request. +func (client *WebServersControllerClient) listByWebAppSiteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, webAppSiteName string, options *WebServersControllerClientListByWebAppSiteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/masterSites/{siteName}/webAppSites/{webAppSiteName}/webServers" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if webAppSiteName == "" { + return nil, errors.New("parameter webAppSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{webAppSiteName}", url.PathEscape(webAppSiteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + if options != nil && options.Filter != nil { + reqQP.Set("filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("top", *options.Top) + } + if options != nil && options.ContinuationToken != nil { + reqQP.Set("continuationToken", *options.ContinuationToken) + } + if options != nil && options.TotalRecordCount != nil { + reqQP.Set("totalRecordCount", strconv.FormatInt(int64(*options.TotalRecordCount), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByWebAppSiteHandleResponse handles the ListByWebAppSite response. +func (client *WebServersControllerClient) listByWebAppSiteHandleResponse(resp *http.Response) (WebServersControllerClientListByWebAppSiteResponse, error) { + result := WebServersControllerClientListByWebAppSiteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.WebServerListResult); err != nil { + return WebServersControllerClientListByWebAppSiteResponse{}, err + } + return result, nil +}