From d3141bc01bf5494c67e36bc0dbb7a483c9b35449 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 19 Nov 2024 03:25:28 +0000 Subject: [PATCH] CodeGen from PR 31543 in Azure/azure-rest-api-specs Merge 86d9b39c82444344723eb239f2f16aa47280dad7 into 14f4f6b25fe74f90f4ee74fdac5cd7e05d419245 --- .../CHANGELOG.md | 8 + .../LICENSE.txt | 21 + .../README.md | 92 + .../armcommonedgesitemanageroperations/ci.yml | 28 + .../client_factory.go | 37 + .../constants.go | 47 + .../fake/internal.go | 65 + .../fake/operations_server.go | 117 + .../fake/server_factory.go | 72 + .../armcommonedgesitemanageroperations/go.mod | 21 + .../armcommonedgesitemanageroperations/go.sum | 29 + .../models.go | 54 + .../models_serde.go | 145 + .../operations_client.go | 18 +- .../operations_client_example_test.go | 85 + .../options.go | 10 + .../responses.go | 11 + .../tsp-location.yaml | 4 + .../computefleet/armcomputefleet/CHANGELOG.md | 10 + .../computefleet/armcomputefleet/README.md | 2 +- .../computefleet/armcomputefleet/constants.go | 8 +- .../armcomputefleet/fake/fleets_server.go | 79 +- .../armcomputefleet/fake/internal.go | 5 + .../armcomputefleet/fake/operations_server.go | 45 +- .../fleets_client_example_test.go | 2 +- .../computefleet/armcomputefleet/go.mod | 12 +- .../computefleet/armcomputefleet/go.sum | 20 +- .../computefleet/armcomputefleet/models.go | 1 + .../operations_client_example_test.go | 2 +- .../armcomputefleet/tsp-location.yaml | 4 +- .../armconnectedcache/CHANGELOG.md | 8 + .../armconnectedcache/LICENSE.txt | 21 + .../armconnectedcache/README.md | 92 + .../cachenodesoperations_client.go | 426 + ...achenodesoperations_client_example_test.go | 394 + .../connectedcache/armconnectedcache/ci.yml | 28 + .../armconnectedcache/client_factory.go | 88 + .../armconnectedcache/constants.go | 248 + .../enterprisecustomeroperations_client.go | 426 + ...ecustomeroperations_client_example_test.go | 334 + ...nterprisemcccachenodesoperations_client.go | 488 + ...achenodesoperations_client_example_test.go | 684 + .../enterprisemcccustomers_client.go | 448 + ...erprisemcccustomers_client_example_test.go | 609 + .../fake/cachenodesoperations_server.go | 348 + .../enterprisecustomeroperations_server.go | 348 + ...nterprisemcccachenodesoperations_server.go | 383 + .../fake/enterprisemcccustomers_server.go | 361 + .../armconnectedcache/fake/internal.go | 65 + .../fake/ispcachenodesoperations_server.go | 426 + .../fake/ispcustomers_server.go | 361 + .../fake/operations_server.go | 117 + .../armconnectedcache/fake/server_factory.go | 124 + .../armconnectedcache/fake/time_rfc3339.go | 109 + .../connectedcache/armconnectedcache/go.mod | 21 + .../connectedcache/armconnectedcache/go.sum | 29 + .../ispcachenodesoperations_client.go | 558 + ...achenodesoperations_client_example_test.go | 724 + .../armconnectedcache/ispcustomers_client.go | 446 + .../ispcustomers_client_example_test.go | 770 + .../armconnectedcache/models.go | 897 ++ .../armconnectedcache/models_serde.go | 1827 +++ .../armconnectedcache}/operations_client.go | 18 +- .../operations_client_example_test.go | 56 + .../armconnectedcache/options.go | 234 + .../armconnectedcache/responses.go | 230 + .../armconnectedcache/time_rfc3339.go | 109 + .../armconnectedcache/tsp-location.yaml | 4 + .../contoso/armcontoso/CHANGELOG.md | 8 + .../contoso/armcontoso/LICENSE.txt | 21 + .../contoso/armcontoso/README.md | 92 + sdk/resourcemanager/contoso/armcontoso/ci.yml | 28 + .../contoso/armcontoso/client_factory.go | 48 + .../contoso/armcontoso/constants.go | 104 + .../contoso/armcontoso/employees_client.go | 444 + .../employees_client_example_test.go | 302 + .../armcontoso/fake/employees_server.go | 361 + .../contoso/armcontoso/fake/internal.go | 65 + .../armcontoso}/fake/operations_server.go | 71 +- .../contoso/armcontoso/fake/server_factory.go | 79 + .../contoso/armcontoso/fake/time_rfc3339.go | 109 + sdk/resourcemanager/contoso/armcontoso/go.mod | 21 + sdk/resourcemanager/contoso/armcontoso/go.sum | 29 + .../contoso/armcontoso/models.go | 125 + .../contoso/armcontoso/models_serde.go | 328 + .../contoso/armcontoso/operations_client.go | 84 + .../operations_client_example_test.go | 56 + .../contoso/armcontoso/options.go | 45 + .../contoso/armcontoso/responses.go | 46 + .../contoso/armcontoso/time_rfc3339.go | 109 + .../contoso/armcontoso/tsp-location.yaml | 4 + .../armdevopsinfrastructure/CHANGELOG.md | 40 + .../armdevopsinfrastructure/autorest.md | 13 - .../armdevopsinfrastructure/build.go | 7 - .../armdevopsinfrastructure/client_factory.go | 6 +- .../armdevopsinfrastructure/constants.go | 110 +- .../fake/imageversions_server.go | 55 +- .../armdevopsinfrastructure/fake/internal.go | 11 +- .../fake/pools_server.go | 81 +- .../fake/resourcedetails_server.go | 55 +- .../fake/server_factory.go | 27 +- .../fake/sku_server.go | 55 +- .../fake/subscriptionusages_server.go | 97 +- .../fake/time_rfc3339.go | 9 +- .../armdevopsinfrastructure/go.mod | 10 +- .../armdevopsinfrastructure/go.sum | 20 +- .../imageversions_client.go | 12 +- .../imageversions_client_example_test.go | 35 +- .../armdevopsinfrastructure/interfaces.go | 24 +- .../armdevopsinfrastructure/models.go | 337 +- .../armdevopsinfrastructure/models_serde.go | 577 +- .../operations_client.go | 41 +- .../operations_client_example_test.go | 22 +- .../armdevopsinfrastructure/options.go | 26 +- .../polymorphic_helpers.go | 56 +- .../armdevopsinfrastructure/pools_client.go | 56 +- .../pools_client_example_test.go | 346 +- .../resourcedetails_client.go | 12 +- .../resourcedetails_client_example_test.go | 53 +- .../armdevopsinfrastructure/responses.go | 26 +- .../armdevopsinfrastructure/sku_client.go | 12 +- .../sku_client_example_test.go | 516 +- .../subscriptionusages_client.go | 54 +- .../subscriptionusages_client_example_test.go | 55 +- .../armdevopsinfrastructure/time_rfc3339.go | 9 +- .../armdevopsinfrastructure/tsp-location.yaml | 4 + .../durabletask/armdurabletask/CHANGELOG.md | 8 + .../durabletask/armdurabletask/LICENSE.txt | 21 + .../durabletask/armdurabletask/README.md | 92 + .../durabletask/armdurabletask/ci.yml | 28 + .../armdurabletask/client_factory.go | 56 + .../durabletask/armdurabletask/constants.go | 122 + .../armdurabletask/fake/internal.go | 65 + .../armdurabletask}/fake/operations_server.go | 71 +- .../armdurabletask/fake/schedulers_server.go | 374 + .../armdurabletask/fake/server_factory.go | 86 + .../armdurabletask/fake/taskhubs_server.go | 293 + .../armdurabletask/fake/time_rfc3339.go | 109 + .../durabletask/armdurabletask/go.mod | 21 + .../durabletask/armdurabletask/go.sum | 29 + .../durabletask/armdurabletask/models.go | 173 + .../armdurabletask/models_serde.go | 453 + .../armdurabletask/operations_client.go | 84 + .../operations_client_example_test.go | 56 + .../durabletask/armdurabletask/options.go | 68 + .../durabletask/armdurabletask/responses.go | 69 + .../armdurabletask/schedulers_client.go | 455 + .../schedulers_client_example_test.go | 347 + .../armdurabletask/taskhubs_client.go | 340 + .../taskhubs_client_example_test.go | 166 + .../armdurabletask/time_rfc3339.go | 109 + .../armdurabletask/tsp-location.yaml | 4 + .../edgezones/armedgezones/CHANGELOG.md | 4 + .../edgezones/armedgezones/constants.go | 2 +- .../extendedzones_client_example_test.go | 199 + .../armedgezones/fake/extendedzones_server.go | 59 +- .../edgezones/armedgezones/fake/internal.go | 5 + .../armedgezones/fake/operations_server.go | 43 +- .../edgezones/armedgezones/go.mod | 12 +- .../edgezones/armedgezones/go.sum | 20 +- .../edgezones/armedgezones/models.go | 14 +- .../operations_client_example_test.go | 51 + .../edgezones/armedgezones/tsp-location.yaml | 6 +- .../fabric/armfabric/CHANGELOG.md | 4 + .../fabric/armfabric/capacities_client.go | 2 +- .../fabric/armfabric/constants.go | 2 +- .../armfabric/fake/capacities_server.go | 105 +- .../fabric/armfabric/fake/internal.go | 5 + .../armfabric/fake/operations_server.go | 43 +- sdk/resourcemanager/fabric/armfabric/go.mod | 10 +- sdk/resourcemanager/fabric/armfabric/go.sum | 20 +- .../fabric/armfabric/tsp-location.yaml | 4 +- .../armhealthdataaiservices/CHANGELOG.md | 10 + .../armhealthdataaiservices/constants.go | 8 +- .../deidservices_client.go | 30 +- .../deidservices_client_example_test.go | 12 +- .../fake/deidservices_server.go | 73 +- .../armhealthdataaiservices/fake/internal.go | 5 + .../fake/operations_server.go | 43 +- .../fake/privateendpointconnections_server.go | 61 +- .../fake/privatelinks_server.go | 43 +- .../armhealthdataaiservices/go.mod | 10 +- .../armhealthdataaiservices/go.sum | 20 +- .../operations_client.go | 4 +- .../operations_client_example_test.go | 8 +- .../privateendpointconnections_client.go | 20 +- ...endpointconnections_client_example_test.go | 8 +- .../privatelinks_client.go | 4 +- .../privatelinks_client_example_test.go | 2 +- .../armhealthdataaiservices/tsp-location.yaml | 2 +- .../armhybridconnectivity/CHANGELOG.md | 111 + .../armhybridconnectivity/README.md | 4 +- .../armhybridconnectivity/autorest.md | 13 - .../armhybridconnectivity/build.go | 7 - .../armhybridconnectivity/client_factory.go | 63 +- .../armhybridconnectivity/constants.go | 126 +- .../armhybridconnectivity/endpoints_client.go | 494 - .../endpoints_client_example_test.go | 340 - .../fake/endpoints_server.go | 448 - .../fake/generateawstemplate_server.go | 116 + .../armhybridconnectivity/fake/internal.go | 22 +- .../fake/inventory_server.go | 177 + .../fake/publiccloudconnectors_server.go | 400 + .../fake/server_factory.go | 67 +- .../fake/serviceconfigurations_server.go | 293 - .../fake/solutionconfigurations_server.go | 346 + .../fake/solutiontypes_server.go | 210 + .../fake/time_rfc3339.go | 51 +- .../generateawstemplate_client.go | 100 + ...generateawstemplate_client_example_test.go | 45 + .../armhybridconnectivity/go.mod | 12 +- .../armhybridconnectivity/go.sum | 20 +- .../armhybridconnectivity/inventory_client.go | 157 + .../inventory_client_example_test.go | 108 + .../armhybridconnectivity/models.go | 386 +- .../armhybridconnectivity/models_serde.go | 776 +- .../operations_client_example_test.go | 126 - .../armhybridconnectivity/options.go | 108 +- .../publiccloudconnectors_client.go | 502 + ...bliccloudconnectors_client_example_test.go | 405 + .../armhybridconnectivity/response_types.go | 91 - .../armhybridconnectivity/responses.go | 116 + .../serviceconfigurations_client.go | 320 - ...rviceconfigurations_client_example_test.go | 235 - .../solutionconfigurations_client.go | 391 + ...utionconfigurations_client_example_test.go | 301 + .../solutiontypes_client.go | 219 + .../solutiontypes_client_example_test.go | 194 + .../armhybridconnectivity/time_rfc3339.go | 51 +- .../armhybridconnectivity/tsp-location.yaml | 4 + .../armiotoperations/CHANGELOG.md | 10 + .../armiotoperations/constants.go | 8 +- .../dataflowendpoint_client_example_test.go | 186 +- .../armiotoperations/fake/broker_server.go | 61 +- .../fake/brokerauthentication_server.go | 61 +- .../fake/brokerauthorization_server.go | 61 +- .../fake/brokerlistener_server.go | 61 +- .../armiotoperations/fake/dataflow_server.go | 61 +- .../fake/dataflowendpoint_server.go | 61 +- .../fake/dataflowprofile_server.go | 61 +- .../armiotoperations/fake/instance_server.go | 69 +- .../armiotoperations/fake/internal.go | 5 + .../fake/operations_server.go | 43 +- .../iotoperations/armiotoperations/go.mod | 10 +- .../iotoperations/armiotoperations/go.sum | 20 +- .../armiotoperations/tsp-location.yaml | 4 +- .../mongocluster/armmongocluster/CHANGELOG.md | 4 + .../mongocluster/armmongocluster/constants.go | 2 +- .../fake/firewallrules_server.go | 61 +- .../armmongocluster/fake/internal.go | 5 + .../fake/mongoclusters_server.go | 91 +- .../armmongocluster/fake/operations_server.go | 43 +- .../fake/privateendpointconnections_server.go | 61 +- .../fake/privatelinks_server.go | 43 +- .../armmongocluster/fake/replicas_server.go | 43 +- .../firewallrules_client_example_test.go | 8 +- .../mongocluster/armmongocluster/go.mod | 10 +- .../mongocluster/armmongocluster/go.sum | 20 +- .../armmongocluster/mongoclusters_client.go | 2 +- .../mongoclusters_client_example_test.go | 30 +- .../operations_client_example_test.go | 2 +- ...endpointconnections_client_example_test.go | 8 +- .../privatelinks_client_example_test.go | 2 +- .../replicas_client_example_test.go | 2 +- .../armmongocluster/tsp-location.yaml | 4 +- .../neonpostgres/armneonpostgres/CHANGELOG.md | 8 + .../neonpostgres/armneonpostgres/LICENSE.txt | 21 + .../neonpostgres/armneonpostgres/README.md | 92 + .../neonpostgres/armneonpostgres/ci.yml | 28 + .../armneonpostgres/client_factory.go | 48 + .../neonpostgres/armneonpostgres/constants.go | 138 + .../armneonpostgres/fake/internal.go | 65 + .../armneonpostgres/fake/operations_server.go | 117 + .../fake/organizations_server.go | 374 + .../armneonpostgres/fake/server_factory.go | 81 + .../armneonpostgres/fake/time_rfc3339.go | 109 + .../neonpostgres/armneonpostgres/go.mod | 21 + .../neonpostgres/armneonpostgres/go.sum | 29 + .../neonpostgres/armneonpostgres/models.go | 227 + .../armneonpostgres/models_serde.go | 563 + .../armneonpostgres/operations_client.go | 84 + .../operations_client_example_test.go | 56 + .../neonpostgres/armneonpostgres/options.go | 46 + .../armneonpostgres/organizations_client.go | 457 + .../organizations_client_example_test.go | 546 + .../neonpostgres/armneonpostgres/responses.go | 46 + .../armneonpostgres/time_rfc3339.go | 109 + .../armneonpostgres/tsp-location.yaml | 4 + .../sitemanager/armsitemanager/CHANGELOG.md | 8 + .../sitemanager/armsitemanager/LICENSE.txt | 21 + .../sitemanager/armsitemanager/README.md | 92 + .../sitemanager/armsitemanager/ci.yml | 28 + .../armsitemanager/client_factory.go | 49 + .../sitemanager/armsitemanager/constants.go | 55 + .../armsitemanager/fake/internal.go | 65 + .../armsitemanager/fake/server_factory.go | 81 + .../armsitemanager/fake/sites_server.go | 307 + .../fake/sitesbysubscription_server.go | 287 + .../armsitemanager/fake/time_rfc3339.go | 109 + .../sitemanager/armsitemanager/go.mod | 21 + .../sitemanager/armsitemanager/go.sum | 29 + .../sitemanager/armsitemanager/models.go | 88 + .../armsitemanager/models_serde.go | 254 + .../sitemanager/armsitemanager/options.go | 59 + .../sitemanager/armsitemanager/responses.go | 63 + .../armsitemanager/sites_client.go | 368 + .../sites_client_example_test.go | 188 + .../sitesbysubscription_client.go | 345 + ...sitesbysubscription_client_example_test.go | 188 + .../armsitemanager/time_rfc3339.go | 109 + .../armsitemanager/tsp-location.yaml | 4 + .../standbypool/armstandbypool/CHANGELOG.md | 4 + .../standbypool/armstandbypool/constants.go | 2 +- .../armstandbypool/fake/internal.go | 5 + .../armstandbypool/fake/operations_server.go | 43 +- ...bycontainergrouppoolruntimeviews_server.go | 47 +- .../fake/standbycontainergrouppools_server.go | 69 +- ...byvirtualmachinepoolruntimeviews_server.go | 47 +- .../fake/standbyvirtualmachinepools_server.go | 69 +- .../fake/standbyvirtualmachines_server.go | 47 +- .../standbypool/armstandbypool/go.mod | 10 +- .../standbypool/armstandbypool/go.sum | 20 +- .../armstandbypool/tsp-location.yaml | 4 +- .../terraform/armterraform/CHANGELOG.md | 8 + .../terraform/armterraform/LICENSE.txt | 21 + .../terraform/armterraform/README.md | 92 + .../terraform/armterraform/ci.yml | 28 + .../terraform/armterraform/client_factory.go | 48 + .../terraform/armterraform/constants.go | 104 + .../terraform/armterraform/fake/internal.go | 78 + .../armterraform}/fake/operations_server.go | 71 +- .../armterraform/fake/polymorphic_helpers.go | 35 + .../armterraform/fake/server_factory.go | 79 + .../armterraform/fake/terraform_server.go | 135 + .../armterraform/fake/time_rfc3339.go | 109 + .../terraform/armterraform/go.mod | 21 + .../terraform/armterraform/go.sum | 29 + .../terraform/armterraform/interfaces.go | 14 + .../terraform/armterraform/models.go | 253 + .../terraform/armterraform/models_serde.go | 501 + .../armterraform/operations_client.go | 84 + .../operations_client_example_test.go | 61 + .../terraform/armterraform/options.go | 17 + .../terraform/armterraform/responses.go | 17 + .../armterraform/terraform_client.go | 112 + .../terraform_client_example_test.go | 37 + .../terraform/armterraform/time_rfc3339.go | 109 + .../terraform/armterraform/tsp-location.yaml | 4 + .../armtrustedsigning/CHANGELOG.md | 12 + .../certificateprofiles_client.go | 24 +- ...certificateprofiles_client_example_test.go | 37 +- .../codesigningaccounts_client.go | 34 +- ...codesigningaccounts_client_example_test.go | 14 +- .../armtrustedsigning/constants.go | 2 +- .../fake/certificateprofiles_server.go | 65 +- .../fake/codesigningaccounts_server.go | 77 +- .../armtrustedsigning/fake/internal.go | 5 + .../fake/operations_server.go | 43 +- .../trustedsigning/armtrustedsigning/go.mod | 10 +- .../trustedsigning/armtrustedsigning/go.sum | 20 +- .../armtrustedsigning/models.go | 44 +- .../armtrustedsigning/models_serde.go | 67 +- .../armtrustedsigning/operations_client.go | 4 +- .../operations_client_example_test.go | 2 +- .../armtrustedsigning/tsp-location.yaml | 4 +- .../CHANGELOG.md | 83 + .../autorest.md | 13 - .../armworkloadssapvirtualinstance/build.go | 7 - .../client_factory.go | 29 +- .../constants.go | 299 +- .../fake/internal.go | 11 +- .../sapapplicationserverinstances_server.go | 179 +- ...go => sapcentralserverinstances_server.go} | 229 +- .../fake/sapdatabaseinstances_server.go | 179 +- .../fake/sapvirtualinstances_server.go | 251 +- .../fake/server_factory.go | 39 +- .../fake/time_rfc3339.go | 9 +- .../fake/workloads_server.go | 242 - .../armworkloadssapvirtualinstance/go.mod | 10 +- .../armworkloadssapvirtualinstance/go.sum | 20 +- .../interfaces.go | 6 +- .../armworkloadssapvirtualinstance/models.go | 381 +- .../models_serde.go | 301 +- .../operations_client_example_test.go | 316 - .../armworkloadssapvirtualinstance/options.go | 167 +- .../polymorphic_helpers.go | 30 +- .../responses.go | 134 +- .../responses_serde.go | 15 + .../sapapplicationserverinstances_client.go | 158 +- ...tionserverinstances_client_example_test.go | 757 +- ...sapcentralinstances_client_example_test.go | 606 - ...go => sapcentralserverinstances_client.go} | 253 +- ...tralserverinstances_client_example_test.go | 627 + .../sapdatabaseinstances_client.go | 158 +- ...apdatabaseinstances_client_example_test.go | 571 +- .../sapvirtualinstances_client.go | 369 +- ...sapvirtualinstances_client_example_test.go | 12139 +++++++++------- .../time_rfc3339.go | 9 +- .../tsp-location.yaml | 4 + .../workloads_client.go | 309 - .../workloads_client_example_test.go | 1194 -- 401 files changed, 46340 insertions(+), 15960 deletions(-) create mode 100644 sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/CHANGELOG.md create mode 100644 sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/LICENSE.txt create mode 100644 sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/README.md create mode 100644 sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/ci.yml create mode 100644 sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/client_factory.go create mode 100644 sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/constants.go create mode 100644 sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/fake/internal.go create mode 100644 sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/fake/operations_server.go create mode 100644 sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/fake/server_factory.go create mode 100644 sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/go.mod create mode 100644 sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/go.sum create mode 100644 sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/models.go create mode 100644 sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/models_serde.go rename sdk/resourcemanager/{hybridconnectivity/armhybridconnectivity => commonedgesitemanageroperations/armcommonedgesitemanageroperations}/operations_client.go (85%) create mode 100644 sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/operations_client_example_test.go create mode 100644 sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/options.go create mode 100644 sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/responses.go create mode 100644 sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/tsp-location.yaml create mode 100644 sdk/resourcemanager/connectedcache/armconnectedcache/CHANGELOG.md create mode 100644 sdk/resourcemanager/connectedcache/armconnectedcache/LICENSE.txt create mode 100644 sdk/resourcemanager/connectedcache/armconnectedcache/README.md create mode 100644 sdk/resourcemanager/connectedcache/armconnectedcache/cachenodesoperations_client.go create mode 100644 sdk/resourcemanager/connectedcache/armconnectedcache/cachenodesoperations_client_example_test.go create mode 100644 sdk/resourcemanager/connectedcache/armconnectedcache/ci.yml create mode 100644 sdk/resourcemanager/connectedcache/armconnectedcache/client_factory.go create mode 100644 sdk/resourcemanager/connectedcache/armconnectedcache/constants.go create mode 100644 sdk/resourcemanager/connectedcache/armconnectedcache/enterprisecustomeroperations_client.go create mode 100644 sdk/resourcemanager/connectedcache/armconnectedcache/enterprisecustomeroperations_client_example_test.go create mode 100644 sdk/resourcemanager/connectedcache/armconnectedcache/enterprisemcccachenodesoperations_client.go create mode 100644 sdk/resourcemanager/connectedcache/armconnectedcache/enterprisemcccachenodesoperations_client_example_test.go create mode 100644 sdk/resourcemanager/connectedcache/armconnectedcache/enterprisemcccustomers_client.go create mode 100644 sdk/resourcemanager/connectedcache/armconnectedcache/enterprisemcccustomers_client_example_test.go create mode 100644 sdk/resourcemanager/connectedcache/armconnectedcache/fake/cachenodesoperations_server.go create mode 100644 sdk/resourcemanager/connectedcache/armconnectedcache/fake/enterprisecustomeroperations_server.go create mode 100644 sdk/resourcemanager/connectedcache/armconnectedcache/fake/enterprisemcccachenodesoperations_server.go create mode 100644 sdk/resourcemanager/connectedcache/armconnectedcache/fake/enterprisemcccustomers_server.go create mode 100644 sdk/resourcemanager/connectedcache/armconnectedcache/fake/internal.go create mode 100644 sdk/resourcemanager/connectedcache/armconnectedcache/fake/ispcachenodesoperations_server.go create mode 100644 sdk/resourcemanager/connectedcache/armconnectedcache/fake/ispcustomers_server.go create mode 100644 sdk/resourcemanager/connectedcache/armconnectedcache/fake/operations_server.go create mode 100644 sdk/resourcemanager/connectedcache/armconnectedcache/fake/server_factory.go create mode 100644 sdk/resourcemanager/connectedcache/armconnectedcache/fake/time_rfc3339.go create mode 100644 sdk/resourcemanager/connectedcache/armconnectedcache/go.mod create mode 100644 sdk/resourcemanager/connectedcache/armconnectedcache/go.sum create mode 100644 sdk/resourcemanager/connectedcache/armconnectedcache/ispcachenodesoperations_client.go create mode 100644 sdk/resourcemanager/connectedcache/armconnectedcache/ispcachenodesoperations_client_example_test.go create mode 100644 sdk/resourcemanager/connectedcache/armconnectedcache/ispcustomers_client.go create mode 100644 sdk/resourcemanager/connectedcache/armconnectedcache/ispcustomers_client_example_test.go create mode 100644 sdk/resourcemanager/connectedcache/armconnectedcache/models.go create mode 100644 sdk/resourcemanager/connectedcache/armconnectedcache/models_serde.go rename sdk/resourcemanager/{workloadssapvirtualinstance/armworkloadssapvirtualinstance => connectedcache/armconnectedcache}/operations_client.go (84%) create mode 100644 sdk/resourcemanager/connectedcache/armconnectedcache/operations_client_example_test.go create mode 100644 sdk/resourcemanager/connectedcache/armconnectedcache/options.go create mode 100644 sdk/resourcemanager/connectedcache/armconnectedcache/responses.go create mode 100644 sdk/resourcemanager/connectedcache/armconnectedcache/time_rfc3339.go create mode 100644 sdk/resourcemanager/connectedcache/armconnectedcache/tsp-location.yaml create mode 100644 sdk/resourcemanager/contoso/armcontoso/CHANGELOG.md create mode 100644 sdk/resourcemanager/contoso/armcontoso/LICENSE.txt create mode 100644 sdk/resourcemanager/contoso/armcontoso/README.md create mode 100644 sdk/resourcemanager/contoso/armcontoso/ci.yml create mode 100644 sdk/resourcemanager/contoso/armcontoso/client_factory.go create mode 100644 sdk/resourcemanager/contoso/armcontoso/constants.go create mode 100644 sdk/resourcemanager/contoso/armcontoso/employees_client.go create mode 100644 sdk/resourcemanager/contoso/armcontoso/employees_client_example_test.go create mode 100644 sdk/resourcemanager/contoso/armcontoso/fake/employees_server.go create mode 100644 sdk/resourcemanager/contoso/armcontoso/fake/internal.go rename sdk/resourcemanager/{hybridconnectivity/armhybridconnectivity => contoso/armcontoso}/fake/operations_server.go (56%) create mode 100644 sdk/resourcemanager/contoso/armcontoso/fake/server_factory.go create mode 100644 sdk/resourcemanager/contoso/armcontoso/fake/time_rfc3339.go create mode 100644 sdk/resourcemanager/contoso/armcontoso/go.mod create mode 100644 sdk/resourcemanager/contoso/armcontoso/go.sum create mode 100644 sdk/resourcemanager/contoso/armcontoso/models.go create mode 100644 sdk/resourcemanager/contoso/armcontoso/models_serde.go create mode 100644 sdk/resourcemanager/contoso/armcontoso/operations_client.go create mode 100644 sdk/resourcemanager/contoso/armcontoso/operations_client_example_test.go create mode 100644 sdk/resourcemanager/contoso/armcontoso/options.go create mode 100644 sdk/resourcemanager/contoso/armcontoso/responses.go create mode 100644 sdk/resourcemanager/contoso/armcontoso/time_rfc3339.go create mode 100644 sdk/resourcemanager/contoso/armcontoso/tsp-location.yaml delete mode 100644 sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/autorest.md delete mode 100644 sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/build.go create mode 100644 sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/tsp-location.yaml create mode 100644 sdk/resourcemanager/durabletask/armdurabletask/CHANGELOG.md create mode 100644 sdk/resourcemanager/durabletask/armdurabletask/LICENSE.txt create mode 100644 sdk/resourcemanager/durabletask/armdurabletask/README.md create mode 100644 sdk/resourcemanager/durabletask/armdurabletask/ci.yml create mode 100644 sdk/resourcemanager/durabletask/armdurabletask/client_factory.go create mode 100644 sdk/resourcemanager/durabletask/armdurabletask/constants.go create mode 100644 sdk/resourcemanager/durabletask/armdurabletask/fake/internal.go rename sdk/resourcemanager/{workloadssapvirtualinstance/armworkloadssapvirtualinstance => durabletask/armdurabletask}/fake/operations_server.go (56%) create mode 100644 sdk/resourcemanager/durabletask/armdurabletask/fake/schedulers_server.go create mode 100644 sdk/resourcemanager/durabletask/armdurabletask/fake/server_factory.go create mode 100644 sdk/resourcemanager/durabletask/armdurabletask/fake/taskhubs_server.go create mode 100644 sdk/resourcemanager/durabletask/armdurabletask/fake/time_rfc3339.go create mode 100644 sdk/resourcemanager/durabletask/armdurabletask/go.mod create mode 100644 sdk/resourcemanager/durabletask/armdurabletask/go.sum create mode 100644 sdk/resourcemanager/durabletask/armdurabletask/models.go create mode 100644 sdk/resourcemanager/durabletask/armdurabletask/models_serde.go create mode 100644 sdk/resourcemanager/durabletask/armdurabletask/operations_client.go create mode 100644 sdk/resourcemanager/durabletask/armdurabletask/operations_client_example_test.go create mode 100644 sdk/resourcemanager/durabletask/armdurabletask/options.go create mode 100644 sdk/resourcemanager/durabletask/armdurabletask/responses.go create mode 100644 sdk/resourcemanager/durabletask/armdurabletask/schedulers_client.go create mode 100644 sdk/resourcemanager/durabletask/armdurabletask/schedulers_client_example_test.go create mode 100644 sdk/resourcemanager/durabletask/armdurabletask/taskhubs_client.go create mode 100644 sdk/resourcemanager/durabletask/armdurabletask/taskhubs_client_example_test.go create mode 100644 sdk/resourcemanager/durabletask/armdurabletask/time_rfc3339.go create mode 100644 sdk/resourcemanager/durabletask/armdurabletask/tsp-location.yaml create mode 100644 sdk/resourcemanager/edgezones/armedgezones/extendedzones_client_example_test.go create mode 100644 sdk/resourcemanager/edgezones/armedgezones/operations_client_example_test.go delete mode 100644 sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/autorest.md delete mode 100644 sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/build.go delete mode 100644 sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/endpoints_client.go delete mode 100644 sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/endpoints_client_example_test.go delete mode 100644 sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/endpoints_server.go create mode 100644 sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/generateawstemplate_server.go create mode 100644 sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/inventory_server.go create mode 100644 sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/publiccloudconnectors_server.go delete mode 100644 sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/serviceconfigurations_server.go create mode 100644 sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/solutionconfigurations_server.go create mode 100644 sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/solutiontypes_server.go create mode 100644 sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/generateawstemplate_client.go create mode 100644 sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/generateawstemplate_client_example_test.go create mode 100644 sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/inventory_client.go create mode 100644 sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/inventory_client_example_test.go delete mode 100644 sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/operations_client_example_test.go create mode 100644 sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/publiccloudconnectors_client.go create mode 100644 sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/publiccloudconnectors_client_example_test.go delete mode 100644 sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/response_types.go create mode 100644 sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/responses.go delete mode 100644 sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/serviceconfigurations_client.go delete mode 100644 sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/serviceconfigurations_client_example_test.go create mode 100644 sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/solutionconfigurations_client.go create mode 100644 sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/solutionconfigurations_client_example_test.go create mode 100644 sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/solutiontypes_client.go create mode 100644 sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/solutiontypes_client_example_test.go create mode 100644 sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/tsp-location.yaml create mode 100644 sdk/resourcemanager/neonpostgres/armneonpostgres/CHANGELOG.md create mode 100644 sdk/resourcemanager/neonpostgres/armneonpostgres/LICENSE.txt create mode 100644 sdk/resourcemanager/neonpostgres/armneonpostgres/README.md create mode 100644 sdk/resourcemanager/neonpostgres/armneonpostgres/ci.yml create mode 100644 sdk/resourcemanager/neonpostgres/armneonpostgres/client_factory.go create mode 100644 sdk/resourcemanager/neonpostgres/armneonpostgres/constants.go create mode 100644 sdk/resourcemanager/neonpostgres/armneonpostgres/fake/internal.go create mode 100644 sdk/resourcemanager/neonpostgres/armneonpostgres/fake/operations_server.go create mode 100644 sdk/resourcemanager/neonpostgres/armneonpostgres/fake/organizations_server.go create mode 100644 sdk/resourcemanager/neonpostgres/armneonpostgres/fake/server_factory.go create mode 100644 sdk/resourcemanager/neonpostgres/armneonpostgres/fake/time_rfc3339.go create mode 100644 sdk/resourcemanager/neonpostgres/armneonpostgres/go.mod create mode 100644 sdk/resourcemanager/neonpostgres/armneonpostgres/go.sum create mode 100644 sdk/resourcemanager/neonpostgres/armneonpostgres/models.go create mode 100644 sdk/resourcemanager/neonpostgres/armneonpostgres/models_serde.go create mode 100644 sdk/resourcemanager/neonpostgres/armneonpostgres/operations_client.go create mode 100644 sdk/resourcemanager/neonpostgres/armneonpostgres/operations_client_example_test.go create mode 100644 sdk/resourcemanager/neonpostgres/armneonpostgres/options.go create mode 100644 sdk/resourcemanager/neonpostgres/armneonpostgres/organizations_client.go create mode 100644 sdk/resourcemanager/neonpostgres/armneonpostgres/organizations_client_example_test.go create mode 100644 sdk/resourcemanager/neonpostgres/armneonpostgres/responses.go create mode 100644 sdk/resourcemanager/neonpostgres/armneonpostgres/time_rfc3339.go create mode 100644 sdk/resourcemanager/neonpostgres/armneonpostgres/tsp-location.yaml create mode 100644 sdk/resourcemanager/sitemanager/armsitemanager/CHANGELOG.md create mode 100644 sdk/resourcemanager/sitemanager/armsitemanager/LICENSE.txt create mode 100644 sdk/resourcemanager/sitemanager/armsitemanager/README.md create mode 100644 sdk/resourcemanager/sitemanager/armsitemanager/ci.yml create mode 100644 sdk/resourcemanager/sitemanager/armsitemanager/client_factory.go create mode 100644 sdk/resourcemanager/sitemanager/armsitemanager/constants.go create mode 100644 sdk/resourcemanager/sitemanager/armsitemanager/fake/internal.go create mode 100644 sdk/resourcemanager/sitemanager/armsitemanager/fake/server_factory.go create mode 100644 sdk/resourcemanager/sitemanager/armsitemanager/fake/sites_server.go create mode 100644 sdk/resourcemanager/sitemanager/armsitemanager/fake/sitesbysubscription_server.go create mode 100644 sdk/resourcemanager/sitemanager/armsitemanager/fake/time_rfc3339.go create mode 100644 sdk/resourcemanager/sitemanager/armsitemanager/go.mod create mode 100644 sdk/resourcemanager/sitemanager/armsitemanager/go.sum create mode 100644 sdk/resourcemanager/sitemanager/armsitemanager/models.go create mode 100644 sdk/resourcemanager/sitemanager/armsitemanager/models_serde.go create mode 100644 sdk/resourcemanager/sitemanager/armsitemanager/options.go create mode 100644 sdk/resourcemanager/sitemanager/armsitemanager/responses.go create mode 100644 sdk/resourcemanager/sitemanager/armsitemanager/sites_client.go create mode 100644 sdk/resourcemanager/sitemanager/armsitemanager/sites_client_example_test.go create mode 100644 sdk/resourcemanager/sitemanager/armsitemanager/sitesbysubscription_client.go create mode 100644 sdk/resourcemanager/sitemanager/armsitemanager/sitesbysubscription_client_example_test.go create mode 100644 sdk/resourcemanager/sitemanager/armsitemanager/time_rfc3339.go create mode 100644 sdk/resourcemanager/sitemanager/armsitemanager/tsp-location.yaml create mode 100644 sdk/resourcemanager/terraform/armterraform/CHANGELOG.md create mode 100644 sdk/resourcemanager/terraform/armterraform/LICENSE.txt create mode 100644 sdk/resourcemanager/terraform/armterraform/README.md create mode 100644 sdk/resourcemanager/terraform/armterraform/ci.yml create mode 100644 sdk/resourcemanager/terraform/armterraform/client_factory.go create mode 100644 sdk/resourcemanager/terraform/armterraform/constants.go create mode 100644 sdk/resourcemanager/terraform/armterraform/fake/internal.go rename sdk/resourcemanager/{devopsinfrastructure/armdevopsinfrastructure => terraform/armterraform}/fake/operations_server.go (56%) create mode 100644 sdk/resourcemanager/terraform/armterraform/fake/polymorphic_helpers.go create mode 100644 sdk/resourcemanager/terraform/armterraform/fake/server_factory.go create mode 100644 sdk/resourcemanager/terraform/armterraform/fake/terraform_server.go create mode 100644 sdk/resourcemanager/terraform/armterraform/fake/time_rfc3339.go create mode 100644 sdk/resourcemanager/terraform/armterraform/go.mod create mode 100644 sdk/resourcemanager/terraform/armterraform/go.sum create mode 100644 sdk/resourcemanager/terraform/armterraform/interfaces.go create mode 100644 sdk/resourcemanager/terraform/armterraform/models.go create mode 100644 sdk/resourcemanager/terraform/armterraform/models_serde.go create mode 100644 sdk/resourcemanager/terraform/armterraform/operations_client.go create mode 100644 sdk/resourcemanager/terraform/armterraform/operations_client_example_test.go create mode 100644 sdk/resourcemanager/terraform/armterraform/options.go create mode 100644 sdk/resourcemanager/terraform/armterraform/responses.go create mode 100644 sdk/resourcemanager/terraform/armterraform/terraform_client.go create mode 100644 sdk/resourcemanager/terraform/armterraform/terraform_client_example_test.go create mode 100644 sdk/resourcemanager/terraform/armterraform/time_rfc3339.go create mode 100644 sdk/resourcemanager/terraform/armterraform/tsp-location.yaml delete mode 100644 sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/autorest.md delete mode 100644 sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/build.go rename sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/{sapcentralinstances_server.go => sapcentralserverinstances_server.go} (60%) delete mode 100644 sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/workloads_server.go delete mode 100644 sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/operations_client_example_test.go create mode 100644 sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/responses_serde.go delete mode 100644 sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapcentralinstances_client_example_test.go rename sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/{sapcentralinstances_client.go => sapcentralserverinstances_client.go} (62%) create mode 100644 sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapcentralserverinstances_client_example_test.go create mode 100644 sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/tsp-location.yaml delete mode 100644 sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/workloads_client.go delete mode 100644 sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/workloads_client_example_test.go diff --git a/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/CHANGELOG.md b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/CHANGELOG.md new file mode 100644 index 000000000000..01959fa7cee2 --- /dev/null +++ b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 0.1.0 (2024-11-19) +### Other Changes + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt). \ No newline at end of file diff --git a/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/LICENSE.txt b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/README.md b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/README.md new file mode 100644 index 000000000000..c23a0cada0a4 --- /dev/null +++ b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/README.md @@ -0,0 +1,92 @@ +# Azure Commonedgesitemanageroperations Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations) + +The `armcommonedgesitemanageroperations` module provides operations for working with Azure Commonedgesitemanageroperations. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations) + +# Getting started + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.18 or above (You could download and install the latest version of Go from [here](https://go.dev/doc/install). It will replace the existing Go on your machine. If you want to install multiple Go versions on the same machine, you could refer this [doc](https://go.dev/doc/manage-install).) + +## Install the package + +This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management. + +Install the Azure Commonedgesitemanageroperations module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Commonedgesitemanageroperations. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more. + +```go +cred, err := azidentity.NewDefaultAzureCredential(nil) +``` + +For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). + +## Client Factory + +Azure Commonedgesitemanageroperations module consists of one or more clients. We provide a client factory which could be used to create any client in this module. + +```go +clientFactory, err := armcommonedgesitemanageroperations.NewClientFactory(, cred, nil) +``` + +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). + +```go +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, +} +clientFactory, err := armcommonedgesitemanageroperations.NewClientFactory(, cred, &options) +``` + +## Clients + +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.() +``` + +## Fakes + +The fake package contains types used for constructing in-memory fake servers used in unit tests. +This allows writing tests to cover various success/error conditions without the need for connecting to a live service. + +Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes. + +## Provide Feedback + +If you encounter bugs or have suggestions, please +[open an issue](https://github.com/Azure/azure-sdk-for-go/issues) and assign the `Commonedgesitemanageroperations` label. + +# Contributing + +This project welcomes contributions and suggestions. Most contributions require +you to agree to a Contributor License Agreement (CLA) declaring that you have +the right to, and actually do, grant us the rights to use your contribution. +For details, visit [https://cla.microsoft.com](https://cla.microsoft.com). + +When you submit a pull request, a CLA-bot will automatically determine whether +you need to provide a CLA and decorate the PR appropriately (e.g., label, +comment). Simply follow the instructions provided by the bot. You will only +need to do this once across all repos using our CLA. + +This project has adopted the +[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information, see the +[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any +additional questions or comments. \ No newline at end of file diff --git a/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/ci.yml b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/ci.yml new file mode 100644 index 000000000000..c93e7e50c045 --- /dev/null +++ b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/ci.yml @@ -0,0 +1,28 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/ + +extends: + template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations' diff --git a/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/client_factory.go b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/client_factory.go new file mode 100644 index 000000000000..70cf2a807c53 --- /dev/null +++ b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/client_factory.go @@ -0,0 +1,37 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armcommonedgesitemanageroperations + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" +) + +// ClientFactory is a client factory used to create any client in this module. +// Don't use this type directly, use NewClientFactory instead. +type ClientFactory struct { + internal *arm.Client +} + +// NewClientFactory creates a new instance of ClientFactory with the specified values. +// The parameter values will be propagated to any client created from this factory. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewClientFactory(credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + internal: internal, + }, nil +} + +// NewOperationsClient creates a new instance of OperationsClient. +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + return &OperationsClient{ + internal: c.internal, + } +} diff --git a/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/constants.go b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/constants.go new file mode 100644 index 000000000000..e8557d10db4a --- /dev/null +++ b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/constants.go @@ -0,0 +1,47 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armcommonedgesitemanageroperations + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations" + moduleVersion = "v0.1.0" +) + +// ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +type ActionType string + +const ( + // ActionTypeInternal - Actions are for internal-only APIs. + ActionTypeInternal ActionType = "Internal" +) + +// PossibleActionTypeValues returns the possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ + ActionTypeInternal, + } +} + +// 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 ( + // OriginSystem - Indicates the operation is initiated by a system. + OriginSystem Origin = "system" + // OriginUser - Indicates the operation is initiated by a user. + OriginUser Origin = "user" + // OriginUserSystem - Indicates the operation is initiated by a user or system. + OriginUserSystem Origin = "user,system" +) + +// PossibleOriginValues returns the possible values for the Origin const type. +func PossibleOriginValues() []Origin { + return []Origin{ + OriginSystem, + OriginUser, + OriginUserSystem, + } +} diff --git a/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/fake/internal.go b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/fake/internal.go new file mode 100644 index 000000000000..7425b6a669e2 --- /dev/null +++ b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/fake/internal.go @@ -0,0 +1,65 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "net/http" + "sync" +) + +type result struct { + resp *http.Response + err error +} + +type nonRetriableError struct { + error +} + +func (nonRetriableError) NonRetriable() { + // marker method +} + +func contains[T comparable](s []T, v T) bool { + for _, vv := range s { + if vv == v { + return true + } + } + return false +} + +func newTracker[T any]() *tracker[T] { + return &tracker[T]{ + items: map[string]*T{}, + } +} + +type tracker[T any] struct { + items map[string]*T + mu sync.Mutex +} + +func (p *tracker[T]) get(req *http.Request) *T { + p.mu.Lock() + defer p.mu.Unlock() + if item, ok := p.items[server.SanitizePagerPollerPath(req.URL.Path)]; ok { + return item + } + return nil +} + +func (p *tracker[T]) add(req *http.Request, item *T) { + p.mu.Lock() + defer p.mu.Unlock() + p.items[server.SanitizePagerPollerPath(req.URL.Path)] = item +} + +func (p *tracker[T]) remove(req *http.Request) { + p.mu.Lock() + defer p.mu.Unlock() + delete(p.items, server.SanitizePagerPollerPath(req.URL.Path)) +} diff --git a/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/fake/operations_server.go b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/fake/operations_server.go new file mode 100644 index 000000000000..7de928cb204c --- /dev/null +++ b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/fake/operations_server.go @@ -0,0 +1,117 @@ +// 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) Go Code Generator. DO NOT EDIT. + +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/commonedgesitemanageroperations/armcommonedgesitemanageroperations" + "net/http" +) + +// OperationsServer is a fake server for instances of the armcommonedgesitemanageroperations.OperationsClient type. +type OperationsServer struct { + // NewListPager is the fake for method OperationsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *armcommonedgesitemanageroperations.OperationsClientListOptions) (resp azfake.PagerResponder[armcommonedgesitemanageroperations.OperationsClientListResponse]) +} + +// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. +// The returned OperationsServerTransport instance is connected to an instance of armcommonedgesitemanageroperations.OperationsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewOperationsServerTransport(srv *OperationsServer) *OperationsServerTransport { + return &OperationsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armcommonedgesitemanageroperations.OperationsClientListResponse]](), + } +} + +// OperationsServerTransport connects instances of armcommonedgesitemanageroperations.OperationsClient to instances of OperationsServer. +// Don't use this type directly, use NewOperationsServerTransport instead. +type OperationsServerTransport struct { + srv *OperationsServer + newListPager *tracker[azfake.PagerResponder[armcommonedgesitemanageroperations.OperationsClientListResponse]] +} + +// Do implements the policy.Transporter interface for OperationsServerTransport. +func (o *OperationsServerTransport) 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")} + } + + return o.dispatchToMethodFake(req, method) +} + +func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if o.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := o.newListPager.get(req) + if newListPager == nil { + resp := o.srv.NewListPager(nil) + newListPager = &resp + o.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcommonedgesitemanageroperations.OperationsClientListResponse, 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) { + o.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + o.newListPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/fake/server_factory.go b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/fake/server_factory.go new file mode 100644 index 000000000000..04f376b5276f --- /dev/null +++ b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/fake/server_factory.go @@ -0,0 +1,72 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" + "sync" +) + +// ServerFactory is a fake server for instances of the armcommonedgesitemanageroperations.ClientFactory type. +type ServerFactory struct { + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer +} + +// NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. +// The returned ServerFactoryTransport instance is connected to an instance of armcommonedgesitemanageroperations.ClientFactory via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { + return &ServerFactoryTransport{ + srv: srv, + } +} + +// ServerFactoryTransport connects instances of armcommonedgesitemanageroperations.ClientFactory to instances of ServerFactory. +// Don't use this type directly, use NewServerFactoryTransport instead. +type ServerFactoryTransport struct { + srv *ServerFactory + trMu sync.Mutex + trOperationsServer *OperationsServerTransport +} + +// Do implements the policy.Transporter interface for ServerFactoryTransport. +func (s *ServerFactoryTransport) 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")} + } + + client := method[:strings.Index(method, ".")] + var resp *http.Response + var err error + + switch client { + case "OperationsClient": + initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) + resp, err = s.trOperationsServer.Do(req) + default: + err = fmt.Errorf("unhandled client %s", client) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func initServer[T any](s *ServerFactoryTransport, dst **T, src func() *T) { + s.trMu.Lock() + if *dst == nil { + *dst = src() + } + s.trMu.Unlock() +} diff --git a/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/go.mod b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/go.mod new file mode 100644 index 000000000000..836dffd74f7b --- /dev/null +++ b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/go.mod @@ -0,0 +1,21 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations + +go 1.18 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 +) + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect + github.com/golang-jwt/jwt/v5 v5.2.1 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect + github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect + golang.org/x/crypto v0.27.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/text v0.18.0 // indirect +) diff --git a/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/go.sum b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/go.sum new file mode 100644 index 000000000000..cbddbbd9ecec --- /dev/null +++ b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/go.sum @@ -0,0 +1,29 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 h1:JZg6HRh6W6U4OLl6lk7BZ7BLisIzM9dG1R50zUk9C/M= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0/go.mod h1:YL1xnZ6QejvQHWJrX/AvhFl4WW4rqHVoKspWNVwFk0M= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= +github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/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-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/models.go b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/models.go new file mode 100644 index 000000000000..ca31869cc55f --- /dev/null +++ b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/models.go @@ -0,0 +1,54 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armcommonedgesitemanageroperations + +// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +type Operation struct { + // Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + ActionType *ActionType + + // READ-ONLY; Localized display information for this particular operation. + Display *OperationDisplay + + // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure + // Resource Manager/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 and 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 { + // REQUIRED; The Operation items on this page + Value []*Operation + + // The link to the next page of items + NextLink *string +} diff --git a/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/models_serde.go b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/models_serde.go new file mode 100644 index 000000000000..90a3c297f88b --- /dev/null +++ b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/models_serde.go @@ -0,0 +1,145 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armcommonedgesitemanageroperations + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// 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 +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v any) error { + if data == nil || string(data) == "null" { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/operations_client.go b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/operations_client.go similarity index 85% rename from sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/operations_client.go rename to sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/operations_client.go index 0e03894c5f2c..ac7ee1e62067 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/operations_client.go +++ b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/operations_client.go @@ -1,12 +1,8 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. -package armhybridconnectivity +package armcommonedgesitemanageroperations import ( "context" @@ -37,9 +33,9 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO return client, nil } -// NewListPager - Lists the available Hybrid Connectivity REST API operations. +// NewListPager - List the operations for the provider // -// Generated from API version 2023-03-15 +// Generated from API version 2024-02-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]{ @@ -65,14 +61,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.HybridConnectivity/operations" +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Edge/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-03-15") + reqQP.Set("api-version", "2024-02-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/operations_client_example_test.go b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/operations_client_example_test.go new file mode 100644 index 000000000000..4ecc002d340c --- /dev/null +++ b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/operations_client_example_test.go @@ -0,0 +1,85 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armcommonedgesitemanageroperations_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations" + "log" +) + +// Generated from example definition: 2024-02-01-preview/Operations_List_MaximumSet_Gen.json +func ExampleOperationsClient_NewListPager_operationsListMaximumSetGenGeneratedByMaximumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcommonedgesitemanageroperations.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 = armcommonedgesitemanageroperations.OperationsClientListResponse{ + // OperationListResult: armcommonedgesitemanageroperations.OperationListResult{ + // Value: []*armcommonedgesitemanageroperations.Operation{ + // { + // Name: to.Ptr("jaczxpiqtdkz"), + // IsDataAction: to.Ptr(true), + // Display: &armcommonedgesitemanageroperations.OperationDisplay{ + // Provider: to.Ptr("oapgkefpoeegxjy"), + // Resource: to.Ptr("zyprevbuvdzgvb"), + // Operation: to.Ptr("heesmjbscdhwik"), + // Description: to.Ptr("ezjkmigqsov"), + // }, + // Origin: to.Ptr(armcommonedgesitemanageroperations.OriginUser), + // ActionType: to.Ptr(armcommonedgesitemanageroperations.ActionTypeInternal), + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2024-02-01-preview/Operations_List_MinimumSet_Gen.json +func ExampleOperationsClient_NewListPager_operationsListMaximumSetGenGeneratedByMinimumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcommonedgesitemanageroperations.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 = armcommonedgesitemanageroperations.OperationsClientListResponse{ + // OperationListResult: armcommonedgesitemanageroperations.OperationListResult{ + // }, + // } + } +} diff --git a/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/options.go b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/options.go new file mode 100644 index 000000000000..356d8c2d1002 --- /dev/null +++ b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/options.go @@ -0,0 +1,10 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armcommonedgesitemanageroperations + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/responses.go b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/responses.go new file mode 100644 index 000000000000..c3ea5c30c19c --- /dev/null +++ b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/responses.go @@ -0,0 +1,11 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armcommonedgesitemanageroperations + +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. +type OperationsClientListResponse struct { + // 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 +} diff --git a/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/tsp-location.yaml b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/tsp-location.yaml new file mode 100644 index 000000000000..9f37d4c21a90 --- /dev/null +++ b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/edge/Microsoft.Edge.Management +commit: df55cd8178ddd870dbd0c3b1e25c80e3ff48826c +repo: Azure/azure-rest-api-specs +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/CHANGELOG.md b/sdk/resourcemanager/computefleet/armcomputefleet/CHANGELOG.md index d91bbac6cf58..a38ea6c211fc 100644 --- a/sdk/resourcemanager/computefleet/armcomputefleet/CHANGELOG.md +++ b/sdk/resourcemanager/computefleet/armcomputefleet/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 2.0.0 (2024-11-19) +### Breaking Changes + +- `ManagedServiceIdentityTypeSystemAndUserAssigned` from enum `ManagedServiceIdentityType` has been removed + +### Features Added + +- New value `ManagedServiceIdentityTypeSystemAssignedUserAssigned` added to enum type `ManagedServiceIdentityType` + + ## 1.0.0 (2024-10-22) ### Breaking Changes diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/README.md b/sdk/resourcemanager/computefleet/armcomputefleet/README.md index d92afe0f9bd2..4cc26831f84d 100644 --- a/sdk/resourcemanager/computefleet/armcomputefleet/README.md +++ b/sdk/resourcemanager/computefleet/armcomputefleet/README.md @@ -18,7 +18,7 @@ This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for ve Install the Azure Compute Fleet module: ```sh -go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computefleet/armcomputefleet +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computefleet/armcomputefleet/v2 ``` ## Authorization diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/constants.go b/sdk/resourcemanager/computefleet/armcomputefleet/constants.go index 9a5b1d23be3c..61d7925319d2 100644 --- a/sdk/resourcemanager/computefleet/armcomputefleet/constants.go +++ b/sdk/resourcemanager/computefleet/armcomputefleet/constants.go @@ -6,7 +6,7 @@ package armcomputefleet const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computefleet/armcomputefleet" - moduleVersion = "v1.0.0" + moduleVersion = "v2.0.0" ) // AcceleratorManufacturer - Accelerator manufacturers supported by Azure VMs. @@ -449,10 +449,10 @@ type ManagedServiceIdentityType string const ( // ManagedServiceIdentityTypeNone - No managed identity. ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" - // ManagedServiceIdentityTypeSystemAndUserAssigned - System and user assigned managed identity. - ManagedServiceIdentityTypeSystemAndUserAssigned ManagedServiceIdentityType = "SystemAssigned,UserAssigned" // ManagedServiceIdentityTypeSystemAssigned - System assigned managed identity. ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned" + // ManagedServiceIdentityTypeSystemAssignedUserAssigned - System and user assigned managed identity. + ManagedServiceIdentityTypeSystemAssignedUserAssigned ManagedServiceIdentityType = "SystemAssigned,UserAssigned" // ManagedServiceIdentityTypeUserAssigned - User assigned managed identity. ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" ) @@ -461,8 +461,8 @@ const ( func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { return []ManagedServiceIdentityType{ ManagedServiceIdentityTypeNone, - ManagedServiceIdentityTypeSystemAndUserAssigned, ManagedServiceIdentityTypeSystemAssigned, + ManagedServiceIdentityTypeSystemAssignedUserAssigned, ManagedServiceIdentityTypeUserAssigned, } } diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/fake/fleets_server.go b/sdk/resourcemanager/computefleet/armcomputefleet/fake/fleets_server.go index 50095603add1..efd507989a10 100644 --- a/sdk/resourcemanager/computefleet/armcomputefleet/fake/fleets_server.go +++ b/sdk/resourcemanager/computefleet/armcomputefleet/fake/fleets_server.go @@ -12,7 +12,7 @@ import ( "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/computefleet/armcomputefleet" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computefleet/armcomputefleet/v2" "net/http" "net/url" "regexp" @@ -25,7 +25,7 @@ type FleetsServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, fleetName string, resource armcomputefleet.Fleet, options *armcomputefleet.FleetsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armcomputefleet.FleetsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method FleetsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, fleetName string, options *armcomputefleet.FleetsClientBeginDeleteOptions) (resp azfake.PollerResponder[armcomputefleet.FleetsClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method FleetsClient.Get @@ -88,29 +88,48 @@ func (f *FleetsServerTransport) Do(req *http.Request) (*http.Response, error) { } func (f *FleetsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error - - switch method { - case "FleetsClient.BeginCreateOrUpdate": - resp, err = f.dispatchBeginCreateOrUpdate(req) - case "FleetsClient.BeginDelete": - resp, err = f.dispatchBeginDelete(req) - case "FleetsClient.Get": - resp, err = f.dispatchGet(req) - case "FleetsClient.NewListByResourceGroupPager": - resp, err = f.dispatchNewListByResourceGroupPager(req) - case "FleetsClient.NewListBySubscriptionPager": - resp, err = f.dispatchNewListBySubscriptionPager(req) - case "FleetsClient.NewListVirtualMachineScaleSetsPager": - resp, err = f.dispatchNewListVirtualMachineScaleSetsPager(req) - case "FleetsClient.BeginUpdate": - resp, err = f.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - return resp, err + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if fleetsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = fleetsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "FleetsClient.BeginCreateOrUpdate": + res.resp, res.err = f.dispatchBeginCreateOrUpdate(req) + case "FleetsClient.BeginDelete": + res.resp, res.err = f.dispatchBeginDelete(req) + case "FleetsClient.Get": + res.resp, res.err = f.dispatchGet(req) + case "FleetsClient.NewListByResourceGroupPager": + res.resp, res.err = f.dispatchNewListByResourceGroupPager(req) + case "FleetsClient.NewListBySubscriptionPager": + res.resp, res.err = f.dispatchNewListBySubscriptionPager(req) + case "FleetsClient.NewListVirtualMachineScaleSetsPager": + res.resp, res.err = f.dispatchNewListVirtualMachineScaleSetsPager(req) + case "FleetsClient.BeginUpdate": + res.resp, res.err = f.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (f *FleetsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -194,9 +213,9 @@ func (f *FleetsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Re return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { f.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { f.beginDelete.remove(req) @@ -396,3 +415,9 @@ func (f *FleetsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Re return resp, nil } + +// set this to conditionally intercept incoming requests to FleetsServerTransport +var fleetsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/fake/internal.go b/sdk/resourcemanager/computefleet/armcomputefleet/fake/internal.go index 56a8f624f5f3..7425b6a669e2 100644 --- a/sdk/resourcemanager/computefleet/armcomputefleet/fake/internal.go +++ b/sdk/resourcemanager/computefleet/armcomputefleet/fake/internal.go @@ -10,6 +10,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/fake/operations_server.go b/sdk/resourcemanager/computefleet/armcomputefleet/fake/operations_server.go index a86d89fb4a63..1ca70f29e52a 100644 --- a/sdk/resourcemanager/computefleet/armcomputefleet/fake/operations_server.go +++ b/sdk/resourcemanager/computefleet/armcomputefleet/fake/operations_server.go @@ -11,7 +11,7 @@ import ( "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/computefleet/armcomputefleet" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computefleet/armcomputefleet/v2" "net/http" ) @@ -51,17 +51,36 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error } func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -90,3 +109,9 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/fleets_client_example_test.go b/sdk/resourcemanager/computefleet/armcomputefleet/fleets_client_example_test.go index 1499fe058820..eaa30bab6889 100644 --- a/sdk/resourcemanager/computefleet/armcomputefleet/fleets_client_example_test.go +++ b/sdk/resourcemanager/computefleet/armcomputefleet/fleets_client_example_test.go @@ -8,7 +8,7 @@ import ( "context" "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/computefleet/armcomputefleet" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computefleet/armcomputefleet/v2" "log" ) diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/go.mod b/sdk/resourcemanager/computefleet/armcomputefleet/go.mod index 43724ff7ef95..044b494f3b84 100644 --- a/sdk/resourcemanager/computefleet/armcomputefleet/go.mod +++ b/sdk/resourcemanager/computefleet/armcomputefleet/go.mod @@ -1,9 +1,9 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computefleet/armcomputefleet +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computefleet/armcomputefleet/v2 go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 ) @@ -14,8 +14,8 @@ require ( github.com/google/uuid v1.6.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.25.0 // indirect - golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect - golang.org/x/text v0.16.0 // indirect + golang.org/x/crypto v0.27.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/text v0.18.0 // indirect ) diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/go.sum b/sdk/resourcemanager/computefleet/armcomputefleet/go.sum index 09d275cb9a37..cbddbbd9ecec 100644 --- a/sdk/resourcemanager/computefleet/armcomputefleet/go.sum +++ b/sdk/resourcemanager/computefleet/armcomputefleet/go.sum @@ -1,5 +1,5 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 h1:JZg6HRh6W6U4OLl6lk7BZ7BLisIzM9dG1R50zUk9C/M= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0/go.mod h1:YL1xnZ6QejvQHWJrX/AvhFl4WW4rqHVoKspWNVwFk0M= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= @@ -17,13 +17,13 @@ github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmd github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= -golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= -golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/models.go b/sdk/resourcemanager/computefleet/armcomputefleet/models.go index caf2d6bf4392..5f1d6a67da41 100644 --- a/sdk/resourcemanager/computefleet/armcomputefleet/models.go +++ b/sdk/resourcemanager/computefleet/armcomputefleet/models.go @@ -908,6 +908,7 @@ type VMAttributes struct { LocalStorageInGiB *VMAttributeMinMaxDouble // Specifies whether the VMSize supporting local storage should be used to build Fleet or not. + // Included - Default if not specified as most Azure VMs support local storage. LocalStorageSupport *VMAttributeSupport // The range of memory in GiB per vCPU specified from min to max. Optional parameter. Either Min or Max is required if specified. diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/operations_client_example_test.go b/sdk/resourcemanager/computefleet/armcomputefleet/operations_client_example_test.go index 9ba1df570e27..306f65f68a20 100644 --- a/sdk/resourcemanager/computefleet/armcomputefleet/operations_client_example_test.go +++ b/sdk/resourcemanager/computefleet/armcomputefleet/operations_client_example_test.go @@ -7,7 +7,7 @@ package armcomputefleet_test import ( "context" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computefleet/armcomputefleet" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computefleet/armcomputefleet/v2" "log" ) diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/tsp-location.yaml b/sdk/resourcemanager/computefleet/armcomputefleet/tsp-location.yaml index c8d950e137b2..be8c73cbb427 100644 --- a/sdk/resourcemanager/computefleet/armcomputefleet/tsp-location.yaml +++ b/sdk/resourcemanager/computefleet/armcomputefleet/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/azurefleet/AzureFleet.Management -commit: c120171b3684d88562fa26ae7db5d22b7bfa95d8 +commit: df55cd8178ddd870dbd0c3b1e25c80e3ff48826c repo: Azure/azure-rest-api-specs -additionalDirectories: +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/CHANGELOG.md b/sdk/resourcemanager/connectedcache/armconnectedcache/CHANGELOG.md new file mode 100644 index 000000000000..f50be96a54c7 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 0.1.0 (2024-11-19) +### Other Changes + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/connectedcache/armconnectedcache` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt). \ No newline at end of file diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/LICENSE.txt b/sdk/resourcemanager/connectedcache/armconnectedcache/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/README.md b/sdk/resourcemanager/connectedcache/armconnectedcache/README.md new file mode 100644 index 000000000000..03d613917dab --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/README.md @@ -0,0 +1,92 @@ +# Azure Connectedcache Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/connectedcache/armconnectedcache)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/connectedcache/armconnectedcache) + +The `armconnectedcache` module provides operations for working with Azure Connectedcache. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/connectedcache/armconnectedcache) + +# Getting started + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.18 or above (You could download and install the latest version of Go from [here](https://go.dev/doc/install). It will replace the existing Go on your machine. If you want to install multiple Go versions on the same machine, you could refer this [doc](https://go.dev/doc/manage-install).) + +## Install the package + +This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management. + +Install the Azure Connectedcache module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/connectedcache/armconnectedcache +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Connectedcache. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more. + +```go +cred, err := azidentity.NewDefaultAzureCredential(nil) +``` + +For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). + +## Client Factory + +Azure Connectedcache module consists of one or more clients. We provide a client factory which could be used to create any client in this module. + +```go +clientFactory, err := armconnectedcache.NewClientFactory(, cred, nil) +``` + +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). + +```go +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, +} +clientFactory, err := armconnectedcache.NewClientFactory(, cred, &options) +``` + +## Clients + +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.NewCacheNodesOperationsClient() +``` + +## Fakes + +The fake package contains types used for constructing in-memory fake servers used in unit tests. +This allows writing tests to cover various success/error conditions without the need for connecting to a live service. + +Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes. + +## Provide Feedback + +If you encounter bugs or have suggestions, please +[open an issue](https://github.com/Azure/azure-sdk-for-go/issues) and assign the `Connectedcache` label. + +# Contributing + +This project welcomes contributions and suggestions. Most contributions require +you to agree to a Contributor License Agreement (CLA) declaring that you have +the right to, and actually do, grant us the rights to use your contribution. +For details, visit [https://cla.microsoft.com](https://cla.microsoft.com). + +When you submit a pull request, a CLA-bot will automatically determine whether +you need to provide a CLA and decorate the PR appropriately (e.g., label, +comment). Simply follow the instructions provided by the bot. You will only +need to do this once across all repos using our CLA. + +This project has adopted the +[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information, see the +[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any +additional questions or comments. \ No newline at end of file diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/cachenodesoperations_client.go b/sdk/resourcemanager/connectedcache/armconnectedcache/cachenodesoperations_client.go new file mode 100644 index 000000000000..5152cfdc05ff --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/cachenodesoperations_client.go @@ -0,0 +1,426 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armconnectedcache + +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" +) + +// CacheNodesOperationsClient contains the methods for the CacheNodesOperations group. +// Don't use this type directly, use NewCacheNodesOperationsClient() instead. +type CacheNodesOperationsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewCacheNodesOperationsClient creates a new instance of CacheNodesOperationsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewCacheNodesOperationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CacheNodesOperationsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CacheNodesOperationsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateorUpdate - Creates a cacheNodes with the specified create parameters +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - resource - Resource create parameters. +// - options - CacheNodesOperationsClientBeginCreateorUpdateOptions contains the optional parameters for the CacheNodesOperationsClient.BeginCreateorUpdate +// method. +func (client *CacheNodesOperationsClient) BeginCreateorUpdate(ctx context.Context, resourceGroupName string, customerResourceName string, resource CacheNodePreviewResource, options *CacheNodesOperationsClientBeginCreateorUpdateOptions) (*runtime.Poller[CacheNodesOperationsClientCreateorUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createorUpdate(ctx, resourceGroupName, customerResourceName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CacheNodesOperationsClientCreateorUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CacheNodesOperationsClientCreateorUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateorUpdate - Creates a cacheNodes with the specified create parameters +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +func (client *CacheNodesOperationsClient) createorUpdate(ctx context.Context, resourceGroupName string, customerResourceName string, resource CacheNodePreviewResource, options *CacheNodesOperationsClientBeginCreateorUpdateOptions) (*http.Response, error) { + var err error + const operationName = "CacheNodesOperationsClient.BeginCreateorUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createorUpdateCreateRequest(ctx, resourceGroupName, customerResourceName, resource, 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 +} + +// createorUpdateCreateRequest creates the CreateorUpdate request. +func (client *CacheNodesOperationsClient) createorUpdateCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, resource CacheNodePreviewResource, _ *CacheNodesOperationsClientBeginCreateorUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/cacheNodes/{customerResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + 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-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// Delete - Deletes an existing cache Node +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - options - CacheNodesOperationsClientDeleteOptions contains the optional parameters for the CacheNodesOperationsClient.Delete +// method. +func (client *CacheNodesOperationsClient) Delete(ctx context.Context, resourceGroupName string, customerResourceName string, options *CacheNodesOperationsClientDeleteOptions) (CacheNodesOperationsClientDeleteResponse, error) { + var err error + const operationName = "CacheNodesOperationsClient.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, customerResourceName, options) + if err != nil { + return CacheNodesOperationsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CacheNodesOperationsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return CacheNodesOperationsClientDeleteResponse{}, err + } + return CacheNodesOperationsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *CacheNodesOperationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, _ *CacheNodesOperationsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/cacheNodes/{customerResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + 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-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves the properties of a cacheNodes +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - options - CacheNodesOperationsClientGetOptions contains the optional parameters for the CacheNodesOperationsClient.Get +// method. +func (client *CacheNodesOperationsClient) Get(ctx context.Context, resourceGroupName string, customerResourceName string, options *CacheNodesOperationsClientGetOptions) (CacheNodesOperationsClientGetResponse, error) { + var err error + const operationName = "CacheNodesOperationsClient.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, customerResourceName, options) + if err != nil { + return CacheNodesOperationsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CacheNodesOperationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CacheNodesOperationsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *CacheNodesOperationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, _ *CacheNodesOperationsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/cacheNodes/{customerResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + 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-05-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 *CacheNodesOperationsClient) getHandleResponse(resp *http.Response) (CacheNodesOperationsClientGetResponse, error) { + result := CacheNodesOperationsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CacheNodePreviewResource); err != nil { + return CacheNodesOperationsClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Retrieves the properties of all ConnectedCache +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - CacheNodesOperationsClientListByResourceGroupOptions contains the optional parameters for the CacheNodesOperationsClient.NewListByResourceGroupPager +// method. +func (client *CacheNodesOperationsClient) NewListByResourceGroupPager(resourceGroupName string, options *CacheNodesOperationsClientListByResourceGroupOptions) *runtime.Pager[CacheNodesOperationsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[CacheNodesOperationsClientListByResourceGroupResponse]{ + More: func(page CacheNodesOperationsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CacheNodesOperationsClientListByResourceGroupResponse) (CacheNodesOperationsClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CacheNodesOperationsClient.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 CacheNodesOperationsClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *CacheNodesOperationsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *CacheNodesOperationsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/cacheNodes" + 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-05-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 *CacheNodesOperationsClient) listByResourceGroupHandleResponse(resp *http.Response) (CacheNodesOperationsClientListByResourceGroupResponse, error) { + result := CacheNodesOperationsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CacheNodePreviewResourceListResult); err != nil { + return CacheNodesOperationsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - Retrieves the properties of all ConnectedCaches +// +// Generated from API version 2023-05-01-preview +// - options - CacheNodesOperationsClientListBySubscriptionOptions contains the optional parameters for the CacheNodesOperationsClient.NewListBySubscriptionPager +// method. +func (client *CacheNodesOperationsClient) NewListBySubscriptionPager(options *CacheNodesOperationsClientListBySubscriptionOptions) *runtime.Pager[CacheNodesOperationsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[CacheNodesOperationsClientListBySubscriptionResponse]{ + More: func(page CacheNodesOperationsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CacheNodesOperationsClientListBySubscriptionResponse) (CacheNodesOperationsClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CacheNodesOperationsClient.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 CacheNodesOperationsClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *CacheNodesOperationsClient) listBySubscriptionCreateRequest(ctx context.Context, _ *CacheNodesOperationsClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ConnectedCache/cacheNodes" + 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-05-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 *CacheNodesOperationsClient) listBySubscriptionHandleResponse(resp *http.Response) (CacheNodesOperationsClientListBySubscriptionResponse, error) { + result := CacheNodesOperationsClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CacheNodePreviewResourceListResult); err != nil { + return CacheNodesOperationsClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// Update - updates an existing Cache Node +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - properties - The resource properties to be updated. +// - options - CacheNodesOperationsClientUpdateOptions contains the optional parameters for the CacheNodesOperationsClient.Update +// method. +func (client *CacheNodesOperationsClient) Update(ctx context.Context, resourceGroupName string, customerResourceName string, properties PatchResource, options *CacheNodesOperationsClientUpdateOptions) (CacheNodesOperationsClientUpdateResponse, error) { + var err error + const operationName = "CacheNodesOperationsClient.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, customerResourceName, properties, options) + if err != nil { + return CacheNodesOperationsClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CacheNodesOperationsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CacheNodesOperationsClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *CacheNodesOperationsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, properties PatchResource, _ *CacheNodesOperationsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/cacheNodes/{customerResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + 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-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *CacheNodesOperationsClient) updateHandleResponse(resp *http.Response) (CacheNodesOperationsClientUpdateResponse, error) { + result := CacheNodesOperationsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CacheNodePreviewResource); err != nil { + return CacheNodesOperationsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/cachenodesoperations_client_example_test.go b/sdk/resourcemanager/connectedcache/armconnectedcache/cachenodesoperations_client_example_test.go new file mode 100644 index 000000000000..cea4ab844d63 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/cachenodesoperations_client_example_test.go @@ -0,0 +1,394 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armconnectedcache_test + +import ( + "context" + "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/connectedcache/armconnectedcache" + "log" +) + +// Generated from example definition: 2023-05-01-preview/CacheNodesOperations_CreateorUpdate_MaximumSet_Gen.json +func ExampleCacheNodesOperationsClient_BeginCreateorUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewCacheNodesOperationsClient().BeginCreateorUpdate(ctx, "rgConnectedCache", "lwrsyhvfpcfrwrim", armconnectedcache.CacheNodePreviewResource{ + Location: to.Ptr("westus"), + Properties: &armconnectedcache.CacheNodeOldResponse{ + StatusCode: to.Ptr("movtzupooyhdqk"), + StatusText: to.Ptr("bjnsrpzaofjntleoesjwammgbi"), + StatusDetails: to.Ptr("quuziibkwtgf"), + Error: &armconnectedcache.ErrorDetail{}, + }, + Tags: map[string]*string{ + "key8256": to.Ptr("oreqiywrjkmate"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %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 = armconnectedcache.CacheNodesOperationsClientCreateorUpdateResponse{ + // CacheNodePreviewResource: &armconnectedcache.CacheNodePreviewResource{ + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/cacheNodes/MccRPTest2"), + // Name: to.Ptr("MCCTPTest2"), + // Type: to.Ptr("Microsoft.ConnectedCache/cacheNodes"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CacheNodeOldResponse{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // StatusCode: to.Ptr("movtzupooyhdqk"), + // StatusText: to.Ptr("bjnsrpzaofjntleoesjwammgbi"), + // StatusDetails: to.Ptr("quuziibkwtgf"), + // Status: to.Ptr("vxwmuwtqimapfw"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dzxbdigdjbdbdclvxkxmfutgcbjf"), + // Message: to.Ptr("ifabxmzinicoximnsjkmhdpdgkw"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key8256": to.Ptr("oreqiywrjkmate"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("yqwxlhphavoggkcwg"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-31T00:19:33.838Z"); return t}()), + // LastModifiedBy: to.Ptr("knekx"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-31T00:19:33.838Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2023-05-01-preview/CacheNodesOperations_Delete_MaximumSet_Gen.json +func ExampleCacheNodesOperationsClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewCacheNodesOperationsClient().Delete(ctx, "rgConnectedCache", "otvtvhmovthjwzjzbsqkbnmpcmmeianpqxmmaspvdczmrenquxigrtuarmlcmvsnaclhcbw", 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 = armconnectedcache.CacheNodesOperationsClientDeleteResponse{ + // } +} + +// Generated from example definition: 2023-05-01-preview/CacheNodesOperations_Get_MaximumSet_Gen.json +func ExampleCacheNodesOperationsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewCacheNodesOperationsClient().Get(ctx, "rgConnectedCache", "nqoxkgorhuzbhjwcegymzqbeydzjupemekt", 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 = armconnectedcache.CacheNodesOperationsClientGetResponse{ + // CacheNodePreviewResource: &armconnectedcache.CacheNodePreviewResource{ + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/cacheNodes/MccRPTest2"), + // Name: to.Ptr("MCCTPTest2"), + // Type: to.Ptr("Microsoft.ConnectedCache/cacheNodes"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CacheNodeOldResponse{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // StatusCode: to.Ptr("movtzupooyhdqk"), + // StatusText: to.Ptr("bjnsrpzaofjntleoesjwammgbi"), + // StatusDetails: to.Ptr("quuziibkwtgf"), + // Status: to.Ptr("vxwmuwtqimapfw"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dzxbdigdjbdbdclvxkxmfutgcbjf"), + // Message: to.Ptr("ifabxmzinicoximnsjkmhdpdgkw"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key8256": to.Ptr("oreqiywrjkmate"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("yqwxlhphavoggkcwg"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-31T00:19:33.838Z"); return t}()), + // LastModifiedBy: to.Ptr("knekx"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-31T00:19:33.838Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2023-05-01-preview/CacheNodesOperations_ListByResourceGroup_MaximumSet_Gen.json +func ExampleCacheNodesOperationsClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewCacheNodesOperationsClient().NewListByResourceGroupPager("rgConnectedCache", 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 = armconnectedcache.CacheNodesOperationsClientListByResourceGroupResponse{ + // CacheNodePreviewResourceListResult: armconnectedcache.CacheNodePreviewResourceListResult{ + // Value: []*armconnectedcache.CacheNodePreviewResource{ + // { + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/DoTest/providers/Microsoft.ConnectedCache/cacheNodes/MccRPTest2"), + // Name: to.Ptr("MCCTPTest2"), + // Type: to.Ptr("Microsoft.ConnectedCache/cacheNodes"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CacheNodeOldResponse{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // StatusCode: to.Ptr("oldkroffqtkryqffpsi"), + // StatusText: to.Ptr("bs"), + // StatusDetails: to.Ptr("lhwvcz"), + // Status: to.Ptr("jurqdrxfpowdz"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key4711": to.Ptr("zfrkvxymuupxgxrkkmbm"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // { + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/DoTest/providers/Microsoft.ConnectedCache/cacheNodes/MccRPTest1"), + // Name: to.Ptr("MCCTPTest1"), + // Type: to.Ptr("Microsoft.ConnectedCache/cacheNodes"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CacheNodeOldResponse{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // StatusCode: to.Ptr("gtqfmwgkfp"), + // StatusText: to.Ptr("ztbgggsdeihkputd"), + // StatusDetails: to.Ptr("odhpdelbuqrfkiaolqrrzpdaokctz"), + // Status: to.Ptr("mobullauhrxnpyocr"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key8585": to.Ptr("jgoeqypqcf"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2023-05-01-preview/CacheNodesOperations_ListBySubscription_MaximumSet_Gen.json +func ExampleCacheNodesOperationsClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewCacheNodesOperationsClient().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 = armconnectedcache.CacheNodesOperationsClientListBySubscriptionResponse{ + // CacheNodePreviewResourceListResult: armconnectedcache.CacheNodePreviewResourceListResult{ + // Value: []*armconnectedcache.CacheNodePreviewResource{ + // { + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/DoTest/providers/Microsoft.ConnectedCache/cacheNodes/MccRPTest2"), + // Name: to.Ptr("MCCTPTest2"), + // Type: to.Ptr("Microsoft.ConnectedCache/cacheNodes"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CacheNodeOldResponse{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // StatusCode: to.Ptr("oldkroffqtkryqffpsi"), + // StatusText: to.Ptr("bs"), + // StatusDetails: to.Ptr("lhwvcz"), + // Status: to.Ptr("jurqdrxfpowdz"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key4711": to.Ptr("zfrkvxymuupxgxrkkmbm"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // { + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/DoTest/providers/Microsoft.ConnectedCache/cacheNodes/MccRPTest1"), + // Name: to.Ptr("MCCTPTest1"), + // Type: to.Ptr("Microsoft.ConnectedCache/cacheNodes"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CacheNodeOldResponse{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // StatusCode: to.Ptr("gtqfmwgkfp"), + // StatusText: to.Ptr("ztbgggsdeihkputd"), + // StatusDetails: to.Ptr("odhpdelbuqrfkiaolqrrzpdaokctz"), + // Status: to.Ptr("mobullauhrxnpyocr"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key8585": to.Ptr("jgoeqypqcf"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2023-05-01-preview/CacheNodesOperations_Update_MaximumSet_Gen.json +func ExampleCacheNodesOperationsClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewCacheNodesOperationsClient().Update(ctx, "rgConnectedCache", "wlrwpdbcv", armconnectedcache.PatchResource{ + Tags: map[string]*string{ + "key5032": to.Ptr("esiuyjbpcwkpqriqiqztxuocv"), + }, + }, 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 = armconnectedcache.CacheNodesOperationsClientUpdateResponse{ + // CacheNodePreviewResource: &armconnectedcache.CacheNodePreviewResource{ + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/DoTest/providers/Microsoft.ConnectedCache/cacheNodes/MccRPTest2"), + // Name: to.Ptr("MCCTPTest2"), + // Type: to.Ptr("Microsoft.ConnectedCache/cacheNodes"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CacheNodeOldResponse{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // StatusCode: to.Ptr("movtzupooyhdqk"), + // StatusText: to.Ptr("bjnsrpzaofjntleoesjwammgbi"), + // StatusDetails: to.Ptr("quuziibkwtgf"), + // Status: to.Ptr("vxwmuwtqimapfw"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dzxbdigdjbdbdclvxkxmfutgcbjf"), + // Message: to.Ptr("ifabxmzinicoximnsjkmhdpdgkw"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key8256": to.Ptr("oreqiywrjkmate"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("yqwxlhphavoggkcwg"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-31T00:19:33.838Z"); return t}()), + // LastModifiedBy: to.Ptr("knekx"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-31T00:19:33.838Z"); return t}()), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/ci.yml b/sdk/resourcemanager/connectedcache/armconnectedcache/ci.yml new file mode 100644 index 000000000000..e15ca009167c --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/ci.yml @@ -0,0 +1,28 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/connectedcache/armconnectedcache/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/connectedcache/armconnectedcache/ + +extends: + template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/connectedcache/armconnectedcache' diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/client_factory.go b/sdk/resourcemanager/connectedcache/armconnectedcache/client_factory.go new file mode 100644 index 000000000000..f565046ada09 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/client_factory.go @@ -0,0 +1,88 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armconnectedcache + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" +) + +// ClientFactory is a client factory used to create any client in this module. +// Don't use this type directly, use NewClientFactory instead. +type ClientFactory struct { + subscriptionID string + internal *arm.Client +} + +// 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 - The ID of the target subscription. The value must be an UUID. +// - 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) { + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, + internal: internal, + }, nil +} + +// NewCacheNodesOperationsClient creates a new instance of CacheNodesOperationsClient. +func (c *ClientFactory) NewCacheNodesOperationsClient() *CacheNodesOperationsClient { + return &CacheNodesOperationsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewEnterpriseCustomerOperationsClient creates a new instance of EnterpriseCustomerOperationsClient. +func (c *ClientFactory) NewEnterpriseCustomerOperationsClient() *EnterpriseCustomerOperationsClient { + return &EnterpriseCustomerOperationsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewEnterpriseMccCacheNodesOperationsClient creates a new instance of EnterpriseMccCacheNodesOperationsClient. +func (c *ClientFactory) NewEnterpriseMccCacheNodesOperationsClient() *EnterpriseMccCacheNodesOperationsClient { + return &EnterpriseMccCacheNodesOperationsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewEnterpriseMccCustomersClient creates a new instance of EnterpriseMccCustomersClient. +func (c *ClientFactory) NewEnterpriseMccCustomersClient() *EnterpriseMccCustomersClient { + return &EnterpriseMccCustomersClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewIspCacheNodesOperationsClient creates a new instance of IspCacheNodesOperationsClient. +func (c *ClientFactory) NewIspCacheNodesOperationsClient() *IspCacheNodesOperationsClient { + return &IspCacheNodesOperationsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewIspCustomersClient creates a new instance of IspCustomersClient. +func (c *ClientFactory) NewIspCustomersClient() *IspCustomersClient { + return &IspCustomersClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewOperationsClient creates a new instance of OperationsClient. +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + return &OperationsClient{ + internal: c.internal, + } +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/constants.go b/sdk/resourcemanager/connectedcache/armconnectedcache/constants.go new file mode 100644 index 000000000000..9a67cde6c50a --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/constants.go @@ -0,0 +1,248 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armconnectedcache + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/connectedcache/armconnectedcache" + moduleVersion = "v0.1.0" +) + +// ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +type ActionType string + +const ( + // ActionTypeInternal - Actions are for internal-only APIs. + ActionTypeInternal ActionType = "Internal" +) + +// PossibleActionTypeValues returns the possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ + ActionTypeInternal, + } +} + +// AutoUpdateRingType - Auto update Ring type +type AutoUpdateRingType string + +const ( + // AutoUpdateRingTypeFast - customer selection of fast / auto update to install mcc on their physical vm + AutoUpdateRingTypeFast AutoUpdateRingType = "Fast" + // AutoUpdateRingTypePreview - customer selection of preview update install mcc on their physical vm + AutoUpdateRingTypePreview AutoUpdateRingType = "Preview" + // AutoUpdateRingTypeSlow - customer selection of slow update to install mcc on their physical vm + AutoUpdateRingTypeSlow AutoUpdateRingType = "Slow" +) + +// PossibleAutoUpdateRingTypeValues returns the possible values for the AutoUpdateRingType const type. +func PossibleAutoUpdateRingTypeValues() []AutoUpdateRingType { + return []AutoUpdateRingType{ + AutoUpdateRingTypeFast, + AutoUpdateRingTypePreview, + AutoUpdateRingTypeSlow, + } +} + +// BgpReviewStateEnum - Cache node resource Bgp review state as integer +type BgpReviewStateEnum string + +const ( + // BgpReviewStateEnumApproved - bgp is in Approved state + BgpReviewStateEnumApproved BgpReviewStateEnum = "Approved" + // BgpReviewStateEnumAttentionRequired - bgp is setup need an attention for more troubleshoot + BgpReviewStateEnumAttentionRequired BgpReviewStateEnum = "AttentionRequired" + // BgpReviewStateEnumInReview - bgp is in review state + BgpReviewStateEnumInReview BgpReviewStateEnum = "InReview" + // BgpReviewStateEnumNotConfigured - bgp not configured + BgpReviewStateEnumNotConfigured BgpReviewStateEnum = "NotConfigured" +) + +// PossibleBgpReviewStateEnumValues returns the possible values for the BgpReviewStateEnum const type. +func PossibleBgpReviewStateEnumValues() []BgpReviewStateEnum { + return []BgpReviewStateEnum{ + BgpReviewStateEnumApproved, + BgpReviewStateEnumAttentionRequired, + BgpReviewStateEnumInReview, + BgpReviewStateEnumNotConfigured, + } +} + +// ConfigurationState - Cache node configuration setup state +type ConfigurationState string + +const ( + // ConfigurationStateConfigured - connected cache setup configured + ConfigurationStateConfigured ConfigurationState = "Configured" + // ConfigurationStateNotConfiguredIP - connected cache setup not configured + ConfigurationStateNotConfiguredIP ConfigurationState = "NotConfigured_Ip" +) + +// PossibleConfigurationStateValues returns the possible values for the ConfigurationState const type. +func PossibleConfigurationStateValues() []ConfigurationState { + return []ConfigurationState{ + ConfigurationStateConfigured, + ConfigurationStateNotConfiguredIP, + } +} + +// CreatedByType - The kind of entity that created the resource. +type CreatedByType string + +const ( + // CreatedByTypeApplication - The entity was created by an application. + CreatedByTypeApplication CreatedByType = "Application" + // CreatedByTypeKey - The entity was created by a key. + CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeManagedIdentity - The entity was created by a managed identity. + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + // CreatedByTypeUser - The entity was created by a user. + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + +// CustomerTransitState - Customer resource transit states +type CustomerTransitState string + +const ( + // CustomerTransitStateCombinedTransit - transit provider and have own subscribers + CustomerTransitStateCombinedTransit CustomerTransitState = "CombinedTransit" + // CustomerTransitStateNoTransit - do not have transit + CustomerTransitStateNoTransit CustomerTransitState = "NoTransit" + // CustomerTransitStateTransitOnly - pure transit provider or network service provider + CustomerTransitStateTransitOnly CustomerTransitState = "TransitOnly" +) + +// PossibleCustomerTransitStateValues returns the possible values for the CustomerTransitState const type. +func PossibleCustomerTransitStateValues() []CustomerTransitState { + return []CustomerTransitState{ + CustomerTransitStateCombinedTransit, + CustomerTransitStateNoTransit, + CustomerTransitStateTransitOnly, + } +} + +// CycleType - Update Cycle type +type CycleType string + +const ( + // CycleTypeFast - customer selection of fast / auto update to install mcc on their physical vm + CycleTypeFast CycleType = "Fast" + // CycleTypePreview - customer selection of preview update install mcc on their physical vm + CycleTypePreview CycleType = "Preview" + // CycleTypeSlow - customer selection of slow update to install mcc on their physical vm + CycleTypeSlow CycleType = "Slow" +) + +// PossibleCycleTypeValues returns the possible values for the CycleType const type. +func PossibleCycleTypeValues() []CycleType { + return []CycleType{ + CycleTypeFast, + CycleTypePreview, + CycleTypeSlow, + } +} + +// 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 ( + // OriginSystem - Indicates the operation is initiated by a system. + OriginSystem Origin = "system" + // OriginUser - Indicates the operation is initiated by a user. + OriginUser Origin = "user" + // OriginUserSystem - Indicates the operation is initiated by a user or system. + OriginUserSystem Origin = "user,system" +) + +// PossibleOriginValues returns the possible values for the Origin const type. +func PossibleOriginValues() []Origin { + return []Origin{ + OriginSystem, + OriginUser, + OriginUserSystem, + } +} + +// OsType - Operating System of the cache node +type OsType string + +const ( + // OsTypeEflow - cache node installs on Azure Eflow + OsTypeEflow OsType = "Eflow" + // OsTypeLinux - cache node installs on Linux Operating system + OsTypeLinux OsType = "Linux" + // OsTypeWindows - cache node installs on windows operating system + OsTypeWindows OsType = "Windows" +) + +// PossibleOsTypeValues returns the possible values for the OsType const type. +func PossibleOsTypeValues() []OsType { + return []OsType{ + OsTypeEflow, + OsTypeLinux, + OsTypeWindows, + } +} + +// ProvisioningState - provisioning state of the resource +type ProvisioningState string + +const ( + // ProvisioningStateAccepted - Accepted state of the provisioning state during the Async Operations + ProvisioningStateAccepted ProvisioningState = "Accepted" + // ProvisioningStateCanceled - Resource creation was canceled. + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateDeleting - Deleting state of the provisioning state + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed - Resource creation failed. + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateSucceeded - Resource has been created. + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUnknown - unknown state of the provisioning state + ProvisioningStateUnknown ProvisioningState = "Unknown" + // ProvisioningStateUpgrading - Upgrading state of the provisioning state + ProvisioningStateUpgrading ProvisioningState = "Upgrading" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateAccepted, + ProvisioningStateCanceled, + ProvisioningStateDeleting, + ProvisioningStateFailed, + ProvisioningStateSucceeded, + ProvisioningStateUnknown, + ProvisioningStateUpgrading, + } +} + +// ProxyRequired - Proxy details enum +type ProxyRequired string + +const ( + // ProxyRequiredNone - Proxy is not required in setup + ProxyRequiredNone ProxyRequired = "None" + // ProxyRequiredRequired - proxy is required in setup + ProxyRequiredRequired ProxyRequired = "Required" +) + +// PossibleProxyRequiredValues returns the possible values for the ProxyRequired const type. +func PossibleProxyRequiredValues() []ProxyRequired { + return []ProxyRequired{ + ProxyRequiredNone, + ProxyRequiredRequired, + } +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/enterprisecustomeroperations_client.go b/sdk/resourcemanager/connectedcache/armconnectedcache/enterprisecustomeroperations_client.go new file mode 100644 index 000000000000..467e33af5a78 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/enterprisecustomeroperations_client.go @@ -0,0 +1,426 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armconnectedcache + +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" +) + +// EnterpriseCustomerOperationsClient contains the methods for the EnterpriseCustomerOperations group. +// Don't use this type directly, use NewEnterpriseCustomerOperationsClient() instead. +type EnterpriseCustomerOperationsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewEnterpriseCustomerOperationsClient creates a new instance of EnterpriseCustomerOperationsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewEnterpriseCustomerOperationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*EnterpriseCustomerOperationsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &EnterpriseCustomerOperationsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates a cacheNodes with the specified create parameters +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - resource - Resource create parameters. +// - options - EnterpriseCustomerOperationsClientBeginCreateOrUpdateOptions contains the optional parameters for the EnterpriseCustomerOperationsClient.BeginCreateOrUpdate +// method. +func (client *EnterpriseCustomerOperationsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, customerResourceName string, resource EnterprisePreviewResource, options *EnterpriseCustomerOperationsClientBeginCreateOrUpdateOptions) (*runtime.Poller[EnterpriseCustomerOperationsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, customerResourceName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[EnterpriseCustomerOperationsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[EnterpriseCustomerOperationsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Creates a cacheNodes with the specified create parameters +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +func (client *EnterpriseCustomerOperationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, customerResourceName string, resource EnterprisePreviewResource, options *EnterpriseCustomerOperationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "EnterpriseCustomerOperationsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, customerResourceName, resource, 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 +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *EnterpriseCustomerOperationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, resource EnterprisePreviewResource, _ *EnterpriseCustomerOperationsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/enterpriseCustomers/{customerResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + 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-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// Delete - Deletes an existing customer Enterprise resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - options - EnterpriseCustomerOperationsClientDeleteOptions contains the optional parameters for the EnterpriseCustomerOperationsClient.Delete +// method. +func (client *EnterpriseCustomerOperationsClient) Delete(ctx context.Context, resourceGroupName string, customerResourceName string, options *EnterpriseCustomerOperationsClientDeleteOptions) (EnterpriseCustomerOperationsClientDeleteResponse, error) { + var err error + const operationName = "EnterpriseCustomerOperationsClient.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, customerResourceName, options) + if err != nil { + return EnterpriseCustomerOperationsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return EnterpriseCustomerOperationsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return EnterpriseCustomerOperationsClientDeleteResponse{}, err + } + return EnterpriseCustomerOperationsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *EnterpriseCustomerOperationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, _ *EnterpriseCustomerOperationsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/enterpriseCustomers/{customerResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + 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-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves the properties of a Enterprise customer +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - options - EnterpriseCustomerOperationsClientGetOptions contains the optional parameters for the EnterpriseCustomerOperationsClient.Get +// method. +func (client *EnterpriseCustomerOperationsClient) Get(ctx context.Context, resourceGroupName string, customerResourceName string, options *EnterpriseCustomerOperationsClientGetOptions) (EnterpriseCustomerOperationsClientGetResponse, error) { + var err error + const operationName = "EnterpriseCustomerOperationsClient.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, customerResourceName, options) + if err != nil { + return EnterpriseCustomerOperationsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return EnterpriseCustomerOperationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return EnterpriseCustomerOperationsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *EnterpriseCustomerOperationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, _ *EnterpriseCustomerOperationsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/enterpriseCustomers/{customerResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + 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-05-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 *EnterpriseCustomerOperationsClient) getHandleResponse(resp *http.Response) (EnterpriseCustomerOperationsClientGetResponse, error) { + result := EnterpriseCustomerOperationsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EnterprisePreviewResource); err != nil { + return EnterpriseCustomerOperationsClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Retrieves the properties of all ConnectedCache enterpriseCustomers +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - EnterpriseCustomerOperationsClientListByResourceGroupOptions contains the optional parameters for the EnterpriseCustomerOperationsClient.NewListByResourceGroupPager +// method. +func (client *EnterpriseCustomerOperationsClient) NewListByResourceGroupPager(resourceGroupName string, options *EnterpriseCustomerOperationsClientListByResourceGroupOptions) *runtime.Pager[EnterpriseCustomerOperationsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[EnterpriseCustomerOperationsClientListByResourceGroupResponse]{ + More: func(page EnterpriseCustomerOperationsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *EnterpriseCustomerOperationsClientListByResourceGroupResponse) (EnterpriseCustomerOperationsClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "EnterpriseCustomerOperationsClient.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 EnterpriseCustomerOperationsClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *EnterpriseCustomerOperationsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *EnterpriseCustomerOperationsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/enterpriseCustomers" + 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-05-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 *EnterpriseCustomerOperationsClient) listByResourceGroupHandleResponse(resp *http.Response) (EnterpriseCustomerOperationsClientListByResourceGroupResponse, error) { + result := EnterpriseCustomerOperationsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EnterprisePreviewResourceListResult); err != nil { + return EnterpriseCustomerOperationsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - Retrieves the properties of all ConnectedCaches +// +// Generated from API version 2023-05-01-preview +// - options - EnterpriseCustomerOperationsClientListBySubscriptionOptions contains the optional parameters for the EnterpriseCustomerOperationsClient.NewListBySubscriptionPager +// method. +func (client *EnterpriseCustomerOperationsClient) NewListBySubscriptionPager(options *EnterpriseCustomerOperationsClientListBySubscriptionOptions) *runtime.Pager[EnterpriseCustomerOperationsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[EnterpriseCustomerOperationsClientListBySubscriptionResponse]{ + More: func(page EnterpriseCustomerOperationsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *EnterpriseCustomerOperationsClientListBySubscriptionResponse) (EnterpriseCustomerOperationsClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "EnterpriseCustomerOperationsClient.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 EnterpriseCustomerOperationsClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *EnterpriseCustomerOperationsClient) listBySubscriptionCreateRequest(ctx context.Context, _ *EnterpriseCustomerOperationsClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ConnectedCache/enterpriseCustomers" + 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-05-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 *EnterpriseCustomerOperationsClient) listBySubscriptionHandleResponse(resp *http.Response) (EnterpriseCustomerOperationsClientListBySubscriptionResponse, error) { + result := EnterpriseCustomerOperationsClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EnterprisePreviewResourceListResult); err != nil { + return EnterpriseCustomerOperationsClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// Update - updates an existing enterpriseCustomers +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - properties - The resource properties to be updated. +// - options - EnterpriseCustomerOperationsClientUpdateOptions contains the optional parameters for the EnterpriseCustomerOperationsClient.Update +// method. +func (client *EnterpriseCustomerOperationsClient) Update(ctx context.Context, resourceGroupName string, customerResourceName string, properties PatchResource, options *EnterpriseCustomerOperationsClientUpdateOptions) (EnterpriseCustomerOperationsClientUpdateResponse, error) { + var err error + const operationName = "EnterpriseCustomerOperationsClient.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, customerResourceName, properties, options) + if err != nil { + return EnterpriseCustomerOperationsClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return EnterpriseCustomerOperationsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return EnterpriseCustomerOperationsClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *EnterpriseCustomerOperationsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, properties PatchResource, _ *EnterpriseCustomerOperationsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/enterpriseCustomers/{customerResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + 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-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *EnterpriseCustomerOperationsClient) updateHandleResponse(resp *http.Response) (EnterpriseCustomerOperationsClientUpdateResponse, error) { + result := EnterpriseCustomerOperationsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EnterprisePreviewResource); err != nil { + return EnterpriseCustomerOperationsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/enterprisecustomeroperations_client_example_test.go b/sdk/resourcemanager/connectedcache/armconnectedcache/enterprisecustomeroperations_client_example_test.go new file mode 100644 index 000000000000..e5afac622ea2 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/enterprisecustomeroperations_client_example_test.go @@ -0,0 +1,334 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armconnectedcache_test + +import ( + "context" + "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/connectedcache/armconnectedcache" + "log" +) + +// Generated from example definition: 2023-05-01-preview/EnterpriseCustomerOperations_CreateOrUpdate_MaximumSet_Gen.json +func ExampleEnterpriseCustomerOperationsClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewEnterpriseCustomerOperationsClient().BeginCreateOrUpdate(ctx, "rgConnectedCache", "l", armconnectedcache.EnterprisePreviewResource{ + Properties: &armconnectedcache.CacheNodeOldResponse{ + StatusCode: to.Ptr("oldkroffqtkryqffpsi"), + StatusText: to.Ptr("bs"), + StatusDetails: to.Ptr("lhwvcz"), + Error: &armconnectedcache.ErrorDetail{}, + }, + Tags: map[string]*string{ + "key4215": to.Ptr("zjbszvlzf"), + }, + Location: to.Ptr("zdzhhkjyogrqxwihkifnmeyhwpujbr"), + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %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 = armconnectedcache.EnterpriseCustomerOperationsClientCreateOrUpdateResponse{ + // EnterprisePreviewResource: &armconnectedcache.EnterprisePreviewResource{ + // Properties: &armconnectedcache.CacheNodeOldResponse{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // StatusCode: to.Ptr("oldkroffqtkryqffpsi"), + // StatusText: to.Ptr("bs"), + // StatusDetails: to.Ptr("lhwvcz"), + // Status: to.Ptr("jurqdrxfpowdz"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key4215": to.Ptr("zjbszvlzf"), + // }, + // Location: to.Ptr("westus"), + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/enterpriseCustomers/MccRPTest2"), + // Name: to.Ptr("MCCTPTest2"), + // Type: to.Ptr("Microsoft.ConnectedCache/enterpriseCustomers"), + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2023-05-01-preview/EnterpriseCustomerOperations_Delete_MaximumSet_Gen.json +func ExampleEnterpriseCustomerOperationsClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewEnterpriseCustomerOperationsClient().Delete(ctx, "rgConnectedCache", "jeubxmhiaihcusgnahblvvckbdcetacvqgwbohlrqucodtlwuyefpejskvamgrdnwgucziodcfpjhqy", 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 = armconnectedcache.EnterpriseCustomerOperationsClientDeleteResponse{ + // } +} + +// Generated from example definition: 2023-05-01-preview/EnterpriseCustomerOperations_Get_MaximumSet_Gen.json +func ExampleEnterpriseCustomerOperationsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewEnterpriseCustomerOperationsClient().Get(ctx, "rgConnectedCache", "MCCTPTest2", 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 = armconnectedcache.EnterpriseCustomerOperationsClientGetResponse{ + // EnterprisePreviewResource: &armconnectedcache.EnterprisePreviewResource{ + // Properties: &armconnectedcache.CacheNodeOldResponse{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // StatusCode: to.Ptr("oldkroffqtkryqffpsi"), + // StatusText: to.Ptr("bs"), + // StatusDetails: to.Ptr("lhwvcz"), + // Status: to.Ptr("jurqdrxfpowdz"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key4215": to.Ptr("zjbszvlzf"), + // }, + // Location: to.Ptr("westus"), + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/enterpriseCustomers/MccRPTest2"), + // Name: to.Ptr("MCCTPTest2"), + // Type: to.Ptr("Microsoft.ConnectedCache/enterpriseCustomers"), + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2023-05-01-preview/EnterpriseCustomerOperations_ListByResourceGroup_MaximumSet_Gen.json +func ExampleEnterpriseCustomerOperationsClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewEnterpriseCustomerOperationsClient().NewListByResourceGroupPager("rgConnectedCache", 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 = armconnectedcache.EnterpriseCustomerOperationsClientListByResourceGroupResponse{ + // EnterprisePreviewResourceListResult: armconnectedcache.EnterprisePreviewResourceListResult{ + // Value: []*armconnectedcache.EnterprisePreviewResource{ + // { + // Properties: &armconnectedcache.CacheNodeOldResponse{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // StatusCode: to.Ptr("oldkroffqtkryqffpsi"), + // StatusText: to.Ptr("bs"), + // StatusDetails: to.Ptr("lhwvcz"), + // Status: to.Ptr("jurqdrxfpowdz"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key4215": to.Ptr("zjbszvlzf"), + // }, + // Location: to.Ptr("westus"), + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/enterpriseCustomers/MccRPTest2"), + // Name: to.Ptr("MCCTPTest2"), + // Type: to.Ptr("Microsoft.ConnectedCache/enterpriseCustomers"), + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2023-05-01-preview/EnterpriseCustomerOperations_ListBySubscription_MaximumSet_Gen.json +func ExampleEnterpriseCustomerOperationsClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewEnterpriseCustomerOperationsClient().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 = armconnectedcache.EnterpriseCustomerOperationsClientListBySubscriptionResponse{ + // EnterprisePreviewResourceListResult: armconnectedcache.EnterprisePreviewResourceListResult{ + // Value: []*armconnectedcache.EnterprisePreviewResource{ + // { + // Properties: &armconnectedcache.CacheNodeOldResponse{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // StatusCode: to.Ptr("oldkroffqtkryqffpsi"), + // StatusText: to.Ptr("bs"), + // StatusDetails: to.Ptr("lhwvcz"), + // Status: to.Ptr("jurqdrxfpowdz"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key4215": to.Ptr("zjbszvlzf"), + // }, + // Location: to.Ptr("westus"), + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/enterpriseCustomers/MccRPTest2"), + // Name: to.Ptr("MCCTPTest2"), + // Type: to.Ptr("Microsoft.ConnectedCache/enterpriseCustomers"), + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2023-05-01-preview/EnterpriseCustomerOperations_Update_MaximumSet_Gen.json +func ExampleEnterpriseCustomerOperationsClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewEnterpriseCustomerOperationsClient().Update(ctx, "rgConnectedCache", "MCCTPTest2", armconnectedcache.PatchResource{ + Tags: map[string]*string{ + "key1653": to.Ptr("nzjczrhclhkndesgy"), + }, + }, 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 = armconnectedcache.EnterpriseCustomerOperationsClientUpdateResponse{ + // EnterprisePreviewResource: &armconnectedcache.EnterprisePreviewResource{ + // Properties: &armconnectedcache.CacheNodeOldResponse{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // StatusCode: to.Ptr("oldkroffqtkryqffpsi"), + // StatusText: to.Ptr("bs"), + // StatusDetails: to.Ptr("lhwvcz"), + // Status: to.Ptr("jurqdrxfpowdz"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key4215": to.Ptr("zjbszvlzf"), + // }, + // Location: to.Ptr("westus"), + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/enterpriseCustomers/MccRPTest2"), + // Name: to.Ptr("MCCTPTest2"), + // Type: to.Ptr("Microsoft.ConnectedCache/enterpriseCustomers"), + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/enterprisemcccachenodesoperations_client.go b/sdk/resourcemanager/connectedcache/armconnectedcache/enterprisemcccachenodesoperations_client.go new file mode 100644 index 000000000000..ddde3de711f9 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/enterprisemcccachenodesoperations_client.go @@ -0,0 +1,488 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armconnectedcache + +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" +) + +// EnterpriseMccCacheNodesOperationsClient contains the methods for the EnterpriseMccCacheNodesOperations group. +// Don't use this type directly, use NewEnterpriseMccCacheNodesOperationsClient() instead. +type EnterpriseMccCacheNodesOperationsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewEnterpriseMccCacheNodesOperationsClient creates a new instance of EnterpriseMccCacheNodesOperationsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewEnterpriseMccCacheNodesOperationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*EnterpriseMccCacheNodesOperationsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &EnterpriseMccCacheNodesOperationsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - This api creates an ispCacheNode with the specified create parameters +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - cacheNodeResourceName - Name of the ConnectedCache resource +// - resource - Resource create parameters. +// - options - EnterpriseMccCacheNodesOperationsClientBeginCreateOrUpdateOptions contains the optional parameters for the EnterpriseMccCacheNodesOperationsClient.BeginCreateOrUpdate +// method. +func (client *EnterpriseMccCacheNodesOperationsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, resource EnterpriseMccCacheNodeResource, options *EnterpriseMccCacheNodesOperationsClientBeginCreateOrUpdateOptions) (*runtime.Poller[EnterpriseMccCacheNodesOperationsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, customerResourceName, cacheNodeResourceName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[EnterpriseMccCacheNodesOperationsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[EnterpriseMccCacheNodesOperationsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - This api creates an ispCacheNode with the specified create parameters +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +func (client *EnterpriseMccCacheNodesOperationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, resource EnterpriseMccCacheNodeResource, options *EnterpriseMccCacheNodesOperationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "EnterpriseMccCacheNodesOperationsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, customerResourceName, cacheNodeResourceName, resource, 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 +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *EnterpriseMccCacheNodesOperationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, resource EnterpriseMccCacheNodeResource, _ *EnterpriseMccCacheNodesOperationsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/enterpriseMccCustomers/{customerResourceName}/enterpriseMccCacheNodes/{cacheNodeResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + if cacheNodeResourceName == "" { + return nil, errors.New("parameter cacheNodeResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cacheNodeResourceName}", url.PathEscape(cacheNodeResourceName)) + 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-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - This api deletes an existing ispCacheNode resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - cacheNodeResourceName - Name of the ConnectedCache resource +// - options - EnterpriseMccCacheNodesOperationsClientBeginDeleteOptions contains the optional parameters for the EnterpriseMccCacheNodesOperationsClient.BeginDelete +// method. +func (client *EnterpriseMccCacheNodesOperationsClient) BeginDelete(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, options *EnterpriseMccCacheNodesOperationsClientBeginDeleteOptions) (*runtime.Poller[EnterpriseMccCacheNodesOperationsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, customerResourceName, cacheNodeResourceName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[EnterpriseMccCacheNodesOperationsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[EnterpriseMccCacheNodesOperationsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - This api deletes an existing ispCacheNode resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +func (client *EnterpriseMccCacheNodesOperationsClient) deleteOperation(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, options *EnterpriseMccCacheNodesOperationsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "EnterpriseMccCacheNodesOperationsClient.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, customerResourceName, cacheNodeResourceName, 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.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *EnterpriseMccCacheNodesOperationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, _ *EnterpriseMccCacheNodesOperationsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/enterpriseMccCustomers/{customerResourceName}/enterpriseMccCacheNodes/{cacheNodeResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + if cacheNodeResourceName == "" { + return nil, errors.New("parameter cacheNodeResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cacheNodeResourceName}", url.PathEscape(cacheNodeResourceName)) + 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-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - This api gets ispCacheNode resource information +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - cacheNodeResourceName - Name of the ConnectedCache resource +// - options - EnterpriseMccCacheNodesOperationsClientGetOptions contains the optional parameters for the EnterpriseMccCacheNodesOperationsClient.Get +// method. +func (client *EnterpriseMccCacheNodesOperationsClient) Get(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, options *EnterpriseMccCacheNodesOperationsClientGetOptions) (EnterpriseMccCacheNodesOperationsClientGetResponse, error) { + var err error + const operationName = "EnterpriseMccCacheNodesOperationsClient.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, customerResourceName, cacheNodeResourceName, options) + if err != nil { + return EnterpriseMccCacheNodesOperationsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return EnterpriseMccCacheNodesOperationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return EnterpriseMccCacheNodesOperationsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *EnterpriseMccCacheNodesOperationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, _ *EnterpriseMccCacheNodesOperationsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/enterpriseMccCustomers/{customerResourceName}/enterpriseMccCacheNodes/{cacheNodeResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + if cacheNodeResourceName == "" { + return nil, errors.New("parameter cacheNodeResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cacheNodeResourceName}", url.PathEscape(cacheNodeResourceName)) + 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-05-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 *EnterpriseMccCacheNodesOperationsClient) getHandleResponse(resp *http.Response) (EnterpriseMccCacheNodesOperationsClientGetResponse, error) { + result := EnterpriseMccCacheNodesOperationsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EnterpriseMccCacheNodeResource); err != nil { + return EnterpriseMccCacheNodesOperationsClientGetResponse{}, err + } + return result, nil +} + +// GetCacheNodeInstallDetails - This api gets secrets of the ispCacheNode resource install details +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - cacheNodeResourceName - Name of the ConnectedCache resource +// - options - EnterpriseMccCacheNodesOperationsClientGetCacheNodeInstallDetailsOptions contains the optional parameters for +// the EnterpriseMccCacheNodesOperationsClient.GetCacheNodeInstallDetails method. +func (client *EnterpriseMccCacheNodesOperationsClient) GetCacheNodeInstallDetails(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, options *EnterpriseMccCacheNodesOperationsClientGetCacheNodeInstallDetailsOptions) (EnterpriseMccCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse, error) { + var err error + const operationName = "EnterpriseMccCacheNodesOperationsClient.GetCacheNodeInstallDetails" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCacheNodeInstallDetailsCreateRequest(ctx, resourceGroupName, customerResourceName, cacheNodeResourceName, options) + if err != nil { + return EnterpriseMccCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return EnterpriseMccCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return EnterpriseMccCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse{}, err + } + resp, err := client.getCacheNodeInstallDetailsHandleResponse(httpResp) + return resp, err +} + +// getCacheNodeInstallDetailsCreateRequest creates the GetCacheNodeInstallDetails request. +func (client *EnterpriseMccCacheNodesOperationsClient) getCacheNodeInstallDetailsCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, _ *EnterpriseMccCacheNodesOperationsClientGetCacheNodeInstallDetailsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/enterpriseMccCustomers/{customerResourceName}/enterpriseMccCacheNodes/{cacheNodeResourceName}/getCacheNodeInstallDetails" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + if cacheNodeResourceName == "" { + return nil, errors.New("parameter cacheNodeResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cacheNodeResourceName}", url.PathEscape(cacheNodeResourceName)) + 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-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getCacheNodeInstallDetailsHandleResponse handles the GetCacheNodeInstallDetails response. +func (client *EnterpriseMccCacheNodesOperationsClient) getCacheNodeInstallDetailsHandleResponse(resp *http.Response) (EnterpriseMccCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse, error) { + result := EnterpriseMccCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MccCacheNodeInstallDetails); err != nil { + return EnterpriseMccCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse{}, err + } + return result, nil +} + +// NewListByEnterpriseMccCustomerResourcePager - This api retrieves information about all ispCacheNode resources under the +// given subscription and resource group +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - options - EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceOptions contains the optional parameters +// for the EnterpriseMccCacheNodesOperationsClient.NewListByEnterpriseMccCustomerResourcePager method. +func (client *EnterpriseMccCacheNodesOperationsClient) NewListByEnterpriseMccCustomerResourcePager(resourceGroupName string, customerResourceName string, options *EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceOptions) *runtime.Pager[EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceResponse] { + return runtime.NewPager(runtime.PagingHandler[EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceResponse]{ + More: func(page EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceResponse) (EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "EnterpriseMccCacheNodesOperationsClient.NewListByEnterpriseMccCustomerResourcePager") + 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.listByEnterpriseMccCustomerResourceCreateRequest(ctx, resourceGroupName, customerResourceName, options) + }, nil) + if err != nil { + return EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceResponse{}, err + } + return client.listByEnterpriseMccCustomerResourceHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByEnterpriseMccCustomerResourceCreateRequest creates the ListByEnterpriseMccCustomerResource request. +func (client *EnterpriseMccCacheNodesOperationsClient) listByEnterpriseMccCustomerResourceCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, _ *EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/enterpriseMccCustomers/{customerResourceName}/enterpriseMccCacheNodes" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + 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-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByEnterpriseMccCustomerResourceHandleResponse handles the ListByEnterpriseMccCustomerResource response. +func (client *EnterpriseMccCacheNodesOperationsClient) listByEnterpriseMccCustomerResourceHandleResponse(resp *http.Response) (EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceResponse, error) { + result := EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EnterpriseMccCacheNodeResourceListResult); err != nil { + return EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceResponse{}, err + } + return result, nil +} + +// Update - This api updates an existing ispCacheNode resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - cacheNodeResourceName - Name of the ConnectedCache resource +// - properties - The resource properties to be updated. +// - options - EnterpriseMccCacheNodesOperationsClientUpdateOptions contains the optional parameters for the EnterpriseMccCacheNodesOperationsClient.Update +// method. +func (client *EnterpriseMccCacheNodesOperationsClient) Update(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, properties PatchResource, options *EnterpriseMccCacheNodesOperationsClientUpdateOptions) (EnterpriseMccCacheNodesOperationsClientUpdateResponse, error) { + var err error + const operationName = "EnterpriseMccCacheNodesOperationsClient.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, customerResourceName, cacheNodeResourceName, properties, options) + if err != nil { + return EnterpriseMccCacheNodesOperationsClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return EnterpriseMccCacheNodesOperationsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return EnterpriseMccCacheNodesOperationsClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *EnterpriseMccCacheNodesOperationsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, properties PatchResource, _ *EnterpriseMccCacheNodesOperationsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/enterpriseMccCustomers/{customerResourceName}/enterpriseMccCacheNodes/{cacheNodeResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + if cacheNodeResourceName == "" { + return nil, errors.New("parameter cacheNodeResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cacheNodeResourceName}", url.PathEscape(cacheNodeResourceName)) + 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-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *EnterpriseMccCacheNodesOperationsClient) updateHandleResponse(resp *http.Response) (EnterpriseMccCacheNodesOperationsClientUpdateResponse, error) { + result := EnterpriseMccCacheNodesOperationsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EnterpriseMccCacheNodeResource); err != nil { + return EnterpriseMccCacheNodesOperationsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/enterprisemcccachenodesoperations_client_example_test.go b/sdk/resourcemanager/connectedcache/armconnectedcache/enterprisemcccachenodesoperations_client_example_test.go new file mode 100644 index 000000000000..e682e439e575 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/enterprisemcccachenodesoperations_client_example_test.go @@ -0,0 +1,684 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armconnectedcache_test + +import ( + "context" + "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/connectedcache/armconnectedcache" + "log" +) + +// Generated from example definition: 2023-05-01-preview/EnterpriseMccCacheNodesOperations_CreateOrUpdate_MaximumSet_Gen.json +func ExampleEnterpriseMccCacheNodesOperationsClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewEnterpriseMccCacheNodesOperationsClient().BeginCreateOrUpdate(ctx, "rgConnectedCache", "nhdkvstdrrtsxxuz", "fgduqdovidpemlnmhelomffuafdrbgaasqznvrdkbvspfzsnrhncdtqquhijhdpwyzwleukqldpceyxqhqlftqrr", armconnectedcache.EnterpriseMccCacheNodeResource{ + Location: to.Ptr("westus"), + Properties: &armconnectedcache.CacheNodeProperty{ + CacheNode: &armconnectedcache.CacheNodeEntity{ + FullyQualifiedResourceID: to.Ptr("yeinlleavzbehelhsucb"), + CustomerName: to.Ptr("zsklcocjfjhkcpmzyefzkwamdzc"), + IPAddress: to.Ptr("gbfkdhloyphnpnhemwrcrxlk"), + CustomerIndex: to.Ptr("vafvezmelfgmjsrccjukrhppljvipg"), + CacheNodeID: to.Ptr("fmrjefyddfn"), + CacheNodeName: to.Ptr("qppvqxliajjfoalzjbgmxggr"), + CustomerAsn: to.Ptr[int32](25), + IsEnabled: to.Ptr(true), + MaxAllowableEgressInMbps: to.Ptr[int32](27), + IsEnterpriseManaged: to.Ptr(true), + CidrCSV: []*string{ + to.Ptr("nlqlvrthafvvljuupcbcw"), + }, + ShouldMigrate: to.Ptr(true), + CidrSelectionType: to.Ptr[int32](11), + }, + StatusCode: to.Ptr("1"), + StatusText: to.Ptr("Success"), + StatusDetails: to.Ptr("lgljxmyyoakw"), + AdditionalCacheNodeProperties: &armconnectedcache.AdditionalCacheNodeProperties{ + CacheNodePropertiesDetailsIssuesList: []*string{ + to.Ptr("ennbzfpuszgalzpawmwicaofqcwcj"), + }, + DriveConfiguration: []*armconnectedcache.CacheNodeDriveConfiguration{ + { + PhysicalPath: to.Ptr("pcbkezoofhamkycot"), + SizeInGb: to.Ptr[int32](14), + CacheNumber: to.Ptr[int32](11), + NginxMapping: to.Ptr("cirlpkpuxg"), + }, + }, + BgpConfiguration: &armconnectedcache.BgpConfiguration{ + AsnToIPAddressMapping: to.Ptr("fjbggfvumrn"), + }, + ProxyURLConfiguration: &armconnectedcache.ProxyURLConfiguration{ + ProxyURL: to.Ptr("hplstyg"), + }, + ProxyURL: to.Ptr("ihkzxlzvpcywtzrogupqozkdud"), + OptionalProperty1: to.Ptr("ph"), + OptionalProperty2: to.Ptr("soqqgpgcbhb"), + OptionalProperty3: to.Ptr("fpnycrbagptsujiotnjfuhlm"), + OptionalProperty4: to.Ptr("gesqugrxvhxlxxyvatgrautxwlmxsf"), + OptionalProperty5: to.Ptr("zknjgzpaqtvdqjydd"), + }, + Error: &armconnectedcache.ErrorDetail{}, + }, + Tags: map[string]*string{ + "key259": to.Ptr("qbkixjuyjkoj"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %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 = armconnectedcache.EnterpriseMccCacheNodesOperationsClientCreateOrUpdateResponse{ + // EnterpriseMccCacheNodeResource: &armconnectedcache.EnterpriseMccCacheNodeResource{ + // Location: to.Ptr("westus"), + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/DOTest/providers/Microsoft.ConnectedCache/enterpriseMccCustomers/MccRPTest1/enterpriseMccCacheNodes/MCCCachenode1"), + // Name: to.Ptr("MccRPTest1"), + // Type: to.Ptr("Microsoft.ConnectedCache/enterpriseMccCustomers/enterpriseMccCacheNodes"), + // Properties: &armconnectedcache.CacheNodeProperty{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // CacheNode: &armconnectedcache.CacheNodeEntity{ + // FullyQualifiedResourceID: to.Ptr("yeinlleavzbehelhsucb"), + // CustomerID: to.Ptr("xjjgcknmsakfawcmwbdufdxktysp"), + // CustomerName: to.Ptr("zsklcocjfjhkcpmzyefzkwamdzc"), + // IPAddress: to.Ptr("gbfkdhloyphnpnhemwrcrxlk"), + // CustomerIndex: to.Ptr("vafvezmelfgmjsrccjukrhppljvipg"), + // CacheNodeID: to.Ptr("fmrjefyddfn"), + // CacheNodeName: to.Ptr("qppvqxliajjfoalzjbgmxggr"), + // CustomerAsn: to.Ptr[int32](25), + // IsEnabled: to.Ptr(true), + // MaxAllowableEgressInMbps: to.Ptr[int32](27), + // MaxAllowableProbability: to.Ptr[float32](12), + // XCid: to.Ptr("ooyrhuockukmsrqsevwaaqglhf"), + // IsEnterpriseManaged: to.Ptr(true), + // DeleteAsyncOperationID: to.Ptr("tvmivvnpisuboggoqgbobugld"), + // ClientTenantID: to.Ptr("iwrpakllacxvtqygpaimlpxvqrjz"), + // Category: to.Ptr("utfjefejkrpxcmrgygzawa"), + // ReleaseVersion: to.Ptr[int32](29), + // LastSyncWithAzureTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // SynchWithAzureAttemptsCount: to.Ptr[int32](4), + // ContainerConfigurations: to.Ptr("dyvefvbvrtsmdrdmiuphzh"), + // CidrCSV: []*string{ + // to.Ptr("nlqlvrthafvvljuupcbcw"), + // }, + // CidrCSVLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.774Z"); return t}()), + // BgpCidrCSVLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.774Z"); return t}()), + // BgpLastReportedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.774Z"); return t}()), + // BgpReviewStateText: to.Ptr("khtriksrqrjieouoz"), + // BgpReviewState: to.Ptr(armconnectedcache.BgpReviewStateEnumNotConfigured), + // BgpReviewFeedback: to.Ptr("bc"), + // BgpNumberOfTimesUpdated: to.Ptr[int32](23), + // BgpNumberOfRecords: to.Ptr[int32](25), + // BgpCidrBlocksCount: to.Ptr[int32](28), + // BgpAddressSpace: to.Ptr[int32](30), + // ShouldMigrate: to.Ptr(true), + // BgpFileBytesTruncated: to.Ptr[int32](26), + // CidrSelectionType: to.Ptr[int32](11), + // IsFrozen: to.Ptr(true), + // ReviewState: to.Ptr[int32](2), + // ReviewStateText: to.Ptr("xubwhyrdtramrmoldbxqwauyusymqu"), + // ReviewFeedback: to.Ptr("zowuztcnybt"), + // ConfigurationState: to.Ptr(armconnectedcache.ConfigurationStateConfigured), + // ConfigurationStateText: to.Ptr("okbofqwtzcsju"), + // AddressSpace: to.Ptr[int32](1), + // WorkerConnections: to.Ptr[int32](19), + // WorkerConnectionsLastUpdatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.774Z"); return t}()), + // ContainerResyncTrigger: to.Ptr[int32](23), + // ImageURI: to.Ptr("wkowdrixfxvjmdcsy"), + // }, + // StatusCode: to.Ptr("1"), + // StatusText: to.Ptr("Success"), + // StatusDetails: to.Ptr("lgljxmyyoakw"), + // AdditionalCacheNodeProperties: &armconnectedcache.AdditionalCacheNodeProperties{ + // CacheNodePropertiesDetailsIssuesList: []*string{ + // to.Ptr("ennbzfpuszgalzpawmwicaofqcwcj"), + // }, + // AggregatedStatusDetails: to.Ptr("nztcstlyjhmllbnrrluhzusmoa"), + // AggregatedStatusText: to.Ptr("ofiedyvzpbijnfghnrrigqaws"), + // AggregatedStatusCode: to.Ptr[int32](25), + // ProductVersion: to.Ptr("hfbuukpxoerpkziym"), + // IsProvisioned: to.Ptr(true), + // CacheNodeStateDetailedText: to.Ptr("onckp"), + // CacheNodeStateShortText: to.Ptr("yxkwlubqlzhkmemzjzlxksho"), + // CacheNodeState: to.Ptr[int32](30), + // DriveConfiguration: []*armconnectedcache.CacheNodeDriveConfiguration{ + // { + // PhysicalPath: to.Ptr("pcbkezoofhamkycot"), + // SizeInGb: to.Ptr[int32](14), + // CacheNumber: to.Ptr[int32](11), + // NginxMapping: to.Ptr("cirlpkpuxg"), + // }, + // }, + // BgpConfiguration: &armconnectedcache.BgpConfiguration{ + // AsnToIPAddressMapping: to.Ptr("fjbggfvumrn"), + // }, + // ProxyURLConfiguration: &armconnectedcache.ProxyURLConfiguration{ + // ProxyURL: to.Ptr("hplstyg"), + // }, + // ProxyURL: to.Ptr("ihkzxlzvpcywtzrogupqozkdud"), + // OptionalProperty1: to.Ptr("ph"), + // OptionalProperty2: to.Ptr("soqqgpgcbhb"), + // OptionalProperty3: to.Ptr("fpnycrbagptsujiotnjfuhlm"), + // OptionalProperty4: to.Ptr("gesqugrxvhxlxxyvatgrautxwlmxsf"), + // OptionalProperty5: to.Ptr("zknjgzpaqtvdqjydd"), + // }, + // Status: to.Ptr("utgrdjsw"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key259": to.Ptr("qbkixjuyjkoj"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2023-05-01-preview/EnterpriseMccCacheNodesOperations_Delete_MaximumSet_Gen.json +func ExampleEnterpriseMccCacheNodesOperationsClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewEnterpriseMccCacheNodesOperationsClient().BeginDelete(ctx, "rgConnectedCache", "hsincngmssuzeyispnufqwinpopadvhsbsemisguxgovwdjwviqexocelijvuyr", "vwtrhdoxvkrunpliwcao", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: 2023-05-01-preview/EnterpriseMccCacheNodesOperations_Get_MaximumSet_Gen.json +func ExampleEnterpriseMccCacheNodesOperationsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewEnterpriseMccCacheNodesOperationsClient().Get(ctx, "rgConnectedCache", "cygqjgtcetihsajgyqwwrbclssqsvhgltrboemcqqtpoxdbhykqxblaihmrumyhbsx", "fqxfadsultwjfzdwlqkvneakfsbyhratytmssmiukpbnus", 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 = armconnectedcache.EnterpriseMccCacheNodesOperationsClientGetResponse{ + // EnterpriseMccCacheNodeResource: &armconnectedcache.EnterpriseMccCacheNodeResource{ + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/DOTest/providers/Microsoft.ConnectedCache/enterpriseMccCustomers/MccRPTest1/enterpriseMccCacheNodes/MCCCachenode1"), + // Name: to.Ptr("MccRPTest1"), + // Type: to.Ptr("Microsoft.ConnectedCache/enterpriseMccCustomers/enterpriseMccCacheNodes"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CacheNodeProperty{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // CacheNode: &armconnectedcache.CacheNodeEntity{ + // FullyQualifiedResourceID: to.Ptr("yeinlleavzbehelhsucb"), + // CustomerID: to.Ptr("xjjgcknmsakfawcmwbdufdxktysp"), + // CustomerName: to.Ptr("zsklcocjfjhkcpmzyefzkwamdzc"), + // IPAddress: to.Ptr("gbfkdhloyphnpnhemwrcrxlk"), + // CustomerIndex: to.Ptr("vafvezmelfgmjsrccjukrhppljvipg"), + // CacheNodeID: to.Ptr("fmrjefyddfn"), + // CacheNodeName: to.Ptr("qppvqxliajjfoalzjbgmxggr"), + // CustomerAsn: to.Ptr[int32](25), + // IsEnabled: to.Ptr(true), + // MaxAllowableEgressInMbps: to.Ptr[int32](27), + // MaxAllowableProbability: to.Ptr[float32](12), + // XCid: to.Ptr("ooyrhuockukmsrqsevwaaqglhf"), + // IsEnterpriseManaged: to.Ptr(true), + // DeleteAsyncOperationID: to.Ptr("tvmivvnpisuboggoqgbobugld"), + // ClientTenantID: to.Ptr("iwrpakllacxvtqygpaimlpxvqrjz"), + // Category: to.Ptr("utfjefejkrpxcmrgygzawa"), + // ReleaseVersion: to.Ptr[int32](29), + // LastSyncWithAzureTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // SynchWithAzureAttemptsCount: to.Ptr[int32](4), + // ContainerConfigurations: to.Ptr("dyvefvbvrtsmdrdmiuphzh"), + // CidrCSV: []*string{ + // to.Ptr("kaynxstxqsoreorwh"), + // }, + // CidrCSVLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.774Z"); return t}()), + // BgpCidrCSVLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.774Z"); return t}()), + // BgpLastReportedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.774Z"); return t}()), + // BgpReviewStateText: to.Ptr("khtriksrqrjieouoz"), + // BgpReviewState: to.Ptr(armconnectedcache.BgpReviewStateEnumNotConfigured), + // BgpReviewFeedback: to.Ptr("bc"), + // BgpNumberOfTimesUpdated: to.Ptr[int32](23), + // BgpNumberOfRecords: to.Ptr[int32](25), + // BgpCidrBlocksCount: to.Ptr[int32](28), + // BgpAddressSpace: to.Ptr[int32](30), + // ShouldMigrate: to.Ptr(true), + // BgpFileBytesTruncated: to.Ptr[int32](26), + // CidrSelectionType: to.Ptr[int32](11), + // IsFrozen: to.Ptr(true), + // ReviewState: to.Ptr[int32](2), + // ReviewStateText: to.Ptr("xubwhyrdtramrmoldbxqwauyusymqu"), + // ReviewFeedback: to.Ptr("zowuztcnybt"), + // ConfigurationState: to.Ptr(armconnectedcache.ConfigurationStateConfigured), + // ConfigurationStateText: to.Ptr("okbofqwtzcsju"), + // AddressSpace: to.Ptr[int32](1), + // WorkerConnections: to.Ptr[int32](19), + // WorkerConnectionsLastUpdatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.774Z"); return t}()), + // ContainerResyncTrigger: to.Ptr[int32](23), + // ImageURI: to.Ptr("wkowdrixfxvjmdcsy"), + // }, + // StatusCode: to.Ptr("1"), + // StatusText: to.Ptr("Success"), + // StatusDetails: to.Ptr("lgljxmyyoakw"), + // AdditionalCacheNodeProperties: &armconnectedcache.AdditionalCacheNodeProperties{ + // CacheNodePropertiesDetailsIssuesList: []*string{ + // to.Ptr("ennbzfpuszgalzpawmwicaofqcwcj"), + // }, + // AggregatedStatusDetails: to.Ptr("nztcstlyjhmllbnrrluhzusmoa"), + // AggregatedStatusText: to.Ptr("ofiedyvzpbijnfghnrrigqaws"), + // AggregatedStatusCode: to.Ptr[int32](25), + // ProductVersion: to.Ptr("hfbuukpxoerpkziym"), + // IsProvisioned: to.Ptr(true), + // CacheNodeStateDetailedText: to.Ptr("onckp"), + // CacheNodeStateShortText: to.Ptr("yxkwlubqlzhkmemzjzlxksho"), + // CacheNodeState: to.Ptr[int32](30), + // DriveConfiguration: []*armconnectedcache.CacheNodeDriveConfiguration{ + // { + // PhysicalPath: to.Ptr("pcbkezoofhamkycot"), + // SizeInGb: to.Ptr[int32](14), + // CacheNumber: to.Ptr[int32](11), + // NginxMapping: to.Ptr("cirlpkpuxg"), + // }, + // }, + // BgpConfiguration: &armconnectedcache.BgpConfiguration{ + // AsnToIPAddressMapping: to.Ptr("fjbggfvumrn"), + // }, + // ProxyURLConfiguration: &armconnectedcache.ProxyURLConfiguration{ + // ProxyURL: to.Ptr("hplstyg"), + // }, + // ProxyURL: to.Ptr("ihkzxlzvpcywtzrogupqozkdud"), + // OptionalProperty1: to.Ptr("ph"), + // OptionalProperty2: to.Ptr("soqqgpgcbhb"), + // OptionalProperty3: to.Ptr("fpnycrbagptsujiotnjfuhlm"), + // OptionalProperty4: to.Ptr("gesqugrxvhxlxxyvatgrautxwlmxsf"), + // OptionalProperty5: to.Ptr("zknjgzpaqtvdqjydd"), + // }, + // Status: to.Ptr("utgrdjsw"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key259": to.Ptr("qbkixjuyjkoj"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2023-05-01-preview/EnterpriseMccCacheNodesOperations_GetCacheNodeInstallDetails_MaximumSet_Gen.json +func ExampleEnterpriseMccCacheNodesOperationsClient_GetCacheNodeInstallDetails() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewEnterpriseMccCacheNodesOperationsClient().GetCacheNodeInstallDetails(ctx, "rgConnectedCache", "fzwxcjmdpxxzayecabqqlh", "ccexmqqttritxvtctivraso", 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 = armconnectedcache.EnterpriseMccCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse{ + // MccCacheNodeInstallDetails: &armconnectedcache.MccCacheNodeInstallDetails{ + // Location: to.Ptr("westus"), + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/enterpriseMccCustomers/MccRPTest1/enterpriseMccCacheNodes/MCCCachenode1"), + // Type: to.Ptr("Microsoft.ConnectedCache/enterpriseMccCustomers/enterpriseMccCacheNodes"), + // Properties: &armconnectedcache.CacheNodeInstallProperties{ + // CustomerID: to.Ptr("eqklliuswn"), + // CacheNodeID: to.Ptr("zirahqqohbaju"), + // PrimaryAccountKey: to.Ptr("mzfvziehrsbxidhj"), + // SecondaryAccountKey: to.Ptr("dq"), + // RegistrationKey: to.Ptr("tnwkmorctwsgajewcoutombm"), + // }, + // Tags: map[string]*string{ + // "key5811": to.Ptr("betoafcoprgfcuscoew"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2023-05-01-preview/EnterpriseMccCacheNodesOperations_ListByEnterpriseMccCustomerResource_MaximumSet_Gen.json +func ExampleEnterpriseMccCacheNodesOperationsClient_NewListByEnterpriseMccCustomerResourcePager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewEnterpriseMccCacheNodesOperationsClient().NewListByEnterpriseMccCustomerResourcePager("rgConnectedCache", "syjjjzk", 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 = armconnectedcache.EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceResponse{ + // EnterpriseMccCacheNodeResourceListResult: armconnectedcache.EnterpriseMccCacheNodeResourceListResult{ + // Value: []*armconnectedcache.EnterpriseMccCacheNodeResource{ + // { + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/enterpriseMccCustomers/MccRPTest1/enterpriseMccCacheNodes/MCCCachenode1"), + // Name: to.Ptr("MccRPTest1"), + // Type: to.Ptr("Microsoft.ConnectedCache/enterpriseMccCustomers/enterpriseMccCacheNodes"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CacheNodeProperty{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // CacheNode: &armconnectedcache.CacheNodeEntity{ + // FullyQualifiedResourceID: to.Ptr("yeinlleavzbehelhsucb"), + // CustomerID: to.Ptr("xjjgcknmsakfawcmwbdufdxktysp"), + // CustomerName: to.Ptr("zsklcocjfjhkcpmzyefzkwamdzc"), + // IPAddress: to.Ptr("gbfkdhloyphnpnhemwrcrxlk"), + // CustomerIndex: to.Ptr("vafvezmelfgmjsrccjukrhppljvipg"), + // CacheNodeID: to.Ptr("fmrjefyddfn"), + // CacheNodeName: to.Ptr("qppvqxliajjfoalzjbgmxggr"), + // CustomerAsn: to.Ptr[int32](25), + // IsEnabled: to.Ptr(true), + // MaxAllowableEgressInMbps: to.Ptr[int32](27), + // MaxAllowableProbability: to.Ptr[float32](12), + // XCid: to.Ptr("ooyrhuockukmsrqsevwaaqglhf"), + // IsEnterpriseManaged: to.Ptr(true), + // DeleteAsyncOperationID: to.Ptr("tvmivvnpisuboggoqgbobugld"), + // ClientTenantID: to.Ptr("iwrpakllacxvtqygpaimlpxvqrjz"), + // Category: to.Ptr("utfjefejkrpxcmrgygzawa"), + // ReleaseVersion: to.Ptr[int32](29), + // LastSyncWithAzureTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // SynchWithAzureAttemptsCount: to.Ptr[int32](4), + // ContainerConfigurations: to.Ptr("dyvefvbvrtsmdrdmiuphzh"), + // CidrCSV: []*string{ + // to.Ptr("kaynxstxqsoreorwh"), + // }, + // CidrCSVLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.774Z"); return t}()), + // BgpCidrCSVLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.774Z"); return t}()), + // BgpLastReportedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.774Z"); return t}()), + // BgpReviewStateText: to.Ptr("khtriksrqrjieouoz"), + // BgpReviewState: to.Ptr(armconnectedcache.BgpReviewStateEnumNotConfigured), + // BgpReviewFeedback: to.Ptr("bc"), + // BgpNumberOfTimesUpdated: to.Ptr[int32](23), + // BgpNumberOfRecords: to.Ptr[int32](25), + // BgpCidrBlocksCount: to.Ptr[int32](28), + // BgpAddressSpace: to.Ptr[int32](30), + // ShouldMigrate: to.Ptr(true), + // BgpFileBytesTruncated: to.Ptr[int32](26), + // CidrSelectionType: to.Ptr[int32](11), + // IsFrozen: to.Ptr(true), + // ReviewState: to.Ptr[int32](2), + // ReviewStateText: to.Ptr("xubwhyrdtramrmoldbxqwauyusymqu"), + // ReviewFeedback: to.Ptr("zowuztcnybt"), + // ConfigurationState: to.Ptr(armconnectedcache.ConfigurationStateConfigured), + // ConfigurationStateText: to.Ptr("okbofqwtzcsju"), + // AddressSpace: to.Ptr[int32](1), + // WorkerConnections: to.Ptr[int32](19), + // WorkerConnectionsLastUpdatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.774Z"); return t}()), + // ContainerResyncTrigger: to.Ptr[int32](23), + // ImageURI: to.Ptr("wkowdrixfxvjmdcsy"), + // }, + // StatusCode: to.Ptr("1"), + // StatusText: to.Ptr("Success"), + // StatusDetails: to.Ptr("lgljxmyyoakw"), + // AdditionalCacheNodeProperties: &armconnectedcache.AdditionalCacheNodeProperties{ + // CacheNodePropertiesDetailsIssuesList: []*string{ + // to.Ptr("ennbzfpuszgalzpawmwicaofqcwcj"), + // }, + // AggregatedStatusDetails: to.Ptr("nztcstlyjhmllbnrrluhzusmoa"), + // AggregatedStatusText: to.Ptr("ofiedyvzpbijnfghnrrigqaws"), + // AggregatedStatusCode: to.Ptr[int32](25), + // ProductVersion: to.Ptr("hfbuukpxoerpkziym"), + // IsProvisioned: to.Ptr(true), + // CacheNodeStateDetailedText: to.Ptr("onckp"), + // CacheNodeStateShortText: to.Ptr("yxkwlubqlzhkmemzjzlxksho"), + // CacheNodeState: to.Ptr[int32](30), + // DriveConfiguration: []*armconnectedcache.CacheNodeDriveConfiguration{ + // { + // PhysicalPath: to.Ptr("pcbkezoofhamkycot"), + // SizeInGb: to.Ptr[int32](14), + // CacheNumber: to.Ptr[int32](11), + // NginxMapping: to.Ptr("cirlpkpuxg"), + // }, + // }, + // BgpConfiguration: &armconnectedcache.BgpConfiguration{ + // AsnToIPAddressMapping: to.Ptr("fjbggfvumrn"), + // }, + // ProxyURLConfiguration: &armconnectedcache.ProxyURLConfiguration{ + // ProxyURL: to.Ptr("hplstyg"), + // }, + // ProxyURL: to.Ptr("ihkzxlzvpcywtzrogupqozkdud"), + // OptionalProperty1: to.Ptr("ph"), + // OptionalProperty2: to.Ptr("soqqgpgcbhb"), + // OptionalProperty3: to.Ptr("fpnycrbagptsujiotnjfuhlm"), + // OptionalProperty4: to.Ptr("gesqugrxvhxlxxyvatgrautxwlmxsf"), + // OptionalProperty5: to.Ptr("zknjgzpaqtvdqjydd"), + // }, + // Status: to.Ptr("utgrdjsw"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key259": to.Ptr("qbkixjuyjkoj"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2023-05-01-preview/EnterpriseMccCacheNodesOperations_Update_MaximumSet_Gen.json +func ExampleEnterpriseMccCacheNodesOperationsClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewEnterpriseMccCacheNodesOperationsClient().Update(ctx, "rgConnectedCache", "qanjqtvrxzjkljdysdjvdiqcxkttskpdzykzuefhbhz", "kllmlvazrcxmfjfozulzqnsgvspgwmhogcafvauchunlgfr", armconnectedcache.PatchResource{ + Tags: map[string]*string{ + "key1653": to.Ptr("nzjczrhclhkndesgy"), + }, + }, 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 = armconnectedcache.EnterpriseMccCacheNodesOperationsClientUpdateResponse{ + // EnterpriseMccCacheNodeResource: &armconnectedcache.EnterpriseMccCacheNodeResource{ + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/enterpriseMccCustomers/MccRPTest1/enterpriseMccCacheNodes/MCCCachenode1"), + // Name: to.Ptr("MccRPTest1"), + // Type: to.Ptr("Microsoft.ConnectedCache/enterpriseMccCustomers/enterpriseMccCacheNodes"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CacheNodeProperty{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // CacheNode: &armconnectedcache.CacheNodeEntity{ + // FullyQualifiedResourceID: to.Ptr("yeinlleavzbehelhsucb"), + // CustomerID: to.Ptr("xjjgcknmsakfawcmwbdufdxktysp"), + // CustomerName: to.Ptr("zsklcocjfjhkcpmzyefzkwamdzc"), + // IPAddress: to.Ptr("gbfkdhloyphnpnhemwrcrxlk"), + // CustomerIndex: to.Ptr("vafvezmelfgmjsrccjukrhppljvipg"), + // CacheNodeID: to.Ptr("fmrjefyddfn"), + // CacheNodeName: to.Ptr("qppvqxliajjfoalzjbgmxggr"), + // CustomerAsn: to.Ptr[int32](25), + // IsEnabled: to.Ptr(true), + // MaxAllowableEgressInMbps: to.Ptr[int32](27), + // MaxAllowableProbability: to.Ptr[float32](12), + // XCid: to.Ptr("ooyrhuockukmsrqsevwaaqglhf"), + // IsEnterpriseManaged: to.Ptr(true), + // DeleteAsyncOperationID: to.Ptr("tvmivvnpisuboggoqgbobugld"), + // ClientTenantID: to.Ptr("iwrpakllacxvtqygpaimlpxvqrjz"), + // Category: to.Ptr("utfjefejkrpxcmrgygzawa"), + // ReleaseVersion: to.Ptr[int32](29), + // LastSyncWithAzureTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // SynchWithAzureAttemptsCount: to.Ptr[int32](4), + // ContainerConfigurations: to.Ptr("dyvefvbvrtsmdrdmiuphzh"), + // CidrCSV: []*string{ + // to.Ptr("kaynxstxqsoreorwh"), + // }, + // CidrCSVLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.774Z"); return t}()), + // BgpCidrCSVLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.774Z"); return t}()), + // BgpLastReportedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.774Z"); return t}()), + // BgpReviewStateText: to.Ptr("khtriksrqrjieouoz"), + // BgpReviewState: to.Ptr(armconnectedcache.BgpReviewStateEnumNotConfigured), + // BgpReviewFeedback: to.Ptr("bc"), + // BgpNumberOfTimesUpdated: to.Ptr[int32](23), + // BgpNumberOfRecords: to.Ptr[int32](25), + // BgpCidrBlocksCount: to.Ptr[int32](28), + // BgpAddressSpace: to.Ptr[int32](30), + // ShouldMigrate: to.Ptr(true), + // BgpFileBytesTruncated: to.Ptr[int32](26), + // CidrSelectionType: to.Ptr[int32](11), + // IsFrozen: to.Ptr(true), + // ReviewState: to.Ptr[int32](2), + // ReviewStateText: to.Ptr("xubwhyrdtramrmoldbxqwauyusymqu"), + // ReviewFeedback: to.Ptr("zowuztcnybt"), + // ConfigurationState: to.Ptr(armconnectedcache.ConfigurationStateConfigured), + // ConfigurationStateText: to.Ptr("okbofqwtzcsju"), + // AddressSpace: to.Ptr[int32](1), + // WorkerConnections: to.Ptr[int32](19), + // WorkerConnectionsLastUpdatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.774Z"); return t}()), + // ContainerResyncTrigger: to.Ptr[int32](23), + // ImageURI: to.Ptr("wkowdrixfxvjmdcsy"), + // }, + // StatusCode: to.Ptr("1"), + // StatusText: to.Ptr("Success"), + // StatusDetails: to.Ptr("lgljxmyyoakw"), + // AdditionalCacheNodeProperties: &armconnectedcache.AdditionalCacheNodeProperties{ + // CacheNodePropertiesDetailsIssuesList: []*string{ + // to.Ptr("ennbzfpuszgalzpawmwicaofqcwcj"), + // }, + // AggregatedStatusDetails: to.Ptr("nztcstlyjhmllbnrrluhzusmoa"), + // AggregatedStatusText: to.Ptr("ofiedyvzpbijnfghnrrigqaws"), + // AggregatedStatusCode: to.Ptr[int32](25), + // ProductVersion: to.Ptr("hfbuukpxoerpkziym"), + // IsProvisioned: to.Ptr(true), + // CacheNodeStateDetailedText: to.Ptr("onckp"), + // CacheNodeStateShortText: to.Ptr("yxkwlubqlzhkmemzjzlxksho"), + // CacheNodeState: to.Ptr[int32](30), + // DriveConfiguration: []*armconnectedcache.CacheNodeDriveConfiguration{ + // { + // PhysicalPath: to.Ptr("pcbkezoofhamkycot"), + // SizeInGb: to.Ptr[int32](14), + // CacheNumber: to.Ptr[int32](11), + // NginxMapping: to.Ptr("cirlpkpuxg"), + // }, + // }, + // BgpConfiguration: &armconnectedcache.BgpConfiguration{ + // AsnToIPAddressMapping: to.Ptr("fjbggfvumrn"), + // }, + // ProxyURLConfiguration: &armconnectedcache.ProxyURLConfiguration{ + // ProxyURL: to.Ptr("hplstyg"), + // }, + // ProxyURL: to.Ptr("ihkzxlzvpcywtzrogupqozkdud"), + // OptionalProperty1: to.Ptr("ph"), + // OptionalProperty2: to.Ptr("soqqgpgcbhb"), + // OptionalProperty3: to.Ptr("fpnycrbagptsujiotnjfuhlm"), + // OptionalProperty4: to.Ptr("gesqugrxvhxlxxyvatgrautxwlmxsf"), + // OptionalProperty5: to.Ptr("zknjgzpaqtvdqjydd"), + // }, + // Status: to.Ptr("utgrdjsw"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // }, + // }, + // Tags: map[string]*string{ + // "key259": to.Ptr("qbkixjuyjkoj"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/enterprisemcccustomers_client.go b/sdk/resourcemanager/connectedcache/armconnectedcache/enterprisemcccustomers_client.go new file mode 100644 index 000000000000..ec10681f124e --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/enterprisemcccustomers_client.go @@ -0,0 +1,448 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armconnectedcache + +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" +) + +// EnterpriseMccCustomersClient contains the methods for the EnterpriseMccCustomers group. +// Don't use this type directly, use NewEnterpriseMccCustomersClient() instead. +type EnterpriseMccCustomersClient struct { + internal *arm.Client + subscriptionID string +} + +// NewEnterpriseMccCustomersClient creates a new instance of EnterpriseMccCustomersClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewEnterpriseMccCustomersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*EnterpriseMccCustomersClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &EnterpriseMccCustomersClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - This api creates an enterprise mcc customer with the specified create parameters +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - resource - Resource create parameters. +// - options - EnterpriseMccCustomersClientBeginCreateOrUpdateOptions contains the optional parameters for the EnterpriseMccCustomersClient.BeginCreateOrUpdate +// method. +func (client *EnterpriseMccCustomersClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, customerResourceName string, resource EnterpriseMccCustomerResource, options *EnterpriseMccCustomersClientBeginCreateOrUpdateOptions) (*runtime.Poller[EnterpriseMccCustomersClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, customerResourceName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[EnterpriseMccCustomersClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[EnterpriseMccCustomersClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - This api creates an enterprise mcc customer with the specified create parameters +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +func (client *EnterpriseMccCustomersClient) createOrUpdate(ctx context.Context, resourceGroupName string, customerResourceName string, resource EnterpriseMccCustomerResource, options *EnterpriseMccCustomersClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "EnterpriseMccCustomersClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, customerResourceName, resource, 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 +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *EnterpriseMccCustomersClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, resource EnterpriseMccCustomerResource, _ *EnterpriseMccCustomersClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/enterpriseMccCustomers/{customerResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + 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-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - This api deletes an existing enterprise mcc customer resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - options - EnterpriseMccCustomersClientBeginDeleteOptions contains the optional parameters for the EnterpriseMccCustomersClient.BeginDelete +// method. +func (client *EnterpriseMccCustomersClient) BeginDelete(ctx context.Context, resourceGroupName string, customerResourceName string, options *EnterpriseMccCustomersClientBeginDeleteOptions) (*runtime.Poller[EnterpriseMccCustomersClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, customerResourceName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[EnterpriseMccCustomersClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[EnterpriseMccCustomersClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - This api deletes an existing enterprise mcc customer resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +func (client *EnterpriseMccCustomersClient) deleteOperation(ctx context.Context, resourceGroupName string, customerResourceName string, options *EnterpriseMccCustomersClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "EnterpriseMccCustomersClient.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, customerResourceName, 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.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *EnterpriseMccCustomersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, _ *EnterpriseMccCustomersClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/enterpriseMccCustomers/{customerResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + 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-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the enterprise mcc customer resource information using this get call +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - options - EnterpriseMccCustomersClientGetOptions contains the optional parameters for the EnterpriseMccCustomersClient.Get +// method. +func (client *EnterpriseMccCustomersClient) Get(ctx context.Context, resourceGroupName string, customerResourceName string, options *EnterpriseMccCustomersClientGetOptions) (EnterpriseMccCustomersClientGetResponse, error) { + var err error + const operationName = "EnterpriseMccCustomersClient.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, customerResourceName, options) + if err != nil { + return EnterpriseMccCustomersClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return EnterpriseMccCustomersClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return EnterpriseMccCustomersClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *EnterpriseMccCustomersClient) getCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, _ *EnterpriseMccCustomersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/enterpriseMccCustomers/{customerResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + 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-05-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 *EnterpriseMccCustomersClient) getHandleResponse(resp *http.Response) (EnterpriseMccCustomersClientGetResponse, error) { + result := EnterpriseMccCustomersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EnterpriseMccCustomerResource); err != nil { + return EnterpriseMccCustomersClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - This api gets the information about all enterprise mcc customer resources under the given +// subscription and resource group +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - EnterpriseMccCustomersClientListByResourceGroupOptions contains the optional parameters for the EnterpriseMccCustomersClient.NewListByResourceGroupPager +// method. +func (client *EnterpriseMccCustomersClient) NewListByResourceGroupPager(resourceGroupName string, options *EnterpriseMccCustomersClientListByResourceGroupOptions) *runtime.Pager[EnterpriseMccCustomersClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[EnterpriseMccCustomersClientListByResourceGroupResponse]{ + More: func(page EnterpriseMccCustomersClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *EnterpriseMccCustomersClientListByResourceGroupResponse) (EnterpriseMccCustomersClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "EnterpriseMccCustomersClient.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 EnterpriseMccCustomersClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *EnterpriseMccCustomersClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *EnterpriseMccCustomersClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/enterpriseMccCustomers" + 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-05-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 *EnterpriseMccCustomersClient) listByResourceGroupHandleResponse(resp *http.Response) (EnterpriseMccCustomersClientListByResourceGroupResponse, error) { + result := EnterpriseMccCustomersClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EnterpriseMccCustomerResourceListResult); err != nil { + return EnterpriseMccCustomersClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - This api gets information about all enterpriseMccCustomer resources under the given subscription +// +// Generated from API version 2023-05-01-preview +// - options - EnterpriseMccCustomersClientListBySubscriptionOptions contains the optional parameters for the EnterpriseMccCustomersClient.NewListBySubscriptionPager +// method. +func (client *EnterpriseMccCustomersClient) NewListBySubscriptionPager(options *EnterpriseMccCustomersClientListBySubscriptionOptions) *runtime.Pager[EnterpriseMccCustomersClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[EnterpriseMccCustomersClientListBySubscriptionResponse]{ + More: func(page EnterpriseMccCustomersClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *EnterpriseMccCustomersClientListBySubscriptionResponse) (EnterpriseMccCustomersClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "EnterpriseMccCustomersClient.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 EnterpriseMccCustomersClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *EnterpriseMccCustomersClient) listBySubscriptionCreateRequest(ctx context.Context, _ *EnterpriseMccCustomersClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ConnectedCache/enterpriseMccCustomers" + 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-05-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 *EnterpriseMccCustomersClient) listBySubscriptionHandleResponse(resp *http.Response) (EnterpriseMccCustomersClientListBySubscriptionResponse, error) { + result := EnterpriseMccCustomersClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EnterpriseMccCustomerResourceListResult); err != nil { + return EnterpriseMccCustomersClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// Update - This api updates an existing enterprise mcc customer resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - properties - The resource properties to be updated. +// - options - EnterpriseMccCustomersClientUpdateOptions contains the optional parameters for the EnterpriseMccCustomersClient.Update +// method. +func (client *EnterpriseMccCustomersClient) Update(ctx context.Context, resourceGroupName string, customerResourceName string, properties PatchResource, options *EnterpriseMccCustomersClientUpdateOptions) (EnterpriseMccCustomersClientUpdateResponse, error) { + var err error + const operationName = "EnterpriseMccCustomersClient.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, customerResourceName, properties, options) + if err != nil { + return EnterpriseMccCustomersClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return EnterpriseMccCustomersClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return EnterpriseMccCustomersClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *EnterpriseMccCustomersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, properties PatchResource, _ *EnterpriseMccCustomersClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/enterpriseMccCustomers/{customerResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + 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-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *EnterpriseMccCustomersClient) updateHandleResponse(resp *http.Response) (EnterpriseMccCustomersClientUpdateResponse, error) { + result := EnterpriseMccCustomersClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EnterpriseMccCustomerResource); err != nil { + return EnterpriseMccCustomersClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/enterprisemcccustomers_client_example_test.go b/sdk/resourcemanager/connectedcache/armconnectedcache/enterprisemcccustomers_client_example_test.go new file mode 100644 index 000000000000..ce3c3099eabc --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/enterprisemcccustomers_client_example_test.go @@ -0,0 +1,609 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armconnectedcache_test + +import ( + "context" + "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/connectedcache/armconnectedcache" + "log" + "time" +) + +// Generated from example definition: 2023-05-01-preview/EnterpriseMccCustomers_CreateOrUpdate_MaximumSet_Gen.json +func ExampleEnterpriseMccCustomersClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewEnterpriseMccCustomersClient().BeginCreateOrUpdate(ctx, "rgConnectedCache", "MccRPTest1", armconnectedcache.EnterpriseMccCustomerResource{ + Properties: &armconnectedcache.CustomerProperty{ + Customer: &armconnectedcache.CustomerEntity{ + FullyQualifiedResourceID: to.Ptr("uqsbtgae"), + CustomerName: to.Ptr("mkpzynfqihnjfdbaqbqwyhd"), + ContactEmail: to.Ptr("xquos"), + ContactPhone: to.Ptr("vue"), + ContactName: to.Ptr("wxyqjoyoscmvimgwhpitxky"), + IsEntitled: to.Ptr(true), + ReleaseVersion: to.Ptr[int32](20), + ClientTenantID: to.Ptr("fproidkpgvpdnac"), + IsEnterpriseManaged: to.Ptr(true), + ShouldMigrate: to.Ptr(true), + ResendSignupCode: to.Ptr(true), + VerifySignupCode: to.Ptr(true), + VerifySignupPhrase: to.Ptr("tprjvttkgmrqlsyicnidhm"), + }, + AdditionalCustomerProperties: &armconnectedcache.AdditionalCustomerProperties{ + CustomerEmail: to.Ptr("zdjgibsidydyzm"), + CustomerTransitAsn: to.Ptr("habgklnxqzmozqpazoyejwiphezpi"), + CustomerAsn: to.Ptr("hgrelgnrtdkleisnepfolu"), + CustomerEntitlementSKUID: to.Ptr("b"), + CustomerEntitlementSKUGUID: to.Ptr("rvzmdpxyflgqetvpwupnfaxsweiiz"), + CustomerEntitlementSKUName: to.Ptr("waaqfijr"), + CustomerEntitlementExpiration: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t }()), + OptionalProperty1: to.Ptr("qhmwxza"), + OptionalProperty2: to.Ptr("l"), + OptionalProperty3: to.Ptr("mblwwvbie"), + OptionalProperty4: to.Ptr("vzuek"), + OptionalProperty5: to.Ptr("fzjodscdfcdr"), + }, + Error: &armconnectedcache.ErrorDetail{}, + }, + Tags: map[string]*string{ + "key3379": to.Ptr("dpyqeaqhcnutzezom"), + }, + Location: to.Ptr("westus"), + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %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 = armconnectedcache.EnterpriseMccCustomersClientCreateOrUpdateResponse{ + // EnterpriseMccCustomerResource: &armconnectedcache.EnterpriseMccCustomerResource{ + // Properties: &armconnectedcache.CustomerProperty{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // Customer: &armconnectedcache.CustomerEntity{ + // FullyQualifiedResourceID: to.Ptr("uqsbtgae"), + // CustomerID: to.Ptr("nqxuzybu"), + // CustomerName: to.Ptr("mkpzynfqihnjfdbaqbqwyhd"), + // ContactEmail: to.Ptr("xquos"), + // ContactPhone: to.Ptr("vue"), + // ContactName: to.Ptr("wxyqjoyoscmvimgwhpitxky"), + // IsEntitled: to.Ptr(true), + // ReleaseVersion: to.Ptr[int32](20), + // CreateAsyncOperationID: to.Ptr("zjpvgirzxecwmnfyofqkikst"), + // DeleteAsyncOperationID: to.Ptr("ajtdyoyecybeaxzyztjkvvtx"), + // ClientTenantID: to.Ptr("fproidkpgvpdnac"), + // SynchWithAzureAttemptsCount: to.Ptr[int32](17), + // LastSyncWithAzureTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // IsEnterpriseManaged: to.Ptr(true), + // ShouldMigrate: to.Ptr(true), + // ResendSignupCode: to.Ptr(true), + // VerifySignupCode: to.Ptr(true), + // }, + // AdditionalCustomerProperties: &armconnectedcache.AdditionalCustomerProperties{ + // PeeringDbLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheEfficiency: to.Ptr[float32](20), + // CustomerPropertiesOverviewAverageEgressMbps: to.Ptr[float32](8), + // CustomerPropertiesOverviewAverageMissMbps: to.Ptr[float32](19), + // CustomerPropertiesOverviewEgressMbpsMax: to.Ptr[float32](15), + // CustomerPropertiesOverviewEgressMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewMissMbpsMax: to.Ptr[float32](28), + // CustomerPropertiesOverviewMissMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheNodesHealthyCount: to.Ptr[int32](24), + // CustomerPropertiesOverviewCacheNodesUnhealthyCount: to.Ptr[int32](15), + // SignupStatus: to.Ptr(true), + // SignupStatusCode: to.Ptr[int32](21), + // SignupStatusText: to.Ptr("dccv"), + // SignupPhaseStatusCode: to.Ptr[int32](4), + // SignupPhaseStatusText: to.Ptr("q"), + // PeeringDbLastUpdateDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerOrgName: to.Ptr("nshrwjhhggmdaqlpc"), + // CustomerEmail: to.Ptr("zdjgibsidydyzm"), + // CustomerTransitAsn: to.Ptr("habgklnxqzmozqpazoyejwiphezpi"), + // CustomerAsn: to.Ptr("hgrelgnrtdkleisnepfolu"), + // CustomerAsnEstimatedEgressPeekGbps: to.Ptr[float32](10), + // CustomerEntitlementSKUID: to.Ptr("b"), + // CustomerEntitlementSKUGUID: to.Ptr("rvzmdpxyflgqetvpwupnfaxsweiiz"), + // CustomerEntitlementSKUName: to.Ptr("waaqfijr"), + // CustomerEntitlementExpiration: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // OptionalProperty1: to.Ptr("qhmwxza"), + // OptionalProperty2: to.Ptr("l"), + // OptionalProperty3: to.Ptr("mblwwvbie"), + // OptionalProperty4: to.Ptr("vzuek"), + // OptionalProperty5: to.Ptr("fzjodscdfcdr"), + // }, + // StatusCode: to.Ptr("jax"), + // StatusText: to.Ptr("vsqydgruhuwuyipsplylgiqmkcv"), + // StatusDetails: to.Ptr("wmtksbahlbxrzaksogdbozfi"), + // Status: to.Ptr("rhfjbcr"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key3379": to.Ptr("dpyqeaqhcnutzezom"), + // }, + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/enterpriseMccCustomers/MccRPTest1"), + // Name: to.Ptr("MccRPTest1"), + // Type: to.Ptr("Microsoft.ConnectedCache/enterpriseMccCustomers"), + // Location: to.Ptr("westus"), + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2023-05-01-preview/EnterpriseMccCustomers_Delete_MaximumSet_Gen.json +func ExampleEnterpriseMccCustomersClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewEnterpriseMccCustomersClient().BeginDelete(ctx, "rgConnectedCache", "zktb", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: 2023-05-01-preview/EnterpriseMccCustomers_Get_MaximumSet_Gen.json +func ExampleEnterpriseMccCustomersClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewEnterpriseMccCustomersClient().Get(ctx, "rgConnectedCache", "pvilvqkofbjbykupeewgvzlmjao", 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 = armconnectedcache.EnterpriseMccCustomersClientGetResponse{ + // EnterpriseMccCustomerResource: &armconnectedcache.EnterpriseMccCustomerResource{ + // Properties: &armconnectedcache.CustomerProperty{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // Customer: &armconnectedcache.CustomerEntity{ + // FullyQualifiedResourceID: to.Ptr("uqsbtgae"), + // CustomerID: to.Ptr("nqxuzybu"), + // CustomerName: to.Ptr("mkpzynfqihnjfdbaqbqwyhd"), + // ContactEmail: to.Ptr("xquos"), + // ContactPhone: to.Ptr("vue"), + // ContactName: to.Ptr("wxyqjoyoscmvimgwhpitxky"), + // IsEntitled: to.Ptr(true), + // ReleaseVersion: to.Ptr[int32](20), + // CreateAsyncOperationID: to.Ptr("zjpvgirzxecwmnfyofqkikst"), + // DeleteAsyncOperationID: to.Ptr("ajtdyoyecybeaxzyztjkvvtx"), + // ClientTenantID: to.Ptr("fproidkpgvpdnac"), + // SynchWithAzureAttemptsCount: to.Ptr[int32](17), + // LastSyncWithAzureTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // IsEnterpriseManaged: to.Ptr(true), + // ShouldMigrate: to.Ptr(true), + // ResendSignupCode: to.Ptr(true), + // VerifySignupCode: to.Ptr(true), + // }, + // AdditionalCustomerProperties: &armconnectedcache.AdditionalCustomerProperties{ + // PeeringDbLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheEfficiency: to.Ptr[float32](20), + // CustomerPropertiesOverviewAverageEgressMbps: to.Ptr[float32](8), + // CustomerPropertiesOverviewAverageMissMbps: to.Ptr[float32](19), + // CustomerPropertiesOverviewEgressMbpsMax: to.Ptr[float32](15), + // CustomerPropertiesOverviewEgressMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewMissMbpsMax: to.Ptr[float32](28), + // CustomerPropertiesOverviewMissMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheNodesHealthyCount: to.Ptr[int32](24), + // CustomerPropertiesOverviewCacheNodesUnhealthyCount: to.Ptr[int32](15), + // SignupStatus: to.Ptr(true), + // SignupStatusCode: to.Ptr[int32](21), + // SignupStatusText: to.Ptr("dccv"), + // SignupPhaseStatusCode: to.Ptr[int32](4), + // SignupPhaseStatusText: to.Ptr("q"), + // PeeringDbLastUpdateDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerOrgName: to.Ptr("nshrwjhhggmdaqlpc"), + // CustomerEmail: to.Ptr("zdjgibsidydyzm"), + // CustomerTransitAsn: to.Ptr("habgklnxqzmozqpazoyejwiphezpi"), + // CustomerAsn: to.Ptr("hgrelgnrtdkleisnepfolu"), + // CustomerAsnEstimatedEgressPeekGbps: to.Ptr[float32](10), + // CustomerEntitlementSKUID: to.Ptr("b"), + // CustomerEntitlementSKUGUID: to.Ptr("rvzmdpxyflgqetvpwupnfaxsweiiz"), + // CustomerEntitlementSKUName: to.Ptr("waaqfijr"), + // CustomerEntitlementExpiration: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // OptionalProperty1: to.Ptr("qhmwxza"), + // OptionalProperty2: to.Ptr("l"), + // OptionalProperty3: to.Ptr("mblwwvbie"), + // OptionalProperty4: to.Ptr("vzuek"), + // OptionalProperty5: to.Ptr("fzjodscdfcdr"), + // }, + // StatusCode: to.Ptr("jax"), + // StatusText: to.Ptr("vsqydgruhuwuyipsplylgiqmkcv"), + // StatusDetails: to.Ptr("wmtksbahlbxrzaksogdbozfi"), + // Status: to.Ptr("rhfjbcr"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key3379": to.Ptr("dpyqeaqhcnutzezom"), + // }, + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/enterpriseMccCustomers/MccRPTest1"), + // Name: to.Ptr("MccRPTest1"), + // Type: to.Ptr("Microsoft.ConnectedCache/enterpriseMccCustomers"), + // Location: to.Ptr("westus"), + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2023-05-01-preview/EnterpriseMccCustomers_ListByResourceGroup_MaximumSet_Gen.json +func ExampleEnterpriseMccCustomersClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewEnterpriseMccCustomersClient().NewListByResourceGroupPager("rgConnectedCache", 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 = armconnectedcache.EnterpriseMccCustomersClientListByResourceGroupResponse{ + // EnterpriseMccCustomerResourceListResult: armconnectedcache.EnterpriseMccCustomerResourceListResult{ + // Value: []*armconnectedcache.EnterpriseMccCustomerResource{ + // { + // Properties: &armconnectedcache.CustomerProperty{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // Customer: &armconnectedcache.CustomerEntity{ + // FullyQualifiedResourceID: to.Ptr("uqsbtgae"), + // CustomerID: to.Ptr("nqxuzybu"), + // CustomerName: to.Ptr("mkpzynfqihnjfdbaqbqwyhd"), + // ContactEmail: to.Ptr("xquos"), + // ContactPhone: to.Ptr("vue"), + // ContactName: to.Ptr("wxyqjoyoscmvimgwhpitxky"), + // IsEntitled: to.Ptr(true), + // ReleaseVersion: to.Ptr[int32](20), + // CreateAsyncOperationID: to.Ptr("zjpvgirzxecwmnfyofqkikst"), + // DeleteAsyncOperationID: to.Ptr("ajtdyoyecybeaxzyztjkvvtx"), + // ClientTenantID: to.Ptr("fproidkpgvpdnac"), + // SynchWithAzureAttemptsCount: to.Ptr[int32](17), + // LastSyncWithAzureTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // IsEnterpriseManaged: to.Ptr(true), + // ShouldMigrate: to.Ptr(true), + // ResendSignupCode: to.Ptr(true), + // VerifySignupCode: to.Ptr(true), + // }, + // AdditionalCustomerProperties: &armconnectedcache.AdditionalCustomerProperties{ + // PeeringDbLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheEfficiency: to.Ptr[float32](20), + // CustomerPropertiesOverviewAverageEgressMbps: to.Ptr[float32](8), + // CustomerPropertiesOverviewAverageMissMbps: to.Ptr[float32](19), + // CustomerPropertiesOverviewEgressMbpsMax: to.Ptr[float32](15), + // CustomerPropertiesOverviewEgressMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewMissMbpsMax: to.Ptr[float32](28), + // CustomerPropertiesOverviewMissMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheNodesHealthyCount: to.Ptr[int32](24), + // CustomerPropertiesOverviewCacheNodesUnhealthyCount: to.Ptr[int32](15), + // SignupStatus: to.Ptr(true), + // SignupStatusCode: to.Ptr[int32](21), + // SignupStatusText: to.Ptr("dccv"), + // SignupPhaseStatusCode: to.Ptr[int32](4), + // SignupPhaseStatusText: to.Ptr("q"), + // PeeringDbLastUpdateDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerOrgName: to.Ptr("nshrwjhhggmdaqlpc"), + // CustomerEmail: to.Ptr("zdjgibsidydyzm"), + // CustomerTransitAsn: to.Ptr("habgklnxqzmozqpazoyejwiphezpi"), + // CustomerAsn: to.Ptr("hgrelgnrtdkleisnepfolu"), + // CustomerAsnEstimatedEgressPeekGbps: to.Ptr[float32](10), + // CustomerEntitlementSKUID: to.Ptr("b"), + // CustomerEntitlementSKUGUID: to.Ptr("rvzmdpxyflgqetvpwupnfaxsweiiz"), + // CustomerEntitlementSKUName: to.Ptr("waaqfijr"), + // CustomerEntitlementExpiration: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // OptionalProperty1: to.Ptr("qhmwxza"), + // OptionalProperty2: to.Ptr("l"), + // OptionalProperty3: to.Ptr("mblwwvbie"), + // OptionalProperty4: to.Ptr("vzuek"), + // OptionalProperty5: to.Ptr("fzjodscdfcdr"), + // }, + // StatusCode: to.Ptr("jax"), + // StatusText: to.Ptr("vsqydgruhuwuyipsplylgiqmkcv"), + // StatusDetails: to.Ptr("wmtksbahlbxrzaksogdbozfi"), + // Status: to.Ptr("rhfjbcr"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key3379": to.Ptr("dpyqeaqhcnutzezom"), + // }, + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/enterpriseMccCustomers/MccRPTest1"), + // Name: to.Ptr("MccRPTest1"), + // Type: to.Ptr("Microsoft.ConnectedCache/enterpriseMccCustomers"), + // Location: to.Ptr("westus"), + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/ae"), + // }, + // } + } +} + +// Generated from example definition: 2023-05-01-preview/EnterpriseMccCustomers_ListBySubscription_MaximumSet_Gen.json +func ExampleEnterpriseMccCustomersClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewEnterpriseMccCustomersClient().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 = armconnectedcache.EnterpriseMccCustomersClientListBySubscriptionResponse{ + // EnterpriseMccCustomerResourceListResult: armconnectedcache.EnterpriseMccCustomerResourceListResult{ + // Value: []*armconnectedcache.EnterpriseMccCustomerResource{ + // { + // Properties: &armconnectedcache.CustomerProperty{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // Customer: &armconnectedcache.CustomerEntity{ + // FullyQualifiedResourceID: to.Ptr("uqsbtgae"), + // CustomerID: to.Ptr("nqxuzybu"), + // CustomerName: to.Ptr("mkpzynfqihnjfdbaqbqwyhd"), + // ContactEmail: to.Ptr("xquos"), + // ContactPhone: to.Ptr("vue"), + // ContactName: to.Ptr("wxyqjoyoscmvimgwhpitxky"), + // IsEntitled: to.Ptr(true), + // ReleaseVersion: to.Ptr[int32](20), + // CreateAsyncOperationID: to.Ptr("zjpvgirzxecwmnfyofqkikst"), + // DeleteAsyncOperationID: to.Ptr("ajtdyoyecybeaxzyztjkvvtx"), + // ClientTenantID: to.Ptr("fproidkpgvpdnac"), + // SynchWithAzureAttemptsCount: to.Ptr[int32](17), + // LastSyncWithAzureTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // IsEnterpriseManaged: to.Ptr(true), + // ShouldMigrate: to.Ptr(true), + // ResendSignupCode: to.Ptr(true), + // VerifySignupCode: to.Ptr(true), + // }, + // AdditionalCustomerProperties: &armconnectedcache.AdditionalCustomerProperties{ + // PeeringDbLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheEfficiency: to.Ptr[float32](20), + // CustomerPropertiesOverviewAverageEgressMbps: to.Ptr[float32](8), + // CustomerPropertiesOverviewAverageMissMbps: to.Ptr[float32](19), + // CustomerPropertiesOverviewEgressMbpsMax: to.Ptr[float32](15), + // CustomerPropertiesOverviewEgressMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewMissMbpsMax: to.Ptr[float32](28), + // CustomerPropertiesOverviewMissMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheNodesHealthyCount: to.Ptr[int32](24), + // CustomerPropertiesOverviewCacheNodesUnhealthyCount: to.Ptr[int32](15), + // SignupStatus: to.Ptr(true), + // SignupStatusCode: to.Ptr[int32](21), + // SignupStatusText: to.Ptr("dccv"), + // SignupPhaseStatusCode: to.Ptr[int32](4), + // SignupPhaseStatusText: to.Ptr("q"), + // PeeringDbLastUpdateDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerOrgName: to.Ptr("nshrwjhhggmdaqlpc"), + // CustomerEmail: to.Ptr("zdjgibsidydyzm"), + // CustomerTransitAsn: to.Ptr("habgklnxqzmozqpazoyejwiphezpi"), + // CustomerAsn: to.Ptr("hgrelgnrtdkleisnepfolu"), + // CustomerAsnEstimatedEgressPeekGbps: to.Ptr[float32](10), + // CustomerEntitlementSKUID: to.Ptr("b"), + // CustomerEntitlementSKUGUID: to.Ptr("rvzmdpxyflgqetvpwupnfaxsweiiz"), + // CustomerEntitlementSKUName: to.Ptr("waaqfijr"), + // CustomerEntitlementExpiration: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // OptionalProperty1: to.Ptr("qhmwxza"), + // OptionalProperty2: to.Ptr("l"), + // OptionalProperty3: to.Ptr("mblwwvbie"), + // OptionalProperty4: to.Ptr("vzuek"), + // OptionalProperty5: to.Ptr("fzjodscdfcdr"), + // }, + // StatusCode: to.Ptr("jax"), + // StatusText: to.Ptr("vsqydgruhuwuyipsplylgiqmkcv"), + // StatusDetails: to.Ptr("wmtksbahlbxrzaksogdbozfi"), + // Status: to.Ptr("rhfjbcr"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key3379": to.Ptr("dpyqeaqhcnutzezom"), + // }, + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/enterpriseMccCustomers/MccRPTest1"), + // Name: to.Ptr("MccRPTest1"), + // Type: to.Ptr("Microsoft.ConnectedCache/enterpriseMccCustomers"), + // Location: to.Ptr("westus"), + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/ae"), + // }, + // } + } +} + +// Generated from example definition: 2023-05-01-preview/EnterpriseMccCustomers_Update_MaximumSet_Gen.json +func ExampleEnterpriseMccCustomersClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewEnterpriseMccCustomersClient().Update(ctx, "rgConnectedCache", "MccRPTest1", armconnectedcache.PatchResource{ + Tags: map[string]*string{ + "key1878": to.Ptr("warz"), + }, + }, 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 = armconnectedcache.EnterpriseMccCustomersClientUpdateResponse{ + // EnterpriseMccCustomerResource: &armconnectedcache.EnterpriseMccCustomerResource{ + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/ispCustomers/MccRPTest2"), + // Name: to.Ptr("MCCTPTest2"), + // Type: to.Ptr("Microsoft.ConnectedCache/ispCustomers"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CustomerProperty{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // Customer: &armconnectedcache.CustomerEntity{ + // FullyQualifiedResourceID: to.Ptr("uqsbtgae"), + // CustomerID: to.Ptr("nqxuzybu"), + // CustomerName: to.Ptr("mkpzynfqihnjfdbaqbqwyhd"), + // ContactEmail: to.Ptr("xquos"), + // ContactPhone: to.Ptr("vue"), + // ContactName: to.Ptr("wxyqjoyoscmvimgwhpitxky"), + // IsEntitled: to.Ptr(true), + // ReleaseVersion: to.Ptr[int32](20), + // CreateAsyncOperationID: to.Ptr("zjpvgirzxecwmnfyofqkikst"), + // DeleteAsyncOperationID: to.Ptr("ajtdyoyecybeaxzyztjkvvtx"), + // ClientTenantID: to.Ptr("fproidkpgvpdnac"), + // SynchWithAzureAttemptsCount: to.Ptr[int32](17), + // LastSyncWithAzureTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // IsEnterpriseManaged: to.Ptr(true), + // ShouldMigrate: to.Ptr(true), + // ResendSignupCode: to.Ptr(true), + // VerifySignupCode: to.Ptr(true), + // }, + // AdditionalCustomerProperties: &armconnectedcache.AdditionalCustomerProperties{ + // PeeringDbLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheEfficiency: to.Ptr[float32](20), + // CustomerPropertiesOverviewAverageEgressMbps: to.Ptr[float32](8), + // CustomerPropertiesOverviewAverageMissMbps: to.Ptr[float32](19), + // CustomerPropertiesOverviewEgressMbpsMax: to.Ptr[float32](15), + // CustomerPropertiesOverviewEgressMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewMissMbpsMax: to.Ptr[float32](28), + // CustomerPropertiesOverviewMissMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheNodesHealthyCount: to.Ptr[int32](24), + // CustomerPropertiesOverviewCacheNodesUnhealthyCount: to.Ptr[int32](15), + // SignupStatus: to.Ptr(true), + // SignupStatusCode: to.Ptr[int32](21), + // SignupStatusText: to.Ptr("dccv"), + // SignupPhaseStatusCode: to.Ptr[int32](4), + // SignupPhaseStatusText: to.Ptr("q"), + // PeeringDbLastUpdateDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerOrgName: to.Ptr("nshrwjhhggmdaqlpc"), + // CustomerEmail: to.Ptr("zdjgibsidydyzm"), + // CustomerTransitAsn: to.Ptr("habgklnxqzmozqpazoyejwiphezpi"), + // CustomerAsn: to.Ptr("hgrelgnrtdkleisnepfolu"), + // CustomerAsnEstimatedEgressPeekGbps: to.Ptr[float32](10), + // CustomerEntitlementSKUID: to.Ptr("b"), + // CustomerEntitlementSKUGUID: to.Ptr("rvzmdpxyflgqetvpwupnfaxsweiiz"), + // CustomerEntitlementSKUName: to.Ptr("waaqfijr"), + // CustomerEntitlementExpiration: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // OptionalProperty1: to.Ptr("qhmwxza"), + // OptionalProperty2: to.Ptr("l"), + // OptionalProperty3: to.Ptr("mblwwvbie"), + // OptionalProperty4: to.Ptr("vzuek"), + // OptionalProperty5: to.Ptr("fzjodscdfcdr"), + // }, + // StatusCode: to.Ptr("jax"), + // StatusText: to.Ptr("vsqydgruhuwuyipsplylgiqmkcv"), + // StatusDetails: to.Ptr("wmtksbahlbxrzaksogdbozfi"), + // Status: to.Ptr("rhfjbcr"), + // }, + // Tags: map[string]*string{ + // "key3379": to.Ptr("dpyqeaqhcnutzezom"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/fake/cachenodesoperations_server.go b/sdk/resourcemanager/connectedcache/armconnectedcache/fake/cachenodesoperations_server.go new file mode 100644 index 000000000000..d85abb59b355 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/fake/cachenodesoperations_server.go @@ -0,0 +1,348 @@ +// 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) Go Code Generator. DO NOT EDIT. + +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/connectedcache/armconnectedcache" + "net/http" + "net/url" + "regexp" +) + +// CacheNodesOperationsServer is a fake server for instances of the armconnectedcache.CacheNodesOperationsClient type. +type CacheNodesOperationsServer struct { + // BeginCreateorUpdate is the fake for method CacheNodesOperationsClient.BeginCreateorUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateorUpdate func(ctx context.Context, resourceGroupName string, customerResourceName string, resource armconnectedcache.CacheNodePreviewResource, options *armconnectedcache.CacheNodesOperationsClientBeginCreateorUpdateOptions) (resp azfake.PollerResponder[armconnectedcache.CacheNodesOperationsClientCreateorUpdateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method CacheNodesOperationsClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, customerResourceName string, options *armconnectedcache.CacheNodesOperationsClientDeleteOptions) (resp azfake.Responder[armconnectedcache.CacheNodesOperationsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method CacheNodesOperationsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, customerResourceName string, options *armconnectedcache.CacheNodesOperationsClientGetOptions) (resp azfake.Responder[armconnectedcache.CacheNodesOperationsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method CacheNodesOperationsClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armconnectedcache.CacheNodesOperationsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armconnectedcache.CacheNodesOperationsClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method CacheNodesOperationsClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armconnectedcache.CacheNodesOperationsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armconnectedcache.CacheNodesOperationsClientListBySubscriptionResponse]) + + // Update is the fake for method CacheNodesOperationsClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, customerResourceName string, properties armconnectedcache.PatchResource, options *armconnectedcache.CacheNodesOperationsClientUpdateOptions) (resp azfake.Responder[armconnectedcache.CacheNodesOperationsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewCacheNodesOperationsServerTransport creates a new instance of CacheNodesOperationsServerTransport with the provided implementation. +// The returned CacheNodesOperationsServerTransport instance is connected to an instance of armconnectedcache.CacheNodesOperationsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewCacheNodesOperationsServerTransport(srv *CacheNodesOperationsServer) *CacheNodesOperationsServerTransport { + return &CacheNodesOperationsServerTransport{ + srv: srv, + beginCreateorUpdate: newTracker[azfake.PollerResponder[armconnectedcache.CacheNodesOperationsClientCreateorUpdateResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armconnectedcache.CacheNodesOperationsClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armconnectedcache.CacheNodesOperationsClientListBySubscriptionResponse]](), + } +} + +// CacheNodesOperationsServerTransport connects instances of armconnectedcache.CacheNodesOperationsClient to instances of CacheNodesOperationsServer. +// Don't use this type directly, use NewCacheNodesOperationsServerTransport instead. +type CacheNodesOperationsServerTransport struct { + srv *CacheNodesOperationsServer + beginCreateorUpdate *tracker[azfake.PollerResponder[armconnectedcache.CacheNodesOperationsClientCreateorUpdateResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armconnectedcache.CacheNodesOperationsClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armconnectedcache.CacheNodesOperationsClientListBySubscriptionResponse]] +} + +// Do implements the policy.Transporter interface for CacheNodesOperationsServerTransport. +func (c *CacheNodesOperationsServerTransport) 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")} + } + + return c.dispatchToMethodFake(req, method) +} + +func (c *CacheNodesOperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if cacheNodesOperationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = cacheNodesOperationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "CacheNodesOperationsClient.BeginCreateorUpdate": + res.resp, res.err = c.dispatchBeginCreateorUpdate(req) + case "CacheNodesOperationsClient.Delete": + res.resp, res.err = c.dispatchDelete(req) + case "CacheNodesOperationsClient.Get": + res.resp, res.err = c.dispatchGet(req) + case "CacheNodesOperationsClient.NewListByResourceGroupPager": + res.resp, res.err = c.dispatchNewListByResourceGroupPager(req) + case "CacheNodesOperationsClient.NewListBySubscriptionPager": + res.resp, res.err = c.dispatchNewListBySubscriptionPager(req) + case "CacheNodesOperationsClient.Update": + res.resp, res.err = c.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (c *CacheNodesOperationsServerTransport) dispatchBeginCreateorUpdate(req *http.Request) (*http.Response, error) { + if c.srv.BeginCreateorUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateorUpdate not implemented")} + } + beginCreateorUpdate := c.beginCreateorUpdate.get(req) + if beginCreateorUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/cacheNodes/(?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[armconnectedcache.CacheNodePreviewResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginCreateorUpdate(req.Context(), resourceGroupNameParam, customerResourceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateorUpdate = &respr + c.beginCreateorUpdate.add(req, beginCreateorUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateorUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + c.beginCreateorUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateorUpdate) { + c.beginCreateorUpdate.remove(req) + } + + return resp, nil +} + +func (c *CacheNodesOperationsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if c.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\.ConnectedCache/cacheNodes/(?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 + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Delete(req.Context(), resourceGroupNameParam, customerResourceNameParam, 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 (c *CacheNodesOperationsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if c.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\.ConnectedCache/cacheNodes/(?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 + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Get(req.Context(), resourceGroupNameParam, customerResourceNameParam, 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).CacheNodePreviewResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *CacheNodesOperationsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := c.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/cacheNodes` + 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 := c.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + c.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armconnectedcache.CacheNodesOperationsClientListByResourceGroupResponse, 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) { + c.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + c.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (c *CacheNodesOperationsServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := c.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/cacheNodes` + 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 := c.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + c.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armconnectedcache.CacheNodesOperationsClientListBySubscriptionResponse, 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) { + c.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + c.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (c *CacheNodesOperationsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if c.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\.ConnectedCache/cacheNodes/(?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[armconnectedcache.PatchResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Update(req.Context(), resourceGroupNameParam, customerResourceNameParam, 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).CacheNodePreviewResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to CacheNodesOperationsServerTransport +var cacheNodesOperationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/fake/enterprisecustomeroperations_server.go b/sdk/resourcemanager/connectedcache/armconnectedcache/fake/enterprisecustomeroperations_server.go new file mode 100644 index 000000000000..e7955086b130 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/fake/enterprisecustomeroperations_server.go @@ -0,0 +1,348 @@ +// 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) Go Code Generator. DO NOT EDIT. + +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/connectedcache/armconnectedcache" + "net/http" + "net/url" + "regexp" +) + +// EnterpriseCustomerOperationsServer is a fake server for instances of the armconnectedcache.EnterpriseCustomerOperationsClient type. +type EnterpriseCustomerOperationsServer struct { + // BeginCreateOrUpdate is the fake for method EnterpriseCustomerOperationsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, customerResourceName string, resource armconnectedcache.EnterprisePreviewResource, options *armconnectedcache.EnterpriseCustomerOperationsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armconnectedcache.EnterpriseCustomerOperationsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method EnterpriseCustomerOperationsClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, customerResourceName string, options *armconnectedcache.EnterpriseCustomerOperationsClientDeleteOptions) (resp azfake.Responder[armconnectedcache.EnterpriseCustomerOperationsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method EnterpriseCustomerOperationsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, customerResourceName string, options *armconnectedcache.EnterpriseCustomerOperationsClientGetOptions) (resp azfake.Responder[armconnectedcache.EnterpriseCustomerOperationsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method EnterpriseCustomerOperationsClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armconnectedcache.EnterpriseCustomerOperationsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armconnectedcache.EnterpriseCustomerOperationsClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method EnterpriseCustomerOperationsClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armconnectedcache.EnterpriseCustomerOperationsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armconnectedcache.EnterpriseCustomerOperationsClientListBySubscriptionResponse]) + + // Update is the fake for method EnterpriseCustomerOperationsClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, customerResourceName string, properties armconnectedcache.PatchResource, options *armconnectedcache.EnterpriseCustomerOperationsClientUpdateOptions) (resp azfake.Responder[armconnectedcache.EnterpriseCustomerOperationsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewEnterpriseCustomerOperationsServerTransport creates a new instance of EnterpriseCustomerOperationsServerTransport with the provided implementation. +// The returned EnterpriseCustomerOperationsServerTransport instance is connected to an instance of armconnectedcache.EnterpriseCustomerOperationsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewEnterpriseCustomerOperationsServerTransport(srv *EnterpriseCustomerOperationsServer) *EnterpriseCustomerOperationsServerTransport { + return &EnterpriseCustomerOperationsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armconnectedcache.EnterpriseCustomerOperationsClientCreateOrUpdateResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armconnectedcache.EnterpriseCustomerOperationsClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armconnectedcache.EnterpriseCustomerOperationsClientListBySubscriptionResponse]](), + } +} + +// EnterpriseCustomerOperationsServerTransport connects instances of armconnectedcache.EnterpriseCustomerOperationsClient to instances of EnterpriseCustomerOperationsServer. +// Don't use this type directly, use NewEnterpriseCustomerOperationsServerTransport instead. +type EnterpriseCustomerOperationsServerTransport struct { + srv *EnterpriseCustomerOperationsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armconnectedcache.EnterpriseCustomerOperationsClientCreateOrUpdateResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armconnectedcache.EnterpriseCustomerOperationsClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armconnectedcache.EnterpriseCustomerOperationsClientListBySubscriptionResponse]] +} + +// Do implements the policy.Transporter interface for EnterpriseCustomerOperationsServerTransport. +func (e *EnterpriseCustomerOperationsServerTransport) 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")} + } + + return e.dispatchToMethodFake(req, method) +} + +func (e *EnterpriseCustomerOperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if enterpriseCustomerOperationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = enterpriseCustomerOperationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "EnterpriseCustomerOperationsClient.BeginCreateOrUpdate": + res.resp, res.err = e.dispatchBeginCreateOrUpdate(req) + case "EnterpriseCustomerOperationsClient.Delete": + res.resp, res.err = e.dispatchDelete(req) + case "EnterpriseCustomerOperationsClient.Get": + res.resp, res.err = e.dispatchGet(req) + case "EnterpriseCustomerOperationsClient.NewListByResourceGroupPager": + res.resp, res.err = e.dispatchNewListByResourceGroupPager(req) + case "EnterpriseCustomerOperationsClient.NewListBySubscriptionPager": + res.resp, res.err = e.dispatchNewListBySubscriptionPager(req) + case "EnterpriseCustomerOperationsClient.Update": + res.resp, res.err = e.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (e *EnterpriseCustomerOperationsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if e.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := e.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/enterpriseCustomers/(?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[armconnectedcache.EnterprisePreviewResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, customerResourceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + e.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + e.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + e.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (e *EnterpriseCustomerOperationsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if e.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\.ConnectedCache/enterpriseCustomers/(?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 + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.Delete(req.Context(), resourceGroupNameParam, customerResourceNameParam, 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 (e *EnterpriseCustomerOperationsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if e.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\.ConnectedCache/enterpriseCustomers/(?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 + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.Get(req.Context(), resourceGroupNameParam, customerResourceNameParam, 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).EnterprisePreviewResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (e *EnterpriseCustomerOperationsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if e.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := e.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/enterpriseCustomers` + 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 := e.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + e.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armconnectedcache.EnterpriseCustomerOperationsClientListByResourceGroupResponse, 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) { + e.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + e.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (e *EnterpriseCustomerOperationsServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if e.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := e.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/enterpriseCustomers` + 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 := e.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + e.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armconnectedcache.EnterpriseCustomerOperationsClientListBySubscriptionResponse, 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) { + e.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + e.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (e *EnterpriseCustomerOperationsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if e.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\.ConnectedCache/enterpriseCustomers/(?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[armconnectedcache.PatchResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.Update(req.Context(), resourceGroupNameParam, customerResourceNameParam, 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).EnterprisePreviewResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to EnterpriseCustomerOperationsServerTransport +var enterpriseCustomerOperationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/fake/enterprisemcccachenodesoperations_server.go b/sdk/resourcemanager/connectedcache/armconnectedcache/fake/enterprisemcccachenodesoperations_server.go new file mode 100644 index 000000000000..d4e726786935 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/fake/enterprisemcccachenodesoperations_server.go @@ -0,0 +1,383 @@ +// 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) Go Code Generator. DO NOT EDIT. + +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/connectedcache/armconnectedcache" + "net/http" + "net/url" + "regexp" +) + +// EnterpriseMccCacheNodesOperationsServer is a fake server for instances of the armconnectedcache.EnterpriseMccCacheNodesOperationsClient type. +type EnterpriseMccCacheNodesOperationsServer struct { + // BeginCreateOrUpdate is the fake for method EnterpriseMccCacheNodesOperationsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, resource armconnectedcache.EnterpriseMccCacheNodeResource, options *armconnectedcache.EnterpriseMccCacheNodesOperationsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armconnectedcache.EnterpriseMccCacheNodesOperationsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method EnterpriseMccCacheNodesOperationsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, options *armconnectedcache.EnterpriseMccCacheNodesOperationsClientBeginDeleteOptions) (resp azfake.PollerResponder[armconnectedcache.EnterpriseMccCacheNodesOperationsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method EnterpriseMccCacheNodesOperationsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, options *armconnectedcache.EnterpriseMccCacheNodesOperationsClientGetOptions) (resp azfake.Responder[armconnectedcache.EnterpriseMccCacheNodesOperationsClientGetResponse], errResp azfake.ErrorResponder) + + // GetCacheNodeInstallDetails is the fake for method EnterpriseMccCacheNodesOperationsClient.GetCacheNodeInstallDetails + // HTTP status codes to indicate success: http.StatusOK + GetCacheNodeInstallDetails func(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, options *armconnectedcache.EnterpriseMccCacheNodesOperationsClientGetCacheNodeInstallDetailsOptions) (resp azfake.Responder[armconnectedcache.EnterpriseMccCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse], errResp azfake.ErrorResponder) + + // NewListByEnterpriseMccCustomerResourcePager is the fake for method EnterpriseMccCacheNodesOperationsClient.NewListByEnterpriseMccCustomerResourcePager + // HTTP status codes to indicate success: http.StatusOK + NewListByEnterpriseMccCustomerResourcePager func(resourceGroupName string, customerResourceName string, options *armconnectedcache.EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceOptions) (resp azfake.PagerResponder[armconnectedcache.EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceResponse]) + + // Update is the fake for method EnterpriseMccCacheNodesOperationsClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, properties armconnectedcache.PatchResource, options *armconnectedcache.EnterpriseMccCacheNodesOperationsClientUpdateOptions) (resp azfake.Responder[armconnectedcache.EnterpriseMccCacheNodesOperationsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewEnterpriseMccCacheNodesOperationsServerTransport creates a new instance of EnterpriseMccCacheNodesOperationsServerTransport with the provided implementation. +// The returned EnterpriseMccCacheNodesOperationsServerTransport instance is connected to an instance of armconnectedcache.EnterpriseMccCacheNodesOperationsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewEnterpriseMccCacheNodesOperationsServerTransport(srv *EnterpriseMccCacheNodesOperationsServer) *EnterpriseMccCacheNodesOperationsServerTransport { + return &EnterpriseMccCacheNodesOperationsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armconnectedcache.EnterpriseMccCacheNodesOperationsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armconnectedcache.EnterpriseMccCacheNodesOperationsClientDeleteResponse]](), + newListByEnterpriseMccCustomerResourcePager: newTracker[azfake.PagerResponder[armconnectedcache.EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceResponse]](), + } +} + +// EnterpriseMccCacheNodesOperationsServerTransport connects instances of armconnectedcache.EnterpriseMccCacheNodesOperationsClient to instances of EnterpriseMccCacheNodesOperationsServer. +// Don't use this type directly, use NewEnterpriseMccCacheNodesOperationsServerTransport instead. +type EnterpriseMccCacheNodesOperationsServerTransport struct { + srv *EnterpriseMccCacheNodesOperationsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armconnectedcache.EnterpriseMccCacheNodesOperationsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armconnectedcache.EnterpriseMccCacheNodesOperationsClientDeleteResponse]] + newListByEnterpriseMccCustomerResourcePager *tracker[azfake.PagerResponder[armconnectedcache.EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceResponse]] +} + +// Do implements the policy.Transporter interface for EnterpriseMccCacheNodesOperationsServerTransport. +func (e *EnterpriseMccCacheNodesOperationsServerTransport) 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")} + } + + return e.dispatchToMethodFake(req, method) +} + +func (e *EnterpriseMccCacheNodesOperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if enterpriseMccCacheNodesOperationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = enterpriseMccCacheNodesOperationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "EnterpriseMccCacheNodesOperationsClient.BeginCreateOrUpdate": + res.resp, res.err = e.dispatchBeginCreateOrUpdate(req) + case "EnterpriseMccCacheNodesOperationsClient.BeginDelete": + res.resp, res.err = e.dispatchBeginDelete(req) + case "EnterpriseMccCacheNodesOperationsClient.Get": + res.resp, res.err = e.dispatchGet(req) + case "EnterpriseMccCacheNodesOperationsClient.GetCacheNodeInstallDetails": + res.resp, res.err = e.dispatchGetCacheNodeInstallDetails(req) + case "EnterpriseMccCacheNodesOperationsClient.NewListByEnterpriseMccCustomerResourcePager": + res.resp, res.err = e.dispatchNewListByEnterpriseMccCustomerResourcePager(req) + case "EnterpriseMccCacheNodesOperationsClient.Update": + res.resp, res.err = e.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (e *EnterpriseMccCacheNodesOperationsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if e.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := e.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/enterpriseMccCustomers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/enterpriseMccCacheNodes/(?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[armconnectedcache.EnterpriseMccCacheNodeResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + cacheNodeResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cacheNodeResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, customerResourceNameParam, cacheNodeResourceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + e.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + e.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + e.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (e *EnterpriseMccCacheNodesOperationsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if e.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := e.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/enterpriseMccCustomers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/enterpriseMccCacheNodes/(?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 + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + cacheNodeResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cacheNodeResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginDelete(req.Context(), resourceGroupNameParam, customerResourceNameParam, cacheNodeResourceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + e.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) { + e.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) { + e.beginDelete.remove(req) + } + + return resp, nil +} + +func (e *EnterpriseMccCacheNodesOperationsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if e.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\.ConnectedCache/enterpriseMccCustomers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/enterpriseMccCacheNodes/(?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 + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + cacheNodeResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cacheNodeResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.Get(req.Context(), resourceGroupNameParam, customerResourceNameParam, cacheNodeResourceNameParam, 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).EnterpriseMccCacheNodeResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (e *EnterpriseMccCacheNodesOperationsServerTransport) dispatchGetCacheNodeInstallDetails(req *http.Request) (*http.Response, error) { + if e.srv.GetCacheNodeInstallDetails == nil { + return nil, &nonRetriableError{errors.New("fake for method GetCacheNodeInstallDetails not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/enterpriseMccCustomers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/enterpriseMccCacheNodes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/getCacheNodeInstallDetails` + 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 + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + cacheNodeResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cacheNodeResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.GetCacheNodeInstallDetails(req.Context(), resourceGroupNameParam, customerResourceNameParam, cacheNodeResourceNameParam, 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).MccCacheNodeInstallDetails, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (e *EnterpriseMccCacheNodesOperationsServerTransport) dispatchNewListByEnterpriseMccCustomerResourcePager(req *http.Request) (*http.Response, error) { + if e.srv.NewListByEnterpriseMccCustomerResourcePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByEnterpriseMccCustomerResourcePager not implemented")} + } + newListByEnterpriseMccCustomerResourcePager := e.newListByEnterpriseMccCustomerResourcePager.get(req) + if newListByEnterpriseMccCustomerResourcePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/enterpriseMccCustomers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/enterpriseMccCacheNodes` + 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 + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + resp := e.srv.NewListByEnterpriseMccCustomerResourcePager(resourceGroupNameParam, customerResourceNameParam, nil) + newListByEnterpriseMccCustomerResourcePager = &resp + e.newListByEnterpriseMccCustomerResourcePager.add(req, newListByEnterpriseMccCustomerResourcePager) + server.PagerResponderInjectNextLinks(newListByEnterpriseMccCustomerResourcePager, req, func(page *armconnectedcache.EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByEnterpriseMccCustomerResourcePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + e.newListByEnterpriseMccCustomerResourcePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByEnterpriseMccCustomerResourcePager) { + e.newListByEnterpriseMccCustomerResourcePager.remove(req) + } + return resp, nil +} + +func (e *EnterpriseMccCacheNodesOperationsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if e.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\.ConnectedCache/enterpriseMccCustomers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/enterpriseMccCacheNodes/(?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[armconnectedcache.PatchResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + cacheNodeResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cacheNodeResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.Update(req.Context(), resourceGroupNameParam, customerResourceNameParam, cacheNodeResourceNameParam, 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).EnterpriseMccCacheNodeResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to EnterpriseMccCacheNodesOperationsServerTransport +var enterpriseMccCacheNodesOperationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/fake/enterprisemcccustomers_server.go b/sdk/resourcemanager/connectedcache/armconnectedcache/fake/enterprisemcccustomers_server.go new file mode 100644 index 000000000000..ca8d452a5a75 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/fake/enterprisemcccustomers_server.go @@ -0,0 +1,361 @@ +// 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) Go Code Generator. DO NOT EDIT. + +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/connectedcache/armconnectedcache" + "net/http" + "net/url" + "regexp" +) + +// EnterpriseMccCustomersServer is a fake server for instances of the armconnectedcache.EnterpriseMccCustomersClient type. +type EnterpriseMccCustomersServer struct { + // BeginCreateOrUpdate is the fake for method EnterpriseMccCustomersClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, customerResourceName string, resource armconnectedcache.EnterpriseMccCustomerResource, options *armconnectedcache.EnterpriseMccCustomersClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armconnectedcache.EnterpriseMccCustomersClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method EnterpriseMccCustomersClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, customerResourceName string, options *armconnectedcache.EnterpriseMccCustomersClientBeginDeleteOptions) (resp azfake.PollerResponder[armconnectedcache.EnterpriseMccCustomersClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method EnterpriseMccCustomersClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, customerResourceName string, options *armconnectedcache.EnterpriseMccCustomersClientGetOptions) (resp azfake.Responder[armconnectedcache.EnterpriseMccCustomersClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method EnterpriseMccCustomersClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armconnectedcache.EnterpriseMccCustomersClientListByResourceGroupOptions) (resp azfake.PagerResponder[armconnectedcache.EnterpriseMccCustomersClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method EnterpriseMccCustomersClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armconnectedcache.EnterpriseMccCustomersClientListBySubscriptionOptions) (resp azfake.PagerResponder[armconnectedcache.EnterpriseMccCustomersClientListBySubscriptionResponse]) + + // Update is the fake for method EnterpriseMccCustomersClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, customerResourceName string, properties armconnectedcache.PatchResource, options *armconnectedcache.EnterpriseMccCustomersClientUpdateOptions) (resp azfake.Responder[armconnectedcache.EnterpriseMccCustomersClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewEnterpriseMccCustomersServerTransport creates a new instance of EnterpriseMccCustomersServerTransport with the provided implementation. +// The returned EnterpriseMccCustomersServerTransport instance is connected to an instance of armconnectedcache.EnterpriseMccCustomersClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewEnterpriseMccCustomersServerTransport(srv *EnterpriseMccCustomersServer) *EnterpriseMccCustomersServerTransport { + return &EnterpriseMccCustomersServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armconnectedcache.EnterpriseMccCustomersClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armconnectedcache.EnterpriseMccCustomersClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armconnectedcache.EnterpriseMccCustomersClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armconnectedcache.EnterpriseMccCustomersClientListBySubscriptionResponse]](), + } +} + +// EnterpriseMccCustomersServerTransport connects instances of armconnectedcache.EnterpriseMccCustomersClient to instances of EnterpriseMccCustomersServer. +// Don't use this type directly, use NewEnterpriseMccCustomersServerTransport instead. +type EnterpriseMccCustomersServerTransport struct { + srv *EnterpriseMccCustomersServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armconnectedcache.EnterpriseMccCustomersClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armconnectedcache.EnterpriseMccCustomersClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armconnectedcache.EnterpriseMccCustomersClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armconnectedcache.EnterpriseMccCustomersClientListBySubscriptionResponse]] +} + +// Do implements the policy.Transporter interface for EnterpriseMccCustomersServerTransport. +func (e *EnterpriseMccCustomersServerTransport) 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")} + } + + return e.dispatchToMethodFake(req, method) +} + +func (e *EnterpriseMccCustomersServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if enterpriseMccCustomersServerTransportInterceptor != nil { + res.resp, res.err, intercepted = enterpriseMccCustomersServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "EnterpriseMccCustomersClient.BeginCreateOrUpdate": + res.resp, res.err = e.dispatchBeginCreateOrUpdate(req) + case "EnterpriseMccCustomersClient.BeginDelete": + res.resp, res.err = e.dispatchBeginDelete(req) + case "EnterpriseMccCustomersClient.Get": + res.resp, res.err = e.dispatchGet(req) + case "EnterpriseMccCustomersClient.NewListByResourceGroupPager": + res.resp, res.err = e.dispatchNewListByResourceGroupPager(req) + case "EnterpriseMccCustomersClient.NewListBySubscriptionPager": + res.resp, res.err = e.dispatchNewListBySubscriptionPager(req) + case "EnterpriseMccCustomersClient.Update": + res.resp, res.err = e.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (e *EnterpriseMccCustomersServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if e.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := e.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/enterpriseMccCustomers/(?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[armconnectedcache.EnterpriseMccCustomerResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, customerResourceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + e.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + e.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + e.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (e *EnterpriseMccCustomersServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if e.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := e.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/enterpriseMccCustomers/(?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 + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginDelete(req.Context(), resourceGroupNameParam, customerResourceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + e.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) { + e.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) { + e.beginDelete.remove(req) + } + + return resp, nil +} + +func (e *EnterpriseMccCustomersServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if e.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\.ConnectedCache/enterpriseMccCustomers/(?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 + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.Get(req.Context(), resourceGroupNameParam, customerResourceNameParam, 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).EnterpriseMccCustomerResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (e *EnterpriseMccCustomersServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if e.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := e.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/enterpriseMccCustomers` + 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 := e.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + e.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armconnectedcache.EnterpriseMccCustomersClientListByResourceGroupResponse, 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) { + e.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + e.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (e *EnterpriseMccCustomersServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if e.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := e.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/enterpriseMccCustomers` + 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 := e.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + e.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armconnectedcache.EnterpriseMccCustomersClientListBySubscriptionResponse, 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) { + e.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + e.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (e *EnterpriseMccCustomersServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if e.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\.ConnectedCache/enterpriseMccCustomers/(?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[armconnectedcache.PatchResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.Update(req.Context(), resourceGroupNameParam, customerResourceNameParam, 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).EnterpriseMccCustomerResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to EnterpriseMccCustomersServerTransport +var enterpriseMccCustomersServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/fake/internal.go b/sdk/resourcemanager/connectedcache/armconnectedcache/fake/internal.go new file mode 100644 index 000000000000..7425b6a669e2 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/fake/internal.go @@ -0,0 +1,65 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "net/http" + "sync" +) + +type result struct { + resp *http.Response + err error +} + +type nonRetriableError struct { + error +} + +func (nonRetriableError) NonRetriable() { + // marker method +} + +func contains[T comparable](s []T, v T) bool { + for _, vv := range s { + if vv == v { + return true + } + } + return false +} + +func newTracker[T any]() *tracker[T] { + return &tracker[T]{ + items: map[string]*T{}, + } +} + +type tracker[T any] struct { + items map[string]*T + mu sync.Mutex +} + +func (p *tracker[T]) get(req *http.Request) *T { + p.mu.Lock() + defer p.mu.Unlock() + if item, ok := p.items[server.SanitizePagerPollerPath(req.URL.Path)]; ok { + return item + } + return nil +} + +func (p *tracker[T]) add(req *http.Request, item *T) { + p.mu.Lock() + defer p.mu.Unlock() + p.items[server.SanitizePagerPollerPath(req.URL.Path)] = item +} + +func (p *tracker[T]) remove(req *http.Request) { + p.mu.Lock() + defer p.mu.Unlock() + delete(p.items, server.SanitizePagerPollerPath(req.URL.Path)) +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/fake/ispcachenodesoperations_server.go b/sdk/resourcemanager/connectedcache/armconnectedcache/fake/ispcachenodesoperations_server.go new file mode 100644 index 000000000000..61d62032ad5d --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/fake/ispcachenodesoperations_server.go @@ -0,0 +1,426 @@ +// 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) Go Code Generator. DO NOT EDIT. + +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/connectedcache/armconnectedcache" + "net/http" + "net/url" + "regexp" +) + +// IspCacheNodesOperationsServer is a fake server for instances of the armconnectedcache.IspCacheNodesOperationsClient type. +type IspCacheNodesOperationsServer struct { + // BeginCreateOrUpdate is the fake for method IspCacheNodesOperationsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, resource armconnectedcache.IspCacheNodeResource, options *armconnectedcache.IspCacheNodesOperationsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armconnectedcache.IspCacheNodesOperationsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method IspCacheNodesOperationsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, options *armconnectedcache.IspCacheNodesOperationsClientBeginDeleteOptions) (resp azfake.PollerResponder[armconnectedcache.IspCacheNodesOperationsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method IspCacheNodesOperationsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, options *armconnectedcache.IspCacheNodesOperationsClientGetOptions) (resp azfake.Responder[armconnectedcache.IspCacheNodesOperationsClientGetResponse], errResp azfake.ErrorResponder) + + // GetBgpCidrs is the fake for method IspCacheNodesOperationsClient.GetBgpCidrs + // HTTP status codes to indicate success: http.StatusOK + GetBgpCidrs func(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, options *armconnectedcache.IspCacheNodesOperationsClientGetBgpCidrsOptions) (resp azfake.Responder[armconnectedcache.IspCacheNodesOperationsClientGetBgpCidrsResponse], errResp azfake.ErrorResponder) + + // GetCacheNodeInstallDetails is the fake for method IspCacheNodesOperationsClient.GetCacheNodeInstallDetails + // HTTP status codes to indicate success: http.StatusOK + GetCacheNodeInstallDetails func(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, options *armconnectedcache.IspCacheNodesOperationsClientGetCacheNodeInstallDetailsOptions) (resp azfake.Responder[armconnectedcache.IspCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse], errResp azfake.ErrorResponder) + + // NewListByIspCustomerResourcePager is the fake for method IspCacheNodesOperationsClient.NewListByIspCustomerResourcePager + // HTTP status codes to indicate success: http.StatusOK + NewListByIspCustomerResourcePager func(resourceGroupName string, customerResourceName string, options *armconnectedcache.IspCacheNodesOperationsClientListByIspCustomerResourceOptions) (resp azfake.PagerResponder[armconnectedcache.IspCacheNodesOperationsClientListByIspCustomerResourceResponse]) + + // Update is the fake for method IspCacheNodesOperationsClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, properties armconnectedcache.PatchResource, options *armconnectedcache.IspCacheNodesOperationsClientUpdateOptions) (resp azfake.Responder[armconnectedcache.IspCacheNodesOperationsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewIspCacheNodesOperationsServerTransport creates a new instance of IspCacheNodesOperationsServerTransport with the provided implementation. +// The returned IspCacheNodesOperationsServerTransport instance is connected to an instance of armconnectedcache.IspCacheNodesOperationsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewIspCacheNodesOperationsServerTransport(srv *IspCacheNodesOperationsServer) *IspCacheNodesOperationsServerTransport { + return &IspCacheNodesOperationsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armconnectedcache.IspCacheNodesOperationsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armconnectedcache.IspCacheNodesOperationsClientDeleteResponse]](), + newListByIspCustomerResourcePager: newTracker[azfake.PagerResponder[armconnectedcache.IspCacheNodesOperationsClientListByIspCustomerResourceResponse]](), + } +} + +// IspCacheNodesOperationsServerTransport connects instances of armconnectedcache.IspCacheNodesOperationsClient to instances of IspCacheNodesOperationsServer. +// Don't use this type directly, use NewIspCacheNodesOperationsServerTransport instead. +type IspCacheNodesOperationsServerTransport struct { + srv *IspCacheNodesOperationsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armconnectedcache.IspCacheNodesOperationsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armconnectedcache.IspCacheNodesOperationsClientDeleteResponse]] + newListByIspCustomerResourcePager *tracker[azfake.PagerResponder[armconnectedcache.IspCacheNodesOperationsClientListByIspCustomerResourceResponse]] +} + +// Do implements the policy.Transporter interface for IspCacheNodesOperationsServerTransport. +func (i *IspCacheNodesOperationsServerTransport) 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")} + } + + return i.dispatchToMethodFake(req, method) +} + +func (i *IspCacheNodesOperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if ispCacheNodesOperationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = ispCacheNodesOperationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "IspCacheNodesOperationsClient.BeginCreateOrUpdate": + res.resp, res.err = i.dispatchBeginCreateOrUpdate(req) + case "IspCacheNodesOperationsClient.BeginDelete": + res.resp, res.err = i.dispatchBeginDelete(req) + case "IspCacheNodesOperationsClient.Get": + res.resp, res.err = i.dispatchGet(req) + case "IspCacheNodesOperationsClient.GetBgpCidrs": + res.resp, res.err = i.dispatchGetBgpCidrs(req) + case "IspCacheNodesOperationsClient.GetCacheNodeInstallDetails": + res.resp, res.err = i.dispatchGetCacheNodeInstallDetails(req) + case "IspCacheNodesOperationsClient.NewListByIspCustomerResourcePager": + res.resp, res.err = i.dispatchNewListByIspCustomerResourcePager(req) + case "IspCacheNodesOperationsClient.Update": + res.resp, res.err = i.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (i *IspCacheNodesOperationsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if i.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := i.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/ispCustomers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/ispCacheNodes/(?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[armconnectedcache.IspCacheNodeResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + cacheNodeResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cacheNodeResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, customerResourceNameParam, cacheNodeResourceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + i.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + i.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + i.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (i *IspCacheNodesOperationsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if i.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := i.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/ispCustomers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/ispCacheNodes/(?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 + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + cacheNodeResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cacheNodeResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.BeginDelete(req.Context(), resourceGroupNameParam, customerResourceNameParam, cacheNodeResourceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + i.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) { + i.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) { + i.beginDelete.remove(req) + } + + return resp, nil +} + +func (i *IspCacheNodesOperationsServerTransport) 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\.ConnectedCache/ispCustomers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/ispCacheNodes/(?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 + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + cacheNodeResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cacheNodeResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.Get(req.Context(), resourceGroupNameParam, customerResourceNameParam, cacheNodeResourceNameParam, 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).IspCacheNodeResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (i *IspCacheNodesOperationsServerTransport) dispatchGetBgpCidrs(req *http.Request) (*http.Response, error) { + if i.srv.GetBgpCidrs == nil { + return nil, &nonRetriableError{errors.New("fake for method GetBgpCidrs not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/ispCustomers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/ispCacheNodes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/getBgpCidrs` + 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 + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + cacheNodeResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cacheNodeResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.GetBgpCidrs(req.Context(), resourceGroupNameParam, customerResourceNameParam, cacheNodeResourceNameParam, 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).MccCacheNodeBgpCidrDetails, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (i *IspCacheNodesOperationsServerTransport) dispatchGetCacheNodeInstallDetails(req *http.Request) (*http.Response, error) { + if i.srv.GetCacheNodeInstallDetails == nil { + return nil, &nonRetriableError{errors.New("fake for method GetCacheNodeInstallDetails not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/ispCustomers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/ispCacheNodes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/getCacheNodeInstallDetails` + 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 + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + cacheNodeResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cacheNodeResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.GetCacheNodeInstallDetails(req.Context(), resourceGroupNameParam, customerResourceNameParam, cacheNodeResourceNameParam, 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).MccCacheNodeInstallDetails, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (i *IspCacheNodesOperationsServerTransport) dispatchNewListByIspCustomerResourcePager(req *http.Request) (*http.Response, error) { + if i.srv.NewListByIspCustomerResourcePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByIspCustomerResourcePager not implemented")} + } + newListByIspCustomerResourcePager := i.newListByIspCustomerResourcePager.get(req) + if newListByIspCustomerResourcePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/ispCustomers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/ispCacheNodes` + 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 + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + resp := i.srv.NewListByIspCustomerResourcePager(resourceGroupNameParam, customerResourceNameParam, nil) + newListByIspCustomerResourcePager = &resp + i.newListByIspCustomerResourcePager.add(req, newListByIspCustomerResourcePager) + server.PagerResponderInjectNextLinks(newListByIspCustomerResourcePager, req, func(page *armconnectedcache.IspCacheNodesOperationsClientListByIspCustomerResourceResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByIspCustomerResourcePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + i.newListByIspCustomerResourcePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByIspCustomerResourcePager) { + i.newListByIspCustomerResourcePager.remove(req) + } + return resp, nil +} + +func (i *IspCacheNodesOperationsServerTransport) 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\.ConnectedCache/ispCustomers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/ispCacheNodes/(?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[armconnectedcache.PatchResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + cacheNodeResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("cacheNodeResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.Update(req.Context(), resourceGroupNameParam, customerResourceNameParam, cacheNodeResourceNameParam, 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).IspCacheNodeResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to IspCacheNodesOperationsServerTransport +var ispCacheNodesOperationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/fake/ispcustomers_server.go b/sdk/resourcemanager/connectedcache/armconnectedcache/fake/ispcustomers_server.go new file mode 100644 index 000000000000..1fb980a4bd60 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/fake/ispcustomers_server.go @@ -0,0 +1,361 @@ +// 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) Go Code Generator. DO NOT EDIT. + +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/connectedcache/armconnectedcache" + "net/http" + "net/url" + "regexp" +) + +// IspCustomersServer is a fake server for instances of the armconnectedcache.IspCustomersClient type. +type IspCustomersServer struct { + // BeginCreateOrUpdate is the fake for method IspCustomersClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, customerResourceName string, resource armconnectedcache.IspCustomerResource, options *armconnectedcache.IspCustomersClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armconnectedcache.IspCustomersClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method IspCustomersClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, customerResourceName string, options *armconnectedcache.IspCustomersClientBeginDeleteOptions) (resp azfake.PollerResponder[armconnectedcache.IspCustomersClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method IspCustomersClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, customerResourceName string, options *armconnectedcache.IspCustomersClientGetOptions) (resp azfake.Responder[armconnectedcache.IspCustomersClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method IspCustomersClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armconnectedcache.IspCustomersClientListByResourceGroupOptions) (resp azfake.PagerResponder[armconnectedcache.IspCustomersClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method IspCustomersClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armconnectedcache.IspCustomersClientListBySubscriptionOptions) (resp azfake.PagerResponder[armconnectedcache.IspCustomersClientListBySubscriptionResponse]) + + // Update is the fake for method IspCustomersClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, customerResourceName string, properties armconnectedcache.PatchResource, options *armconnectedcache.IspCustomersClientUpdateOptions) (resp azfake.Responder[armconnectedcache.IspCustomersClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewIspCustomersServerTransport creates a new instance of IspCustomersServerTransport with the provided implementation. +// The returned IspCustomersServerTransport instance is connected to an instance of armconnectedcache.IspCustomersClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewIspCustomersServerTransport(srv *IspCustomersServer) *IspCustomersServerTransport { + return &IspCustomersServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armconnectedcache.IspCustomersClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armconnectedcache.IspCustomersClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armconnectedcache.IspCustomersClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armconnectedcache.IspCustomersClientListBySubscriptionResponse]](), + } +} + +// IspCustomersServerTransport connects instances of armconnectedcache.IspCustomersClient to instances of IspCustomersServer. +// Don't use this type directly, use NewIspCustomersServerTransport instead. +type IspCustomersServerTransport struct { + srv *IspCustomersServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armconnectedcache.IspCustomersClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armconnectedcache.IspCustomersClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armconnectedcache.IspCustomersClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armconnectedcache.IspCustomersClientListBySubscriptionResponse]] +} + +// Do implements the policy.Transporter interface for IspCustomersServerTransport. +func (i *IspCustomersServerTransport) 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")} + } + + return i.dispatchToMethodFake(req, method) +} + +func (i *IspCustomersServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if ispCustomersServerTransportInterceptor != nil { + res.resp, res.err, intercepted = ispCustomersServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "IspCustomersClient.BeginCreateOrUpdate": + res.resp, res.err = i.dispatchBeginCreateOrUpdate(req) + case "IspCustomersClient.BeginDelete": + res.resp, res.err = i.dispatchBeginDelete(req) + case "IspCustomersClient.Get": + res.resp, res.err = i.dispatchGet(req) + case "IspCustomersClient.NewListByResourceGroupPager": + res.resp, res.err = i.dispatchNewListByResourceGroupPager(req) + case "IspCustomersClient.NewListBySubscriptionPager": + res.resp, res.err = i.dispatchNewListBySubscriptionPager(req) + case "IspCustomersClient.Update": + res.resp, res.err = i.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (i *IspCustomersServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if i.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := i.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/ispCustomers/(?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[armconnectedcache.IspCustomerResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, customerResourceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + i.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + i.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + i.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (i *IspCustomersServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if i.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := i.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ConnectedCache/ispCustomers/(?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 + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.BeginDelete(req.Context(), resourceGroupNameParam, customerResourceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + i.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) { + i.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) { + i.beginDelete.remove(req) + } + + return resp, nil +} + +func (i *IspCustomersServerTransport) 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\.ConnectedCache/ispCustomers/(?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 + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.Get(req.Context(), resourceGroupNameParam, customerResourceNameParam, 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).IspCustomerResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (i *IspCustomersServerTransport) 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\.ConnectedCache/ispCustomers` + 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 *armconnectedcache.IspCustomersClientListByResourceGroupResponse, 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 *IspCustomersServerTransport) 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\.ConnectedCache/ispCustomers` + 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 *armconnectedcache.IspCustomersClientListBySubscriptionResponse, 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 *IspCustomersServerTransport) 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\.ConnectedCache/ispCustomers/(?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[armconnectedcache.PatchResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + customerResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customerResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.Update(req.Context(), resourceGroupNameParam, customerResourceNameParam, 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).IspCustomerResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to IspCustomersServerTransport +var ispCustomersServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/fake/operations_server.go b/sdk/resourcemanager/connectedcache/armconnectedcache/fake/operations_server.go new file mode 100644 index 000000000000..10197cea6d92 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/fake/operations_server.go @@ -0,0 +1,117 @@ +// 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) Go Code Generator. DO NOT EDIT. + +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/connectedcache/armconnectedcache" + "net/http" +) + +// OperationsServer is a fake server for instances of the armconnectedcache.OperationsClient type. +type OperationsServer struct { + // NewListPager is the fake for method OperationsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *armconnectedcache.OperationsClientListOptions) (resp azfake.PagerResponder[armconnectedcache.OperationsClientListResponse]) +} + +// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. +// The returned OperationsServerTransport instance is connected to an instance of armconnectedcache.OperationsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewOperationsServerTransport(srv *OperationsServer) *OperationsServerTransport { + return &OperationsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armconnectedcache.OperationsClientListResponse]](), + } +} + +// OperationsServerTransport connects instances of armconnectedcache.OperationsClient to instances of OperationsServer. +// Don't use this type directly, use NewOperationsServerTransport instead. +type OperationsServerTransport struct { + srv *OperationsServer + newListPager *tracker[azfake.PagerResponder[armconnectedcache.OperationsClientListResponse]] +} + +// Do implements the policy.Transporter interface for OperationsServerTransport. +func (o *OperationsServerTransport) 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")} + } + + return o.dispatchToMethodFake(req, method) +} + +func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if o.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := o.newListPager.get(req) + if newListPager == nil { + resp := o.srv.NewListPager(nil) + newListPager = &resp + o.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armconnectedcache.OperationsClientListResponse, 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) { + o.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + o.newListPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/fake/server_factory.go b/sdk/resourcemanager/connectedcache/armconnectedcache/fake/server_factory.go new file mode 100644 index 000000000000..5e9b7929d6fe --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/fake/server_factory.go @@ -0,0 +1,124 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" + "sync" +) + +// ServerFactory is a fake server for instances of the armconnectedcache.ClientFactory type. +type ServerFactory struct { + // CacheNodesOperationsServer contains the fakes for client CacheNodesOperationsClient + CacheNodesOperationsServer CacheNodesOperationsServer + + // EnterpriseCustomerOperationsServer contains the fakes for client EnterpriseCustomerOperationsClient + EnterpriseCustomerOperationsServer EnterpriseCustomerOperationsServer + + // EnterpriseMccCacheNodesOperationsServer contains the fakes for client EnterpriseMccCacheNodesOperationsClient + EnterpriseMccCacheNodesOperationsServer EnterpriseMccCacheNodesOperationsServer + + // EnterpriseMccCustomersServer contains the fakes for client EnterpriseMccCustomersClient + EnterpriseMccCustomersServer EnterpriseMccCustomersServer + + // IspCacheNodesOperationsServer contains the fakes for client IspCacheNodesOperationsClient + IspCacheNodesOperationsServer IspCacheNodesOperationsServer + + // IspCustomersServer contains the fakes for client IspCustomersClient + IspCustomersServer IspCustomersServer + + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer +} + +// NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. +// The returned ServerFactoryTransport instance is connected to an instance of armconnectedcache.ClientFactory via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { + return &ServerFactoryTransport{ + srv: srv, + } +} + +// ServerFactoryTransport connects instances of armconnectedcache.ClientFactory to instances of ServerFactory. +// Don't use this type directly, use NewServerFactoryTransport instead. +type ServerFactoryTransport struct { + srv *ServerFactory + trMu sync.Mutex + trCacheNodesOperationsServer *CacheNodesOperationsServerTransport + trEnterpriseCustomerOperationsServer *EnterpriseCustomerOperationsServerTransport + trEnterpriseMccCacheNodesOperationsServer *EnterpriseMccCacheNodesOperationsServerTransport + trEnterpriseMccCustomersServer *EnterpriseMccCustomersServerTransport + trIspCacheNodesOperationsServer *IspCacheNodesOperationsServerTransport + trIspCustomersServer *IspCustomersServerTransport + trOperationsServer *OperationsServerTransport +} + +// Do implements the policy.Transporter interface for ServerFactoryTransport. +func (s *ServerFactoryTransport) 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")} + } + + client := method[:strings.Index(method, ".")] + var resp *http.Response + var err error + + switch client { + case "CacheNodesOperationsClient": + initServer(s, &s.trCacheNodesOperationsServer, func() *CacheNodesOperationsServerTransport { + return NewCacheNodesOperationsServerTransport(&s.srv.CacheNodesOperationsServer) + }) + resp, err = s.trCacheNodesOperationsServer.Do(req) + case "EnterpriseCustomerOperationsClient": + initServer(s, &s.trEnterpriseCustomerOperationsServer, func() *EnterpriseCustomerOperationsServerTransport { + return NewEnterpriseCustomerOperationsServerTransport(&s.srv.EnterpriseCustomerOperationsServer) + }) + resp, err = s.trEnterpriseCustomerOperationsServer.Do(req) + case "EnterpriseMccCacheNodesOperationsClient": + initServer(s, &s.trEnterpriseMccCacheNodesOperationsServer, func() *EnterpriseMccCacheNodesOperationsServerTransport { + return NewEnterpriseMccCacheNodesOperationsServerTransport(&s.srv.EnterpriseMccCacheNodesOperationsServer) + }) + resp, err = s.trEnterpriseMccCacheNodesOperationsServer.Do(req) + case "EnterpriseMccCustomersClient": + initServer(s, &s.trEnterpriseMccCustomersServer, func() *EnterpriseMccCustomersServerTransport { + return NewEnterpriseMccCustomersServerTransport(&s.srv.EnterpriseMccCustomersServer) + }) + resp, err = s.trEnterpriseMccCustomersServer.Do(req) + case "IspCacheNodesOperationsClient": + initServer(s, &s.trIspCacheNodesOperationsServer, func() *IspCacheNodesOperationsServerTransport { + return NewIspCacheNodesOperationsServerTransport(&s.srv.IspCacheNodesOperationsServer) + }) + resp, err = s.trIspCacheNodesOperationsServer.Do(req) + case "IspCustomersClient": + initServer(s, &s.trIspCustomersServer, func() *IspCustomersServerTransport { return NewIspCustomersServerTransport(&s.srv.IspCustomersServer) }) + resp, err = s.trIspCustomersServer.Do(req) + case "OperationsClient": + initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) + resp, err = s.trOperationsServer.Do(req) + default: + err = fmt.Errorf("unhandled client %s", client) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func initServer[T any](s *ServerFactoryTransport, dst **T, src func() *T) { + s.trMu.Lock() + if *dst == nil { + *dst = src() + } + s.trMu.Unlock() +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/fake/time_rfc3339.go b/sdk/resourcemanager/connectedcache/armconnectedcache/fake/time_rfc3339.go new file mode 100644 index 000000000000..87ee11e83b32 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/fake/time_rfc3339.go @@ -0,0 +1,109 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) + +const ( + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` +) + +type dateTimeRFC3339 time.Time + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + return err +} + +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + +func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { + return nil + } + var aux dateTimeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/go.mod b/sdk/resourcemanager/connectedcache/armconnectedcache/go.mod new file mode 100644 index 000000000000..07717e7039ae --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/go.mod @@ -0,0 +1,21 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/connectedcache/armconnectedcache + +go 1.18 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 +) + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect + github.com/golang-jwt/jwt/v5 v5.2.1 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect + github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect + golang.org/x/crypto v0.27.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/text v0.18.0 // indirect +) diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/go.sum b/sdk/resourcemanager/connectedcache/armconnectedcache/go.sum new file mode 100644 index 000000000000..cbddbbd9ecec --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/go.sum @@ -0,0 +1,29 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 h1:JZg6HRh6W6U4OLl6lk7BZ7BLisIzM9dG1R50zUk9C/M= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0/go.mod h1:YL1xnZ6QejvQHWJrX/AvhFl4WW4rqHVoKspWNVwFk0M= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= +github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/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-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/ispcachenodesoperations_client.go b/sdk/resourcemanager/connectedcache/armconnectedcache/ispcachenodesoperations_client.go new file mode 100644 index 000000000000..114294da874f --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/ispcachenodesoperations_client.go @@ -0,0 +1,558 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armconnectedcache + +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" +) + +// IspCacheNodesOperationsClient contains the methods for the IspCacheNodesOperations group. +// Don't use this type directly, use NewIspCacheNodesOperationsClient() instead. +type IspCacheNodesOperationsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewIspCacheNodesOperationsClient creates a new instance of IspCacheNodesOperationsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewIspCacheNodesOperationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*IspCacheNodesOperationsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &IspCacheNodesOperationsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - This api creates an ispCacheNode with the specified create parameters +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - cacheNodeResourceName - Name of the ConnectedCache resource +// - resource - Resource create parameters. +// - options - IspCacheNodesOperationsClientBeginCreateOrUpdateOptions contains the optional parameters for the IspCacheNodesOperationsClient.BeginCreateOrUpdate +// method. +func (client *IspCacheNodesOperationsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, resource IspCacheNodeResource, options *IspCacheNodesOperationsClientBeginCreateOrUpdateOptions) (*runtime.Poller[IspCacheNodesOperationsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, customerResourceName, cacheNodeResourceName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[IspCacheNodesOperationsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[IspCacheNodesOperationsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - This api creates an ispCacheNode with the specified create parameters +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +func (client *IspCacheNodesOperationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, resource IspCacheNodeResource, options *IspCacheNodesOperationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "IspCacheNodesOperationsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, customerResourceName, cacheNodeResourceName, resource, 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 +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *IspCacheNodesOperationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, resource IspCacheNodeResource, _ *IspCacheNodesOperationsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/ispCustomers/{customerResourceName}/ispCacheNodes/{cacheNodeResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + if cacheNodeResourceName == "" { + return nil, errors.New("parameter cacheNodeResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cacheNodeResourceName}", url.PathEscape(cacheNodeResourceName)) + 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-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - This api deletes an existing ispCacheNode resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - cacheNodeResourceName - Name of the ConnectedCache resource +// - options - IspCacheNodesOperationsClientBeginDeleteOptions contains the optional parameters for the IspCacheNodesOperationsClient.BeginDelete +// method. +func (client *IspCacheNodesOperationsClient) BeginDelete(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, options *IspCacheNodesOperationsClientBeginDeleteOptions) (*runtime.Poller[IspCacheNodesOperationsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, customerResourceName, cacheNodeResourceName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[IspCacheNodesOperationsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[IspCacheNodesOperationsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - This api deletes an existing ispCacheNode resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +func (client *IspCacheNodesOperationsClient) deleteOperation(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, options *IspCacheNodesOperationsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "IspCacheNodesOperationsClient.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, customerResourceName, cacheNodeResourceName, 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.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *IspCacheNodesOperationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, _ *IspCacheNodesOperationsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/ispCustomers/{customerResourceName}/ispCacheNodes/{cacheNodeResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + if cacheNodeResourceName == "" { + return nil, errors.New("parameter cacheNodeResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cacheNodeResourceName}", url.PathEscape(cacheNodeResourceName)) + 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-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - This api gets ispCacheNode resource information +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - cacheNodeResourceName - Name of the ConnectedCache resource +// - options - IspCacheNodesOperationsClientGetOptions contains the optional parameters for the IspCacheNodesOperationsClient.Get +// method. +func (client *IspCacheNodesOperationsClient) Get(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, options *IspCacheNodesOperationsClientGetOptions) (IspCacheNodesOperationsClientGetResponse, error) { + var err error + const operationName = "IspCacheNodesOperationsClient.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, customerResourceName, cacheNodeResourceName, options) + if err != nil { + return IspCacheNodesOperationsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return IspCacheNodesOperationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return IspCacheNodesOperationsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *IspCacheNodesOperationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, _ *IspCacheNodesOperationsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/ispCustomers/{customerResourceName}/ispCacheNodes/{cacheNodeResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + if cacheNodeResourceName == "" { + return nil, errors.New("parameter cacheNodeResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cacheNodeResourceName}", url.PathEscape(cacheNodeResourceName)) + 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-05-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 *IspCacheNodesOperationsClient) getHandleResponse(resp *http.Response) (IspCacheNodesOperationsClientGetResponse, error) { + result := IspCacheNodesOperationsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.IspCacheNodeResource); err != nil { + return IspCacheNodesOperationsClientGetResponse{}, err + } + return result, nil +} + +// GetBgpCidrs - This api gets ispCacheNode resource information +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - cacheNodeResourceName - Name of the ConnectedCache resource +// - options - IspCacheNodesOperationsClientGetBgpCidrsOptions contains the optional parameters for the IspCacheNodesOperationsClient.GetBgpCidrs +// method. +func (client *IspCacheNodesOperationsClient) GetBgpCidrs(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, options *IspCacheNodesOperationsClientGetBgpCidrsOptions) (IspCacheNodesOperationsClientGetBgpCidrsResponse, error) { + var err error + const operationName = "IspCacheNodesOperationsClient.GetBgpCidrs" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getBgpCidrsCreateRequest(ctx, resourceGroupName, customerResourceName, cacheNodeResourceName, options) + if err != nil { + return IspCacheNodesOperationsClientGetBgpCidrsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return IspCacheNodesOperationsClientGetBgpCidrsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return IspCacheNodesOperationsClientGetBgpCidrsResponse{}, err + } + resp, err := client.getBgpCidrsHandleResponse(httpResp) + return resp, err +} + +// getBgpCidrsCreateRequest creates the GetBgpCidrs request. +func (client *IspCacheNodesOperationsClient) getBgpCidrsCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, _ *IspCacheNodesOperationsClientGetBgpCidrsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/ispCustomers/{customerResourceName}/ispCacheNodes/{cacheNodeResourceName}/getBgpCidrs" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + if cacheNodeResourceName == "" { + return nil, errors.New("parameter cacheNodeResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cacheNodeResourceName}", url.PathEscape(cacheNodeResourceName)) + 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-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getBgpCidrsHandleResponse handles the GetBgpCidrs response. +func (client *IspCacheNodesOperationsClient) getBgpCidrsHandleResponse(resp *http.Response) (IspCacheNodesOperationsClientGetBgpCidrsResponse, error) { + result := IspCacheNodesOperationsClientGetBgpCidrsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MccCacheNodeBgpCidrDetails); err != nil { + return IspCacheNodesOperationsClientGetBgpCidrsResponse{}, err + } + return result, nil +} + +// GetCacheNodeInstallDetails - This api gets secrets of the ispCacheNode resource install details +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - cacheNodeResourceName - Name of the ConnectedCache resource +// - options - IspCacheNodesOperationsClientGetCacheNodeInstallDetailsOptions contains the optional parameters for the IspCacheNodesOperationsClient.GetCacheNodeInstallDetails +// method. +func (client *IspCacheNodesOperationsClient) GetCacheNodeInstallDetails(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, options *IspCacheNodesOperationsClientGetCacheNodeInstallDetailsOptions) (IspCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse, error) { + var err error + const operationName = "IspCacheNodesOperationsClient.GetCacheNodeInstallDetails" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCacheNodeInstallDetailsCreateRequest(ctx, resourceGroupName, customerResourceName, cacheNodeResourceName, options) + if err != nil { + return IspCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return IspCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return IspCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse{}, err + } + resp, err := client.getCacheNodeInstallDetailsHandleResponse(httpResp) + return resp, err +} + +// getCacheNodeInstallDetailsCreateRequest creates the GetCacheNodeInstallDetails request. +func (client *IspCacheNodesOperationsClient) getCacheNodeInstallDetailsCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, _ *IspCacheNodesOperationsClientGetCacheNodeInstallDetailsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/ispCustomers/{customerResourceName}/ispCacheNodes/{cacheNodeResourceName}/getCacheNodeInstallDetails" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + if cacheNodeResourceName == "" { + return nil, errors.New("parameter cacheNodeResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cacheNodeResourceName}", url.PathEscape(cacheNodeResourceName)) + 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-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getCacheNodeInstallDetailsHandleResponse handles the GetCacheNodeInstallDetails response. +func (client *IspCacheNodesOperationsClient) getCacheNodeInstallDetailsHandleResponse(resp *http.Response) (IspCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse, error) { + result := IspCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MccCacheNodeInstallDetails); err != nil { + return IspCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse{}, err + } + return result, nil +} + +// NewListByIspCustomerResourcePager - This api retrieves information about all ispCacheNode resources under the given subscription +// and resource group +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - options - IspCacheNodesOperationsClientListByIspCustomerResourceOptions contains the optional parameters for the IspCacheNodesOperationsClient.NewListByIspCustomerResourcePager +// method. +func (client *IspCacheNodesOperationsClient) NewListByIspCustomerResourcePager(resourceGroupName string, customerResourceName string, options *IspCacheNodesOperationsClientListByIspCustomerResourceOptions) *runtime.Pager[IspCacheNodesOperationsClientListByIspCustomerResourceResponse] { + return runtime.NewPager(runtime.PagingHandler[IspCacheNodesOperationsClientListByIspCustomerResourceResponse]{ + More: func(page IspCacheNodesOperationsClientListByIspCustomerResourceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *IspCacheNodesOperationsClientListByIspCustomerResourceResponse) (IspCacheNodesOperationsClientListByIspCustomerResourceResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "IspCacheNodesOperationsClient.NewListByIspCustomerResourcePager") + 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.listByIspCustomerResourceCreateRequest(ctx, resourceGroupName, customerResourceName, options) + }, nil) + if err != nil { + return IspCacheNodesOperationsClientListByIspCustomerResourceResponse{}, err + } + return client.listByIspCustomerResourceHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByIspCustomerResourceCreateRequest creates the ListByIspCustomerResource request. +func (client *IspCacheNodesOperationsClient) listByIspCustomerResourceCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, _ *IspCacheNodesOperationsClientListByIspCustomerResourceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/ispCustomers/{customerResourceName}/ispCacheNodes" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + 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-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByIspCustomerResourceHandleResponse handles the ListByIspCustomerResource response. +func (client *IspCacheNodesOperationsClient) listByIspCustomerResourceHandleResponse(resp *http.Response) (IspCacheNodesOperationsClientListByIspCustomerResourceResponse, error) { + result := IspCacheNodesOperationsClientListByIspCustomerResourceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.IspCacheNodeResourceListResult); err != nil { + return IspCacheNodesOperationsClientListByIspCustomerResourceResponse{}, err + } + return result, nil +} + +// Update - This api updates an existing ispCacheNode resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - cacheNodeResourceName - Name of the ConnectedCache resource +// - properties - The resource properties to be updated. +// - options - IspCacheNodesOperationsClientUpdateOptions contains the optional parameters for the IspCacheNodesOperationsClient.Update +// method. +func (client *IspCacheNodesOperationsClient) Update(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, properties PatchResource, options *IspCacheNodesOperationsClientUpdateOptions) (IspCacheNodesOperationsClientUpdateResponse, error) { + var err error + const operationName = "IspCacheNodesOperationsClient.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, customerResourceName, cacheNodeResourceName, properties, options) + if err != nil { + return IspCacheNodesOperationsClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return IspCacheNodesOperationsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return IspCacheNodesOperationsClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *IspCacheNodesOperationsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, cacheNodeResourceName string, properties PatchResource, _ *IspCacheNodesOperationsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/ispCustomers/{customerResourceName}/ispCacheNodes/{cacheNodeResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + if cacheNodeResourceName == "" { + return nil, errors.New("parameter cacheNodeResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cacheNodeResourceName}", url.PathEscape(cacheNodeResourceName)) + 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-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *IspCacheNodesOperationsClient) updateHandleResponse(resp *http.Response) (IspCacheNodesOperationsClientUpdateResponse, error) { + result := IspCacheNodesOperationsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.IspCacheNodeResource); err != nil { + return IspCacheNodesOperationsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/ispcachenodesoperations_client_example_test.go b/sdk/resourcemanager/connectedcache/armconnectedcache/ispcachenodesoperations_client_example_test.go new file mode 100644 index 000000000000..cd071f82888d --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/ispcachenodesoperations_client_example_test.go @@ -0,0 +1,724 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armconnectedcache_test + +import ( + "context" + "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/connectedcache/armconnectedcache" + "log" +) + +// Generated from example definition: 2023-05-01-preview/IspCacheNodesOperations_CreateOrUpdate_MaximumSet_Gen.json +func ExampleIspCacheNodesOperationsClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewIspCacheNodesOperationsClient().BeginCreateOrUpdate(ctx, "rgConnectedCache", "zpqzbmanlljgmkrthtydrtneavhlnlqkdmviq", "cabakm", armconnectedcache.IspCacheNodeResource{ + Location: to.Ptr("westus"), + Properties: &armconnectedcache.CacheNodeProperty{ + CacheNode: &armconnectedcache.CacheNodeEntity{ + FullyQualifiedResourceID: to.Ptr("hskxkpbiqbrbjiwdzrxndru"), + CustomerName: to.Ptr("xwyqk"), + IPAddress: to.Ptr("voctagljcwqgcpnionqdcbjk"), + CustomerIndex: to.Ptr("qtoiglqaswivmkjhzogburcxtszmek"), + CacheNodeID: to.Ptr("xjzffjftwcgsehanoxsl"), + CacheNodeName: to.Ptr("mfjxb"), + CustomerAsn: to.Ptr[int32](4), + IsEnabled: to.Ptr(true), + MaxAllowableEgressInMbps: to.Ptr[int32](29), + IsEnterpriseManaged: to.Ptr(true), + CidrCSV: []*string{ + to.Ptr("nlqlvrthafvvljuupcbcw"), + }, + ShouldMigrate: to.Ptr(true), + CidrSelectionType: to.Ptr[int32](4), + }, + AdditionalCacheNodeProperties: &armconnectedcache.AdditionalCacheNodeProperties{ + DriveConfiguration: []*armconnectedcache.CacheNodeDriveConfiguration{ + { + PhysicalPath: to.Ptr("/mcc"), + SizeInGb: to.Ptr[int32](500), + CacheNumber: to.Ptr[int32](1), + NginxMapping: to.Ptr("lijygenjq"), + }, + }, + BgpConfiguration: &armconnectedcache.BgpConfiguration{ + AsnToIPAddressMapping: to.Ptr("pafcimhoog"), + }, + CacheNodePropertiesDetailsIssuesList: []*string{ + to.Ptr("ex"), + }, + ProxyURLConfiguration: &armconnectedcache.ProxyURLConfiguration{ + ProxyURL: to.Ptr("hplstyg"), + }, + ProxyURL: to.Ptr("qhux"), + OptionalProperty1: to.Ptr("hvpmt"), + OptionalProperty2: to.Ptr("talanelmsgxvksrzoeeontqkjzbpv"), + OptionalProperty3: to.Ptr("bxkoxq"), + OptionalProperty4: to.Ptr("pqlkcekupusoc"), + OptionalProperty5: to.Ptr("nyvvmrjigqdufzjdvazdca"), + }, + StatusCode: to.Ptr("1"), + StatusText: to.Ptr("Success"), + StatusDetails: to.Ptr("djruqvptzxak"), + Error: &armconnectedcache.ErrorDetail{}, + }, + Tags: map[string]*string{ + "key4171": to.Ptr("qtjlszkawsdujzpgohsbw"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %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 = armconnectedcache.IspCacheNodesOperationsClientCreateOrUpdateResponse{ + // IspCacheNodeResource: &armconnectedcache.IspCacheNodeResource{ + // Location: to.Ptr("westus"), + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/DOTest/providers/Microsoft.ConnectedCache/ispCustomers/MccRPTest1/ispCacheNodes/MCCCachenode1"), + // Name: to.Ptr("MccRPTest1"), + // Type: to.Ptr("Microsoft.ConnectedCache/ispCustomers/ispCacheNodes"), + // Properties: &armconnectedcache.CacheNodeProperty{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // CacheNode: &armconnectedcache.CacheNodeEntity{ + // FullyQualifiedResourceID: to.Ptr("hskxkpbiqbrbjiwdzrxndru"), + // CustomerID: to.Ptr("ceyfqoygknpmmjojlhuklqybfl"), + // CustomerName: to.Ptr("xwyqk"), + // IPAddress: to.Ptr("voctagljcwqgcpnionqdcbjk"), + // CustomerIndex: to.Ptr("qtoiglqaswivmkjhzogburcxtszmek"), + // CacheNodeID: to.Ptr("xjzffjftwcgsehanoxsl"), + // CacheNodeName: to.Ptr("mfjxb"), + // CustomerAsn: to.Ptr[int32](4), + // IsEnabled: to.Ptr(true), + // MaxAllowableEgressInMbps: to.Ptr[int32](29), + // MaxAllowableProbability: to.Ptr[float32](16), + // XCid: to.Ptr("kwnwgdbeflazz"), + // IsEnterpriseManaged: to.Ptr(true), + // DeleteAsyncOperationID: to.Ptr("oeyevqzlpbsimi"), + // ClientTenantID: to.Ptr("ds"), + // Category: to.Ptr("rixlfzbl"), + // ReleaseVersion: to.Ptr[int32](30), + // LastSyncWithAzureTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // SynchWithAzureAttemptsCount: to.Ptr[int32](11), + // ContainerConfigurations: to.Ptr("waygqqgfzvnvlbufilldsqavwlshzt"), + // CidrCSV: []*string{ + // to.Ptr("nlqlvrthafvvljuupcbcw"), + // }, + // CidrCSVLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // BgpCidrCSVLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // BgpLastReportedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // BgpReviewStateText: to.Ptr("xduneialocyri"), + // BgpReviewState: to.Ptr(armconnectedcache.BgpReviewStateEnumNotConfigured), + // BgpReviewFeedback: to.Ptr("us"), + // BgpNumberOfTimesUpdated: to.Ptr[int32](2), + // BgpNumberOfRecords: to.Ptr[int32](21), + // BgpCidrBlocksCount: to.Ptr[int32](5), + // BgpAddressSpace: to.Ptr[int32](6), + // ShouldMigrate: to.Ptr(true), + // BgpFileBytesTruncated: to.Ptr[int32](13), + // CidrSelectionType: to.Ptr[int32](4), + // IsFrozen: to.Ptr(true), + // ReviewState: to.Ptr[int32](19), + // ReviewStateText: to.Ptr("mrnragzmnscovixohmif"), + // ReviewFeedback: to.Ptr("wrcfimvx"), + // ConfigurationState: to.Ptr(armconnectedcache.ConfigurationStateConfigured), + // ConfigurationStateText: to.Ptr("arugukqjcxmkbgfambg"), + // AddressSpace: to.Ptr[int32](11), + // WorkerConnections: to.Ptr[int32](18), + // WorkerConnectionsLastUpdatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // ContainerResyncTrigger: to.Ptr[int32](13), + // ImageURI: to.Ptr("ezbwyfaainatxtlplyoailzxlhxy"), + // }, + // AdditionalCacheNodeProperties: &armconnectedcache.AdditionalCacheNodeProperties{ + // DriveConfiguration: []*armconnectedcache.CacheNodeDriveConfiguration{ + // { + // PhysicalPath: to.Ptr("/mcc"), + // SizeInGb: to.Ptr[int32](500), + // CacheNumber: to.Ptr[int32](1), + // NginxMapping: to.Ptr("lijygenjq"), + // }, + // }, + // BgpConfiguration: &armconnectedcache.BgpConfiguration{ + // AsnToIPAddressMapping: to.Ptr("pafcimhoog"), + // }, + // CacheNodePropertiesDetailsIssuesList: []*string{ + // to.Ptr("ex"), + // }, + // AggregatedStatusDetails: to.Ptr("emougql"), + // AggregatedStatusText: to.Ptr("xcasvndgkob"), + // AggregatedStatusCode: to.Ptr[int32](22), + // ProductVersion: to.Ptr("oxhqgwlhgnuf"), + // IsProvisioned: to.Ptr(true), + // CacheNodeStateDetailedText: to.Ptr("ufvomikgfnmnj"), + // CacheNodeStateShortText: to.Ptr("orfpuvrevhrxsaasddazigglq"), + // CacheNodeState: to.Ptr[int32](9), + // ProxyURLConfiguration: &armconnectedcache.ProxyURLConfiguration{ + // ProxyURL: to.Ptr("hplstyg"), + // }, + // ProxyURL: to.Ptr("qhux"), + // OptionalProperty1: to.Ptr("hvpmt"), + // OptionalProperty2: to.Ptr("talanelmsgxvksrzoeeontqkjzbpv"), + // OptionalProperty3: to.Ptr("bxkoxq"), + // OptionalProperty4: to.Ptr("pqlkcekupusoc"), + // OptionalProperty5: to.Ptr("nyvvmrjigqdufzjdvazdca"), + // }, + // StatusCode: to.Ptr("1"), + // StatusText: to.Ptr("Success"), + // StatusDetails: to.Ptr("djruqvptzxak"), + // Status: to.Ptr("tnyrntqvazk"), + // }, + // Tags: map[string]*string{ + // "key4171": to.Ptr("qtjlszkawsdujzpgohsbw"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2023-05-01-preview/IspCacheNodesOperations_Delete_MaximumSet_Gen.json +func ExampleIspCacheNodesOperationsClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewIspCacheNodesOperationsClient().BeginDelete(ctx, "rgConnectedCache", "lvpcosvbfxtpzscakewx", "wsiruvexelltpbouqxvsogqpxdizcwqwfowybncvjunlakjwcpgmqbdbgzjrsmxlkczxnsxfonhnqqa", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: 2023-05-01-preview/IspCacheNodesOperations_Get_MaximumSet_Gen.json +func ExampleIspCacheNodesOperationsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewIspCacheNodesOperationsClient().Get(ctx, "rgConnectedCache", "sgtqjsitdrskmgyrrkntszwrrjjkretscpjgaezraucvcwececlelcsorfunrnvxyxcsrg", "lbsziwmudcjnwnwy", 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 = armconnectedcache.IspCacheNodesOperationsClientGetResponse{ + // IspCacheNodeResource: &armconnectedcache.IspCacheNodeResource{ + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/ispCustomers/MccRPTest1/ispCacheNodes/MCCCachenode1"), + // Name: to.Ptr("MccRPTest1"), + // Type: to.Ptr("Microsoft.ConnectedCache/ispCustomers/ispCacheNodes"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CacheNodeProperty{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // CacheNode: &armconnectedcache.CacheNodeEntity{ + // FullyQualifiedResourceID: to.Ptr("hskxkpbiqbrbjiwdzrxndru"), + // CustomerID: to.Ptr("ceyfqoygknpmmjojlhuklqybfl"), + // CustomerName: to.Ptr("xwyqk"), + // IPAddress: to.Ptr("voctagljcwqgcpnionqdcbjk"), + // CustomerIndex: to.Ptr("qtoiglqaswivmkjhzogburcxtszmek"), + // CacheNodeID: to.Ptr("xjzffjftwcgsehanoxsl"), + // CacheNodeName: to.Ptr("mfjxb"), + // CustomerAsn: to.Ptr[int32](4), + // IsEnabled: to.Ptr(true), + // MaxAllowableEgressInMbps: to.Ptr[int32](29), + // MaxAllowableProbability: to.Ptr[float32](16), + // XCid: to.Ptr("kwnwgdbeflazz"), + // IsEnterpriseManaged: to.Ptr(true), + // DeleteAsyncOperationID: to.Ptr("oeyevqzlpbsimi"), + // ClientTenantID: to.Ptr("ds"), + // Category: to.Ptr("rixlfzbl"), + // ReleaseVersion: to.Ptr[int32](30), + // LastSyncWithAzureTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // SynchWithAzureAttemptsCount: to.Ptr[int32](11), + // ContainerConfigurations: to.Ptr("waygqqgfzvnvlbufilldsqavwlshzt"), + // CidrCSV: []*string{ + // to.Ptr("nlqlvrthafvvljuupcbcw"), + // }, + // CidrCSVLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // BgpCidrCSVLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // BgpLastReportedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // BgpReviewStateText: to.Ptr("xduneialocyri"), + // BgpReviewState: to.Ptr(armconnectedcache.BgpReviewStateEnumNotConfigured), + // BgpReviewFeedback: to.Ptr("us"), + // BgpNumberOfTimesUpdated: to.Ptr[int32](2), + // BgpNumberOfRecords: to.Ptr[int32](21), + // BgpCidrBlocksCount: to.Ptr[int32](5), + // BgpAddressSpace: to.Ptr[int32](6), + // ShouldMigrate: to.Ptr(true), + // BgpFileBytesTruncated: to.Ptr[int32](13), + // CidrSelectionType: to.Ptr[int32](4), + // IsFrozen: to.Ptr(true), + // ReviewState: to.Ptr[int32](19), + // ReviewStateText: to.Ptr("mrnragzmnscovixohmif"), + // ReviewFeedback: to.Ptr("wrcfimvx"), + // ConfigurationState: to.Ptr(armconnectedcache.ConfigurationStateConfigured), + // ConfigurationStateText: to.Ptr("arugukqjcxmkbgfambg"), + // AddressSpace: to.Ptr[int32](11), + // WorkerConnections: to.Ptr[int32](18), + // WorkerConnectionsLastUpdatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // ContainerResyncTrigger: to.Ptr[int32](13), + // ImageURI: to.Ptr("ezbwyfaainatxtlplyoailzxlhxy"), + // }, + // AdditionalCacheNodeProperties: &armconnectedcache.AdditionalCacheNodeProperties{ + // DriveConfiguration: []*armconnectedcache.CacheNodeDriveConfiguration{ + // { + // PhysicalPath: to.Ptr("/mcc"), + // SizeInGb: to.Ptr[int32](500), + // CacheNumber: to.Ptr[int32](1), + // NginxMapping: to.Ptr("lijygenjq"), + // }, + // }, + // BgpConfiguration: &armconnectedcache.BgpConfiguration{ + // AsnToIPAddressMapping: to.Ptr("pafcimhoog"), + // }, + // CacheNodePropertiesDetailsIssuesList: []*string{ + // to.Ptr("ex"), + // }, + // AggregatedStatusDetails: to.Ptr("emougql"), + // AggregatedStatusText: to.Ptr("xcasvndgkob"), + // AggregatedStatusCode: to.Ptr[int32](22), + // ProductVersion: to.Ptr("oxhqgwlhgnuf"), + // IsProvisioned: to.Ptr(true), + // CacheNodeStateDetailedText: to.Ptr("ufvomikgfnmnj"), + // CacheNodeStateShortText: to.Ptr("orfpuvrevhrxsaasddazigglq"), + // CacheNodeState: to.Ptr[int32](9), + // ProxyURLConfiguration: &armconnectedcache.ProxyURLConfiguration{ + // ProxyURL: to.Ptr("hplstyg"), + // }, + // ProxyURL: to.Ptr("qhux"), + // OptionalProperty1: to.Ptr("hvpmt"), + // OptionalProperty2: to.Ptr("talanelmsgxvksrzoeeontqkjzbpv"), + // OptionalProperty3: to.Ptr("bxkoxq"), + // OptionalProperty4: to.Ptr("pqlkcekupusoc"), + // OptionalProperty5: to.Ptr("nyvvmrjigqdufzjdvazdca"), + // }, + // StatusCode: to.Ptr("1"), + // StatusText: to.Ptr("Success"), + // StatusDetails: to.Ptr("djruqvptzxak"), + // Status: to.Ptr("tnyrntqvazk"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key4171": to.Ptr("qtjlszkawsdujzpgohsbw"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2023-05-01-preview/IspCacheNodesOperations_GetBgpCidrs_MaximumSet_Gen.json +func ExampleIspCacheNodesOperationsClient_GetBgpCidrs() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewIspCacheNodesOperationsClient().GetBgpCidrs(ctx, "rgConnectedCache", "MccRPTest1", "MCCCachenode1", 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 = armconnectedcache.IspCacheNodesOperationsClientGetBgpCidrsResponse{ + // MccCacheNodeBgpCidrDetails: &armconnectedcache.MccCacheNodeBgpCidrDetails{ + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/ispCustomers/MccRPTest1/ispCacheNodes/MCCCachenode1"), + // Type: to.Ptr("Microsoft.ConnectedCache/ispCustomers/ispCacheNodes"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.BgpCidrsConfiguration{ + // BgpCidrs: []*string{ + // to.Ptr("10.1.0.1/23"), + // to.Ptr("10.1.0.1/32"), + // }, + // }, + // Tags: map[string]*string{ + // "key5911": to.Ptr("qllqoxckxvnyhdegqubvqtfediery"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2023-05-01-preview/IspCacheNodesOperations_GetCacheNodeInstallDetails_MaximumSet_Gen.json +func ExampleIspCacheNodesOperationsClient_GetCacheNodeInstallDetails() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewIspCacheNodesOperationsClient().GetCacheNodeInstallDetails(ctx, "rgConnectedCache", "MccRPTest1", "MCCCachenode1", 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 = armconnectedcache.IspCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse{ + // MccCacheNodeInstallDetails: &armconnectedcache.MccCacheNodeInstallDetails{ + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/ispCustomers/MccRPTest1/ispCacheNodes/MCCCachenode1"), + // Type: to.Ptr("Microsoft.ConnectedCache/ispCustomers/ispCacheNodes"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CacheNodeInstallProperties{ + // CustomerID: to.Ptr("eqklliuswn"), + // CacheNodeID: to.Ptr("zirahqqohbaju"), + // PrimaryAccountKey: to.Ptr("mzfvziehrsbxidhj"), + // SecondaryAccountKey: to.Ptr("dq"), + // RegistrationKey: to.Ptr("tnwkmorctwsgajewcoutombm"), + // }, + // Tags: map[string]*string{ + // "key5811": to.Ptr("betoafcoprgfcuscoew"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2023-05-01-preview/IspCacheNodesOperations_ListByIspCustomerResource_MaximumSet_Gen.json +func ExampleIspCacheNodesOperationsClient_NewListByIspCustomerResourcePager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewIspCacheNodesOperationsClient().NewListByIspCustomerResourcePager("rgConnectedCache", "MccRPTest1", 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 = armconnectedcache.IspCacheNodesOperationsClientListByIspCustomerResourceResponse{ + // IspCacheNodeResourceListResult: armconnectedcache.IspCacheNodeResourceListResult{ + // Value: []*armconnectedcache.IspCacheNodeResource{ + // { + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/ispCustomers/MccRPTest1/ispCacheNodes/MCCCachenode1"), + // Name: to.Ptr("MccRPTest1"), + // Type: to.Ptr("Microsoft.ConnectedCache/ispCustomers/ispCacheNodes"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CacheNodeProperty{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // CacheNode: &armconnectedcache.CacheNodeEntity{ + // FullyQualifiedResourceID: to.Ptr("hskxkpbiqbrbjiwdzrxndru"), + // CustomerID: to.Ptr("ceyfqoygknpmmjojlhuklqybfl"), + // CustomerName: to.Ptr("xwyqk"), + // IPAddress: to.Ptr("voctagljcwqgcpnionqdcbjk"), + // CustomerIndex: to.Ptr("qtoiglqaswivmkjhzogburcxtszmek"), + // CacheNodeID: to.Ptr("xjzffjftwcgsehanoxsl"), + // CacheNodeName: to.Ptr("mfjxb"), + // CustomerAsn: to.Ptr[int32](4), + // IsEnabled: to.Ptr(true), + // MaxAllowableEgressInMbps: to.Ptr[int32](29), + // MaxAllowableProbability: to.Ptr[float32](16), + // XCid: to.Ptr("kwnwgdbeflazz"), + // IsEnterpriseManaged: to.Ptr(true), + // DeleteAsyncOperationID: to.Ptr("oeyevqzlpbsimi"), + // ClientTenantID: to.Ptr("ds"), + // Category: to.Ptr("rixlfzbl"), + // ReleaseVersion: to.Ptr[int32](30), + // LastSyncWithAzureTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // SynchWithAzureAttemptsCount: to.Ptr[int32](11), + // ContainerConfigurations: to.Ptr("waygqqgfzvnvlbufilldsqavwlshzt"), + // CidrCSV: []*string{ + // to.Ptr("nlqlvrthafvvljuupcbcw"), + // }, + // CidrCSVLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // BgpCidrCSVLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // BgpLastReportedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // BgpReviewStateText: to.Ptr("xduneialocyri"), + // BgpReviewState: to.Ptr(armconnectedcache.BgpReviewStateEnumNotConfigured), + // BgpReviewFeedback: to.Ptr("us"), + // BgpNumberOfTimesUpdated: to.Ptr[int32](2), + // BgpNumberOfRecords: to.Ptr[int32](21), + // BgpCidrBlocksCount: to.Ptr[int32](5), + // BgpAddressSpace: to.Ptr[int32](6), + // ShouldMigrate: to.Ptr(true), + // BgpFileBytesTruncated: to.Ptr[int32](13), + // CidrSelectionType: to.Ptr[int32](4), + // IsFrozen: to.Ptr(true), + // ReviewState: to.Ptr[int32](19), + // ReviewStateText: to.Ptr("mrnragzmnscovixohmif"), + // ReviewFeedback: to.Ptr("wrcfimvx"), + // ConfigurationState: to.Ptr(armconnectedcache.ConfigurationStateConfigured), + // ConfigurationStateText: to.Ptr("arugukqjcxmkbgfambg"), + // AddressSpace: to.Ptr[int32](11), + // WorkerConnections: to.Ptr[int32](18), + // WorkerConnectionsLastUpdatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // ContainerResyncTrigger: to.Ptr[int32](13), + // ImageURI: to.Ptr("ezbwyfaainatxtlplyoailzxlhxy"), + // }, + // AdditionalCacheNodeProperties: &armconnectedcache.AdditionalCacheNodeProperties{ + // DriveConfiguration: []*armconnectedcache.CacheNodeDriveConfiguration{ + // { + // PhysicalPath: to.Ptr("/mcc"), + // SizeInGb: to.Ptr[int32](500), + // CacheNumber: to.Ptr[int32](1), + // NginxMapping: to.Ptr("lijygenjq"), + // }, + // }, + // BgpConfiguration: &armconnectedcache.BgpConfiguration{ + // AsnToIPAddressMapping: to.Ptr("pafcimhoog"), + // }, + // CacheNodePropertiesDetailsIssuesList: []*string{ + // to.Ptr("ex"), + // }, + // AggregatedStatusDetails: to.Ptr("emougql"), + // AggregatedStatusText: to.Ptr("xcasvndgkob"), + // AggregatedStatusCode: to.Ptr[int32](22), + // ProductVersion: to.Ptr("oxhqgwlhgnuf"), + // IsProvisioned: to.Ptr(true), + // CacheNodeStateDetailedText: to.Ptr("ufvomikgfnmnj"), + // CacheNodeStateShortText: to.Ptr("orfpuvrevhrxsaasddazigglq"), + // CacheNodeState: to.Ptr[int32](9), + // ProxyURLConfiguration: &armconnectedcache.ProxyURLConfiguration{ + // ProxyURL: to.Ptr("hplstyg"), + // }, + // ProxyURL: to.Ptr("qhux"), + // OptionalProperty1: to.Ptr("hvpmt"), + // OptionalProperty2: to.Ptr("talanelmsgxvksrzoeeontqkjzbpv"), + // OptionalProperty3: to.Ptr("bxkoxq"), + // OptionalProperty4: to.Ptr("pqlkcekupusoc"), + // OptionalProperty5: to.Ptr("nyvvmrjigqdufzjdvazdca"), + // }, + // StatusCode: to.Ptr("1"), + // StatusText: to.Ptr("Success"), + // StatusDetails: to.Ptr("djruqvptzxak"), + // Status: to.Ptr("tnyrntqvazk"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key4171": to.Ptr("qtjlszkawsdujzpgohsbw"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2023-05-01-preview/IspCacheNodesOperations_Update_MaximumSet_Gen.json +func ExampleIspCacheNodesOperationsClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewIspCacheNodesOperationsClient().Update(ctx, "rgConnectedCache", "MccRPTest1", "MCCCachenode1", armconnectedcache.PatchResource{ + Tags: map[string]*string{ + "key1653": to.Ptr("nzjczrhclhkndesgy"), + }, + }, 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 = armconnectedcache.IspCacheNodesOperationsClientUpdateResponse{ + // IspCacheNodeResource: &armconnectedcache.IspCacheNodeResource{ + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/ispCustomers/MccRPTest1/ispCacheNodes/MCCCachenode1"), + // Name: to.Ptr("MccRPTest1"), + // Type: to.Ptr("Microsoft.ConnectedCache/ispCustomers/ispCacheNodes"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CacheNodeProperty{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // CacheNode: &armconnectedcache.CacheNodeEntity{ + // FullyQualifiedResourceID: to.Ptr("hskxkpbiqbrbjiwdzrxndru"), + // CustomerID: to.Ptr("ceyfqoygknpmmjojlhuklqybfl"), + // CustomerName: to.Ptr("xwyqk"), + // IPAddress: to.Ptr("voctagljcwqgcpnionqdcbjk"), + // CustomerIndex: to.Ptr("qtoiglqaswivmkjhzogburcxtszmek"), + // CacheNodeID: to.Ptr("xjzffjftwcgsehanoxsl"), + // CacheNodeName: to.Ptr("mfjxb"), + // CustomerAsn: to.Ptr[int32](4), + // IsEnabled: to.Ptr(true), + // MaxAllowableEgressInMbps: to.Ptr[int32](29), + // MaxAllowableProbability: to.Ptr[float32](16), + // XCid: to.Ptr("kwnwgdbeflazz"), + // IsEnterpriseManaged: to.Ptr(true), + // DeleteAsyncOperationID: to.Ptr("oeyevqzlpbsimi"), + // ClientTenantID: to.Ptr("ds"), + // Category: to.Ptr("rixlfzbl"), + // ReleaseVersion: to.Ptr[int32](30), + // LastSyncWithAzureTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // SynchWithAzureAttemptsCount: to.Ptr[int32](11), + // ContainerConfigurations: to.Ptr("waygqqgfzvnvlbufilldsqavwlshzt"), + // CidrCSV: []*string{ + // to.Ptr("127.0.0.1/20"), + // }, + // CidrCSVLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // BgpCidrCSVLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // BgpLastReportedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // BgpReviewStateText: to.Ptr("xduneialocyri"), + // BgpReviewState: to.Ptr(armconnectedcache.BgpReviewStateEnumNotConfigured), + // BgpReviewFeedback: to.Ptr("us"), + // BgpNumberOfTimesUpdated: to.Ptr[int32](2), + // BgpNumberOfRecords: to.Ptr[int32](21), + // BgpCidrBlocksCount: to.Ptr[int32](5), + // BgpAddressSpace: to.Ptr[int32](6), + // ShouldMigrate: to.Ptr(true), + // BgpFileBytesTruncated: to.Ptr[int32](13), + // CidrSelectionType: to.Ptr[int32](4), + // IsFrozen: to.Ptr(true), + // ReviewState: to.Ptr[int32](19), + // ReviewStateText: to.Ptr("mrnragzmnscovixohmif"), + // ReviewFeedback: to.Ptr("wrcfimvx"), + // ConfigurationState: to.Ptr(armconnectedcache.ConfigurationStateConfigured), + // ConfigurationStateText: to.Ptr("arugukqjcxmkbgfambg"), + // AddressSpace: to.Ptr[int32](11), + // WorkerConnections: to.Ptr[int32](18), + // WorkerConnectionsLastUpdatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // ContainerResyncTrigger: to.Ptr[int32](13), + // ImageURI: to.Ptr("ezbwyfaainatxtlplyoailzxlhxy"), + // }, + // AdditionalCacheNodeProperties: &armconnectedcache.AdditionalCacheNodeProperties{ + // DriveConfiguration: []*armconnectedcache.CacheNodeDriveConfiguration{ + // { + // PhysicalPath: to.Ptr("/mcc"), + // SizeInGb: to.Ptr[int32](500), + // CacheNumber: to.Ptr[int32](1), + // NginxMapping: to.Ptr("lijygenjq"), + // }, + // }, + // BgpConfiguration: &armconnectedcache.BgpConfiguration{ + // AsnToIPAddressMapping: to.Ptr("pafcimhoog"), + // }, + // CacheNodePropertiesDetailsIssuesList: []*string{ + // to.Ptr("ex"), + // }, + // AggregatedStatusDetails: to.Ptr("emougql"), + // AggregatedStatusText: to.Ptr("xcasvndgkob"), + // AggregatedStatusCode: to.Ptr[int32](22), + // ProductVersion: to.Ptr("oxhqgwlhgnuf"), + // IsProvisioned: to.Ptr(true), + // CacheNodeStateDetailedText: to.Ptr("ufvomikgfnmnj"), + // CacheNodeStateShortText: to.Ptr("orfpuvrevhrxsaasddazigglq"), + // CacheNodeState: to.Ptr[int32](9), + // ProxyURLConfiguration: &armconnectedcache.ProxyURLConfiguration{ + // ProxyURL: to.Ptr("hplstyg"), + // }, + // ProxyURL: to.Ptr("qhux"), + // OptionalProperty1: to.Ptr("hvpmt"), + // OptionalProperty2: to.Ptr("talanelmsgxvksrzoeeontqkjzbpv"), + // OptionalProperty3: to.Ptr("bxkoxq"), + // OptionalProperty4: to.Ptr("pqlkcekupusoc"), + // OptionalProperty5: to.Ptr("nyvvmrjigqdufzjdvazdca"), + // }, + // StatusCode: to.Ptr("1"), + // StatusText: to.Ptr("Success"), + // StatusDetails: to.Ptr("djruqvptzxak"), + // Status: to.Ptr("tnyrntqvazk"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key4171": to.Ptr("qtjlszkawsdujzpgohsbw"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/ispcustomers_client.go b/sdk/resourcemanager/connectedcache/armconnectedcache/ispcustomers_client.go new file mode 100644 index 000000000000..a9a5ff6d9485 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/ispcustomers_client.go @@ -0,0 +1,446 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armconnectedcache + +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" +) + +// IspCustomersClient contains the methods for the IspCustomers group. +// Don't use this type directly, use NewIspCustomersClient() instead. +type IspCustomersClient struct { + internal *arm.Client + subscriptionID string +} + +// NewIspCustomersClient creates a new instance of IspCustomersClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewIspCustomersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*IspCustomersClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &IspCustomersClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - This api creates an ispCustomer with the specified create parameters +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - resource - Resource create parameters. +// - options - IspCustomersClientBeginCreateOrUpdateOptions contains the optional parameters for the IspCustomersClient.BeginCreateOrUpdate +// method. +func (client *IspCustomersClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, customerResourceName string, resource IspCustomerResource, options *IspCustomersClientBeginCreateOrUpdateOptions) (*runtime.Poller[IspCustomersClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, customerResourceName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[IspCustomersClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[IspCustomersClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - This api creates an ispCustomer with the specified create parameters +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +func (client *IspCustomersClient) createOrUpdate(ctx context.Context, resourceGroupName string, customerResourceName string, resource IspCustomerResource, options *IspCustomersClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "IspCustomersClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, customerResourceName, resource, 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 +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *IspCustomersClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, resource IspCustomerResource, _ *IspCustomersClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/ispCustomers/{customerResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + 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-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - This api deletes an existing ispCustomer resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - options - IspCustomersClientBeginDeleteOptions contains the optional parameters for the IspCustomersClient.BeginDelete +// method. +func (client *IspCustomersClient) BeginDelete(ctx context.Context, resourceGroupName string, customerResourceName string, options *IspCustomersClientBeginDeleteOptions) (*runtime.Poller[IspCustomersClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, customerResourceName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[IspCustomersClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[IspCustomersClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - This api deletes an existing ispCustomer resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +func (client *IspCustomersClient) deleteOperation(ctx context.Context, resourceGroupName string, customerResourceName string, options *IspCustomersClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "IspCustomersClient.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, customerResourceName, 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.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *IspCustomersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, _ *IspCustomersClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/ispCustomers/{customerResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + 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-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the ispCustomer resource information using this get call +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - options - IspCustomersClientGetOptions contains the optional parameters for the IspCustomersClient.Get method. +func (client *IspCustomersClient) Get(ctx context.Context, resourceGroupName string, customerResourceName string, options *IspCustomersClientGetOptions) (IspCustomersClientGetResponse, error) { + var err error + const operationName = "IspCustomersClient.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, customerResourceName, options) + if err != nil { + return IspCustomersClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return IspCustomersClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return IspCustomersClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *IspCustomersClient) getCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, _ *IspCustomersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/ispCustomers/{customerResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + 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-05-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 *IspCustomersClient) getHandleResponse(resp *http.Response) (IspCustomersClientGetResponse, error) { + result := IspCustomersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.IspCustomerResource); err != nil { + return IspCustomersClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - This api gets the information about all ispCustomer resources under the given subscription +// and resource group +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - IspCustomersClientListByResourceGroupOptions contains the optional parameters for the IspCustomersClient.NewListByResourceGroupPager +// method. +func (client *IspCustomersClient) NewListByResourceGroupPager(resourceGroupName string, options *IspCustomersClientListByResourceGroupOptions) *runtime.Pager[IspCustomersClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[IspCustomersClientListByResourceGroupResponse]{ + More: func(page IspCustomersClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *IspCustomersClientListByResourceGroupResponse) (IspCustomersClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "IspCustomersClient.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 IspCustomersClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *IspCustomersClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *IspCustomersClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/ispCustomers" + 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-05-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 *IspCustomersClient) listByResourceGroupHandleResponse(resp *http.Response) (IspCustomersClientListByResourceGroupResponse, error) { + result := IspCustomersClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.IspCustomerResourceListResult); err != nil { + return IspCustomersClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - This api gets information about all ispCustomer resources under the given subscription +// +// Generated from API version 2023-05-01-preview +// - options - IspCustomersClientListBySubscriptionOptions contains the optional parameters for the IspCustomersClient.NewListBySubscriptionPager +// method. +func (client *IspCustomersClient) NewListBySubscriptionPager(options *IspCustomersClientListBySubscriptionOptions) *runtime.Pager[IspCustomersClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[IspCustomersClientListBySubscriptionResponse]{ + More: func(page IspCustomersClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *IspCustomersClientListBySubscriptionResponse) (IspCustomersClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "IspCustomersClient.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 IspCustomersClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *IspCustomersClient) listBySubscriptionCreateRequest(ctx context.Context, _ *IspCustomersClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ConnectedCache/ispCustomers" + 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-05-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 *IspCustomersClient) listBySubscriptionHandleResponse(resp *http.Response) (IspCustomersClientListBySubscriptionResponse, error) { + result := IspCustomersClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.IspCustomerResourceListResult); err != nil { + return IspCustomersClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// Update - This api updates an existing ispCustomer resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - customerResourceName - Name of the Customer resource +// - properties - The resource properties to be updated. +// - options - IspCustomersClientUpdateOptions contains the optional parameters for the IspCustomersClient.Update method. +func (client *IspCustomersClient) Update(ctx context.Context, resourceGroupName string, customerResourceName string, properties PatchResource, options *IspCustomersClientUpdateOptions) (IspCustomersClientUpdateResponse, error) { + var err error + const operationName = "IspCustomersClient.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, customerResourceName, properties, options) + if err != nil { + return IspCustomersClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return IspCustomersClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return IspCustomersClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *IspCustomersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, customerResourceName string, properties PatchResource, _ *IspCustomersClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedCache/ispCustomers/{customerResourceName}" + 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 customerResourceName == "" { + return nil, errors.New("parameter customerResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerResourceName}", url.PathEscape(customerResourceName)) + 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-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *IspCustomersClient) updateHandleResponse(resp *http.Response) (IspCustomersClientUpdateResponse, error) { + result := IspCustomersClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.IspCustomerResource); err != nil { + return IspCustomersClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/ispcustomers_client_example_test.go b/sdk/resourcemanager/connectedcache/armconnectedcache/ispcustomers_client_example_test.go new file mode 100644 index 000000000000..f03849689aa1 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/ispcustomers_client_example_test.go @@ -0,0 +1,770 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armconnectedcache_test + +import ( + "context" + "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/connectedcache/armconnectedcache" + "log" + "time" +) + +// Generated from example definition: 2023-05-01-preview/IspCustomers_CreateOrUpdate_MaximumSet_Gen.json +func ExampleIspCustomersClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewIspCustomersClient().BeginCreateOrUpdate(ctx, "rgConnectedCache", "MccRPTest2", armconnectedcache.IspCustomerResource{ + Location: to.Ptr("westus"), + Properties: &armconnectedcache.CustomerProperty{ + Customer: &armconnectedcache.CustomerEntity{ + FullyQualifiedResourceID: to.Ptr("uqsbtgae"), + CustomerName: to.Ptr("mkpzynfqihnjfdbaqbqwyhd"), + ContactEmail: to.Ptr("xquos"), + ContactPhone: to.Ptr("vue"), + ContactName: to.Ptr("wxyqjoyoscmvimgwhpitxky"), + IsEntitled: to.Ptr(true), + ReleaseVersion: to.Ptr[int32](20), + ClientTenantID: to.Ptr("fproidkpgvpdnac"), + IsEnterpriseManaged: to.Ptr(true), + ShouldMigrate: to.Ptr(true), + ResendSignupCode: to.Ptr(true), + VerifySignupCode: to.Ptr(true), + VerifySignupPhrase: to.Ptr("tprjvttkgmrqlsyicnidhm"), + }, + AdditionalCustomerProperties: &armconnectedcache.AdditionalCustomerProperties{ + CustomerEmail: to.Ptr("zdjgibsidydyzm"), + CustomerTransitAsn: to.Ptr("habgklnxqzmozqpazoyejwiphezpi"), + CustomerAsn: to.Ptr("hgrelgnrtdkleisnepfolu"), + CustomerEntitlementSKUID: to.Ptr("b"), + CustomerEntitlementSKUGUID: to.Ptr("rvzmdpxyflgqetvpwupnfaxsweiiz"), + CustomerEntitlementSKUName: to.Ptr("waaqfijr"), + CustomerEntitlementExpiration: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t }()), + OptionalProperty1: to.Ptr("qhmwxza"), + OptionalProperty2: to.Ptr("l"), + OptionalProperty3: to.Ptr("mblwwvbie"), + OptionalProperty4: to.Ptr("vzuek"), + OptionalProperty5: to.Ptr("fzjodscdfcdr"), + }, + Error: &armconnectedcache.ErrorDetail{}, + }, + Tags: map[string]*string{ + "key1878": to.Ptr("warz"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %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 = armconnectedcache.IspCustomersClientCreateOrUpdateResponse{ + // IspCustomerResource: &armconnectedcache.IspCustomerResource{ + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/ispCustomers/MccRPTest2"), + // Name: to.Ptr("MCCTPTest2"), + // Type: to.Ptr("Microsoft.ConnectedCache/ispCustomers"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CustomerProperty{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // Customer: &armconnectedcache.CustomerEntity{ + // FullyQualifiedResourceID: to.Ptr("uqsbtgae"), + // CustomerID: to.Ptr("nqxuzybu"), + // CustomerName: to.Ptr("mkpzynfqihnjfdbaqbqwyhd"), + // ContactEmail: to.Ptr("xquos"), + // ContactPhone: to.Ptr("vue"), + // ContactName: to.Ptr("wxyqjoyoscmvimgwhpitxky"), + // IsEntitled: to.Ptr(true), + // ReleaseVersion: to.Ptr[int32](20), + // CreateAsyncOperationID: to.Ptr("zjpvgirzxecwmnfyofqkikst"), + // DeleteAsyncOperationID: to.Ptr("ajtdyoyecybeaxzyztjkvvtx"), + // ClientTenantID: to.Ptr("fproidkpgvpdnac"), + // SynchWithAzureAttemptsCount: to.Ptr[int32](17), + // LastSyncWithAzureTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // IsEnterpriseManaged: to.Ptr(true), + // ShouldMigrate: to.Ptr(true), + // ResendSignupCode: to.Ptr(true), + // VerifySignupCode: to.Ptr(true), + // }, + // AdditionalCustomerProperties: &armconnectedcache.AdditionalCustomerProperties{ + // PeeringDbLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheEfficiency: to.Ptr[float32](20), + // CustomerPropertiesOverviewAverageEgressMbps: to.Ptr[float32](8), + // CustomerPropertiesOverviewAverageMissMbps: to.Ptr[float32](19), + // CustomerPropertiesOverviewEgressMbpsMax: to.Ptr[float32](15), + // CustomerPropertiesOverviewEgressMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewMissMbpsMax: to.Ptr[float32](28), + // CustomerPropertiesOverviewMissMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheNodesHealthyCount: to.Ptr[int32](24), + // CustomerPropertiesOverviewCacheNodesUnhealthyCount: to.Ptr[int32](15), + // SignupStatus: to.Ptr(true), + // SignupStatusCode: to.Ptr[int32](21), + // SignupStatusText: to.Ptr("dccv"), + // SignupPhaseStatusCode: to.Ptr[int32](4), + // SignupPhaseStatusText: to.Ptr("q"), + // PeeringDbLastUpdateDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerOrgName: to.Ptr("nshrwjhhggmdaqlpc"), + // CustomerEmail: to.Ptr("zdjgibsidydyzm"), + // CustomerTransitAsn: to.Ptr("habgklnxqzmozqpazoyejwiphezpi"), + // CustomerAsn: to.Ptr("hgrelgnrtdkleisnepfolu"), + // CustomerAsnEstimatedEgressPeekGbps: to.Ptr[float32](10), + // CustomerEntitlementSKUID: to.Ptr("b"), + // CustomerEntitlementSKUGUID: to.Ptr("rvzmdpxyflgqetvpwupnfaxsweiiz"), + // CustomerEntitlementSKUName: to.Ptr("waaqfijr"), + // CustomerEntitlementExpiration: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // OptionalProperty1: to.Ptr("qhmwxza"), + // OptionalProperty2: to.Ptr("l"), + // OptionalProperty3: to.Ptr("mblwwvbie"), + // OptionalProperty4: to.Ptr("vzuek"), + // OptionalProperty5: to.Ptr("fzjodscdfcdr"), + // }, + // StatusCode: to.Ptr("jax"), + // StatusText: to.Ptr("vsqydgruhuwuyipsplylgiqmkcv"), + // StatusDetails: to.Ptr("wmtksbahlbxrzaksogdbozfi"), + // Status: to.Ptr("rhfjbcr"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key1878": to.Ptr("warz"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2023-05-01-preview/IspCustomers_Delete_MaximumSet_Gen.json +func ExampleIspCustomersClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewIspCustomersClient().BeginDelete(ctx, "rgConnectedCache", "hdontfoythjsaeyjhrakckgimgchxwzttbcnvntpvdsgeumxpgnjurptd", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: 2023-05-01-preview/IspCustomers_Get_MaximumSet_Gen.json +func ExampleIspCustomersClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewIspCustomersClient().Get(ctx, "rgConnectedCache", "cmcjfueweicolcjkwmsuvcj", 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 = armconnectedcache.IspCustomersClientGetResponse{ + // IspCustomerResource: &armconnectedcache.IspCustomerResource{ + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/ispCustomers/MccRPTest2"), + // Name: to.Ptr("MCCTPTest2"), + // Type: to.Ptr("Microsoft.ConnectedCache/ispCustomers"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CustomerProperty{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // Customer: &armconnectedcache.CustomerEntity{ + // FullyQualifiedResourceID: to.Ptr("uqsbtgae"), + // CustomerID: to.Ptr("nqxuzybu"), + // CustomerName: to.Ptr("mkpzynfqihnjfdbaqbqwyhd"), + // ContactEmail: to.Ptr("xquos"), + // ContactPhone: to.Ptr("vue"), + // ContactName: to.Ptr("wxyqjoyoscmvimgwhpitxky"), + // IsEntitled: to.Ptr(true), + // ReleaseVersion: to.Ptr[int32](20), + // CreateAsyncOperationID: to.Ptr("zjpvgirzxecwmnfyofqkikst"), + // DeleteAsyncOperationID: to.Ptr("ajtdyoyecybeaxzyztjkvvtx"), + // ClientTenantID: to.Ptr("fproidkpgvpdnac"), + // SynchWithAzureAttemptsCount: to.Ptr[int32](17), + // LastSyncWithAzureTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // IsEnterpriseManaged: to.Ptr(true), + // ShouldMigrate: to.Ptr(true), + // VerifySignupCode: to.Ptr(true), + // }, + // AdditionalCustomerProperties: &armconnectedcache.AdditionalCustomerProperties{ + // PeeringDbLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheEfficiency: to.Ptr[float32](20), + // CustomerPropertiesOverviewAverageEgressMbps: to.Ptr[float32](8), + // CustomerPropertiesOverviewAverageMissMbps: to.Ptr[float32](19), + // CustomerPropertiesOverviewEgressMbpsMax: to.Ptr[float32](15), + // CustomerPropertiesOverviewEgressMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewMissMbpsMax: to.Ptr[float32](28), + // CustomerPropertiesOverviewMissMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheNodesHealthyCount: to.Ptr[int32](24), + // CustomerPropertiesOverviewCacheNodesUnhealthyCount: to.Ptr[int32](15), + // SignupStatus: to.Ptr(true), + // SignupStatusCode: to.Ptr[int32](21), + // SignupStatusText: to.Ptr("dccv"), + // SignupPhaseStatusCode: to.Ptr[int32](4), + // SignupPhaseStatusText: to.Ptr("q"), + // PeeringDbLastUpdateDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerOrgName: to.Ptr("nshrwjhhggmdaqlpc"), + // CustomerEmail: to.Ptr("zdjgibsidydyzm"), + // CustomerTransitAsn: to.Ptr("habgklnxqzmozqpazoyejwiphezpi"), + // CustomerAsn: to.Ptr("hgrelgnrtdkleisnepfolu"), + // CustomerAsnEstimatedEgressPeekGbps: to.Ptr[float32](10), + // CustomerEntitlementSKUID: to.Ptr("b"), + // CustomerEntitlementSKUGUID: to.Ptr("rvzmdpxyflgqetvpwupnfaxsweiiz"), + // CustomerEntitlementSKUName: to.Ptr("waaqfijr"), + // CustomerEntitlementExpiration: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // OptionalProperty1: to.Ptr("qhmwxza"), + // OptionalProperty2: to.Ptr("l"), + // OptionalProperty3: to.Ptr("mblwwvbie"), + // OptionalProperty4: to.Ptr("vzuek"), + // OptionalProperty5: to.Ptr("fzjodscdfcdr"), + // }, + // StatusCode: to.Ptr("jax"), + // StatusText: to.Ptr("vsqydgruhuwuyipsplylgiqmkcv"), + // StatusDetails: to.Ptr("wmtksbahlbxrzaksogdbozfi"), + // Status: to.Ptr("rhfjbcr"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key1878": to.Ptr("warz"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2023-05-01-preview/IspCustomers_ListByResourceGroup_MaximumSet_Gen.json +func ExampleIspCustomersClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewIspCustomersClient().NewListByResourceGroupPager("rgConnectedCache", 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 = armconnectedcache.IspCustomersClientListByResourceGroupResponse{ + // IspCustomerResourceListResult: armconnectedcache.IspCustomerResourceListResult{ + // Value: []*armconnectedcache.IspCustomerResource{ + // { + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/ispCustomers/MccRPTest2"), + // Name: to.Ptr("MCCTPTest2"), + // Type: to.Ptr("Microsoft.ConnectedCache/ispCustomers"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CustomerProperty{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // Customer: &armconnectedcache.CustomerEntity{ + // FullyQualifiedResourceID: to.Ptr("uqsbtgae"), + // CustomerID: to.Ptr("nqxuzybu"), + // CustomerName: to.Ptr("mkpzynfqihnjfdbaqbqwyhd"), + // ContactEmail: to.Ptr("xquos"), + // ContactPhone: to.Ptr("vue"), + // ContactName: to.Ptr("wxyqjoyoscmvimgwhpitxky"), + // IsEntitled: to.Ptr(true), + // ReleaseVersion: to.Ptr[int32](20), + // CreateAsyncOperationID: to.Ptr("zjpvgirzxecwmnfyofqkikst"), + // DeleteAsyncOperationID: to.Ptr("ajtdyoyecybeaxzyztjkvvtx"), + // ClientTenantID: to.Ptr("fproidkpgvpdnac"), + // SynchWithAzureAttemptsCount: to.Ptr[int32](17), + // LastSyncWithAzureTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // IsEnterpriseManaged: to.Ptr(true), + // ShouldMigrate: to.Ptr(true), + // ResendSignupCode: to.Ptr(true), + // VerifySignupCode: to.Ptr(true), + // }, + // AdditionalCustomerProperties: &armconnectedcache.AdditionalCustomerProperties{ + // PeeringDbLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheEfficiency: to.Ptr[float32](20), + // CustomerPropertiesOverviewAverageEgressMbps: to.Ptr[float32](8), + // CustomerPropertiesOverviewAverageMissMbps: to.Ptr[float32](19), + // CustomerPropertiesOverviewEgressMbpsMax: to.Ptr[float32](15), + // CustomerPropertiesOverviewEgressMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewMissMbpsMax: to.Ptr[float32](28), + // CustomerPropertiesOverviewMissMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheNodesHealthyCount: to.Ptr[int32](24), + // CustomerPropertiesOverviewCacheNodesUnhealthyCount: to.Ptr[int32](15), + // SignupStatus: to.Ptr(true), + // SignupStatusCode: to.Ptr[int32](21), + // SignupStatusText: to.Ptr("dccv"), + // SignupPhaseStatusCode: to.Ptr[int32](4), + // SignupPhaseStatusText: to.Ptr("q"), + // PeeringDbLastUpdateDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerOrgName: to.Ptr("nshrwjhhggmdaqlpc"), + // CustomerEmail: to.Ptr("zdjgibsidydyzm"), + // CustomerTransitAsn: to.Ptr("habgklnxqzmozqpazoyejwiphezpi"), + // CustomerAsn: to.Ptr("hgrelgnrtdkleisnepfolu"), + // CustomerAsnEstimatedEgressPeekGbps: to.Ptr[float32](10), + // CustomerEntitlementSKUID: to.Ptr("b"), + // CustomerEntitlementSKUGUID: to.Ptr("rvzmdpxyflgqetvpwupnfaxsweiiz"), + // CustomerEntitlementSKUName: to.Ptr("waaqfijr"), + // CustomerEntitlementExpiration: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // OptionalProperty1: to.Ptr("qhmwxza"), + // OptionalProperty2: to.Ptr("l"), + // OptionalProperty3: to.Ptr("mblwwvbie"), + // OptionalProperty4: to.Ptr("vzuek"), + // OptionalProperty5: to.Ptr("fzjodscdfcdr"), + // }, + // StatusCode: to.Ptr("jax"), + // StatusText: to.Ptr("vsqydgruhuwuyipsplylgiqmkcv"), + // StatusDetails: to.Ptr("wmtksbahlbxrzaksogdbozfi"), + // Status: to.Ptr("rhfjbcr"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key1878": to.Ptr("warz"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // { + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/DoTest/providers/Microsoft.ConnectedCache/ispCustomers/MccRPTest1"), + // Name: to.Ptr("MCCTPTest1"), + // Type: to.Ptr("Microsoft.ConnectedCache/ispCustomers"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CustomerProperty{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // Customer: &armconnectedcache.CustomerEntity{ + // FullyQualifiedResourceID: to.Ptr("uqsbtgae"), + // CustomerID: to.Ptr("nqxuzybu"), + // CustomerName: to.Ptr("mkpzynfqihnjfdbaqbqwyhd"), + // ContactEmail: to.Ptr("xquos"), + // ContactPhone: to.Ptr("vue"), + // ContactName: to.Ptr("wxyqjoyoscmvimgwhpitxky"), + // IsEntitled: to.Ptr(true), + // ReleaseVersion: to.Ptr[int32](20), + // CreateAsyncOperationID: to.Ptr("zjpvgirzxecwmnfyofqkikst"), + // DeleteAsyncOperationID: to.Ptr("ajtdyoyecybeaxzyztjkvvtx"), + // ClientTenantID: to.Ptr("fproidkpgvpdnac"), + // SynchWithAzureAttemptsCount: to.Ptr[int32](17), + // LastSyncWithAzureTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // IsEnterpriseManaged: to.Ptr(true), + // ShouldMigrate: to.Ptr(true), + // ResendSignupCode: to.Ptr(true), + // VerifySignupCode: to.Ptr(true), + // }, + // AdditionalCustomerProperties: &armconnectedcache.AdditionalCustomerProperties{ + // PeeringDbLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheEfficiency: to.Ptr[float32](20), + // CustomerPropertiesOverviewAverageEgressMbps: to.Ptr[float32](8), + // CustomerPropertiesOverviewAverageMissMbps: to.Ptr[float32](19), + // CustomerPropertiesOverviewEgressMbpsMax: to.Ptr[float32](15), + // CustomerPropertiesOverviewEgressMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewMissMbpsMax: to.Ptr[float32](28), + // CustomerPropertiesOverviewMissMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheNodesHealthyCount: to.Ptr[int32](24), + // CustomerPropertiesOverviewCacheNodesUnhealthyCount: to.Ptr[int32](15), + // SignupStatus: to.Ptr(true), + // SignupStatusCode: to.Ptr[int32](21), + // SignupStatusText: to.Ptr("dccv"), + // SignupPhaseStatusCode: to.Ptr[int32](4), + // SignupPhaseStatusText: to.Ptr("q"), + // PeeringDbLastUpdateDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerOrgName: to.Ptr("nshrwjhhggmdaqlpc"), + // CustomerEmail: to.Ptr("zdjgibsidydyzm"), + // CustomerTransitAsn: to.Ptr("habgklnxqzmozqpazoyejwiphezpi"), + // CustomerAsn: to.Ptr("hgrelgnrtdkleisnepfolu"), + // CustomerAsnEstimatedEgressPeekGbps: to.Ptr[float32](10), + // CustomerEntitlementSKUID: to.Ptr("b"), + // CustomerEntitlementSKUGUID: to.Ptr("rvzmdpxyflgqetvpwupnfaxsweiiz"), + // CustomerEntitlementSKUName: to.Ptr("waaqfijr"), + // CustomerEntitlementExpiration: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // OptionalProperty1: to.Ptr("qhmwxza"), + // OptionalProperty2: to.Ptr("l"), + // OptionalProperty3: to.Ptr("mblwwvbie"), + // OptionalProperty4: to.Ptr("vzuek"), + // OptionalProperty5: to.Ptr("fzjodscdfcdr"), + // }, + // StatusCode: to.Ptr("oytrfgfhk"), + // StatusText: to.Ptr("pqitblihwfrq"), + // StatusDetails: to.Ptr("kvxqjbldcwqgslerajc"), + // Status: to.Ptr("stwi"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key2096": to.Ptr("uzoqqgqnnaiagdqilrjiezogx"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/ao"), + // }, + // } + } +} + +// Generated from example definition: 2023-05-01-preview/IspCustomers_ListBySubscription_MaximumSet_Gen.json +func ExampleIspCustomersClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewIspCustomersClient().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 = armconnectedcache.IspCustomersClientListBySubscriptionResponse{ + // IspCustomerResourceListResult: armconnectedcache.IspCustomerResourceListResult{ + // Value: []*armconnectedcache.IspCustomerResource{ + // { + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/ispCustomers/MccRPTest2"), + // Name: to.Ptr("MCCTPTest2"), + // Type: to.Ptr("Microsoft.ConnectedCache/ispCustomers"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CustomerProperty{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // Customer: &armconnectedcache.CustomerEntity{ + // FullyQualifiedResourceID: to.Ptr("uqsbtgae"), + // CustomerID: to.Ptr("nqxuzybu"), + // CustomerName: to.Ptr("mkpzynfqihnjfdbaqbqwyhd"), + // ContactEmail: to.Ptr("xquos"), + // ContactPhone: to.Ptr("vue"), + // ContactName: to.Ptr("wxyqjoyoscmvimgwhpitxky"), + // IsEntitled: to.Ptr(true), + // ReleaseVersion: to.Ptr[int32](20), + // CreateAsyncOperationID: to.Ptr("zjpvgirzxecwmnfyofqkikst"), + // DeleteAsyncOperationID: to.Ptr("ajtdyoyecybeaxzyztjkvvtx"), + // ClientTenantID: to.Ptr("fproidkpgvpdnac"), + // SynchWithAzureAttemptsCount: to.Ptr[int32](17), + // LastSyncWithAzureTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // IsEnterpriseManaged: to.Ptr(true), + // ShouldMigrate: to.Ptr(true), + // ResendSignupCode: to.Ptr(true), + // VerifySignupCode: to.Ptr(true), + // }, + // AdditionalCustomerProperties: &armconnectedcache.AdditionalCustomerProperties{ + // PeeringDbLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheEfficiency: to.Ptr[float32](20), + // CustomerPropertiesOverviewAverageEgressMbps: to.Ptr[float32](8), + // CustomerPropertiesOverviewAverageMissMbps: to.Ptr[float32](19), + // CustomerPropertiesOverviewEgressMbpsMax: to.Ptr[float32](15), + // CustomerPropertiesOverviewEgressMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewMissMbpsMax: to.Ptr[float32](28), + // CustomerPropertiesOverviewMissMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheNodesHealthyCount: to.Ptr[int32](24), + // CustomerPropertiesOverviewCacheNodesUnhealthyCount: to.Ptr[int32](15), + // SignupStatus: to.Ptr(true), + // SignupStatusCode: to.Ptr[int32](21), + // SignupStatusText: to.Ptr("dccv"), + // SignupPhaseStatusCode: to.Ptr[int32](4), + // SignupPhaseStatusText: to.Ptr("q"), + // PeeringDbLastUpdateDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerOrgName: to.Ptr("nshrwjhhggmdaqlpc"), + // CustomerEmail: to.Ptr("zdjgibsidydyzm"), + // CustomerTransitAsn: to.Ptr("habgklnxqzmozqpazoyejwiphezpi"), + // CustomerAsn: to.Ptr("hgrelgnrtdkleisnepfolu"), + // CustomerAsnEstimatedEgressPeekGbps: to.Ptr[float32](10), + // CustomerEntitlementSKUID: to.Ptr("b"), + // CustomerEntitlementSKUGUID: to.Ptr("rvzmdpxyflgqetvpwupnfaxsweiiz"), + // CustomerEntitlementSKUName: to.Ptr("waaqfijr"), + // CustomerEntitlementExpiration: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // OptionalProperty1: to.Ptr("qhmwxza"), + // OptionalProperty2: to.Ptr("l"), + // OptionalProperty3: to.Ptr("mblwwvbie"), + // OptionalProperty4: to.Ptr("vzuek"), + // OptionalProperty5: to.Ptr("fzjodscdfcdr"), + // }, + // StatusCode: to.Ptr("jax"), + // StatusText: to.Ptr("vsqydgruhuwuyipsplylgiqmkcv"), + // StatusDetails: to.Ptr("wmtksbahlbxrzaksogdbozfi"), + // Status: to.Ptr("rhfjbcr"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key1878": to.Ptr("warz"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // { + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/DoTest/providers/Microsoft.ConnectedCache/ispCustomers/MccRPTest1"), + // Name: to.Ptr("MCCTPTest1"), + // Type: to.Ptr("Microsoft.ConnectedCache/ispCustomers"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CustomerProperty{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // Customer: &armconnectedcache.CustomerEntity{ + // FullyQualifiedResourceID: to.Ptr("uqsbtgae"), + // CustomerID: to.Ptr("nqxuzybu"), + // CustomerName: to.Ptr("mkpzynfqihnjfdbaqbqwyhd"), + // ContactEmail: to.Ptr("xquos"), + // ContactPhone: to.Ptr("vue"), + // ContactName: to.Ptr("wxyqjoyoscmvimgwhpitxky"), + // IsEntitled: to.Ptr(true), + // ReleaseVersion: to.Ptr[int32](20), + // CreateAsyncOperationID: to.Ptr("zjpvgirzxecwmnfyofqkikst"), + // DeleteAsyncOperationID: to.Ptr("ajtdyoyecybeaxzyztjkvvtx"), + // ClientTenantID: to.Ptr("fproidkpgvpdnac"), + // SynchWithAzureAttemptsCount: to.Ptr[int32](17), + // LastSyncWithAzureTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // IsEnterpriseManaged: to.Ptr(true), + // ShouldMigrate: to.Ptr(true), + // ResendSignupCode: to.Ptr(true), + // VerifySignupCode: to.Ptr(true), + // }, + // AdditionalCustomerProperties: &armconnectedcache.AdditionalCustomerProperties{ + // PeeringDbLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheEfficiency: to.Ptr[float32](20), + // CustomerPropertiesOverviewAverageEgressMbps: to.Ptr[float32](8), + // CustomerPropertiesOverviewAverageMissMbps: to.Ptr[float32](19), + // CustomerPropertiesOverviewEgressMbpsMax: to.Ptr[float32](15), + // CustomerPropertiesOverviewEgressMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewMissMbpsMax: to.Ptr[float32](28), + // CustomerPropertiesOverviewMissMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheNodesHealthyCount: to.Ptr[int32](24), + // CustomerPropertiesOverviewCacheNodesUnhealthyCount: to.Ptr[int32](15), + // SignupStatus: to.Ptr(true), + // SignupStatusCode: to.Ptr[int32](21), + // SignupStatusText: to.Ptr("dccv"), + // SignupPhaseStatusCode: to.Ptr[int32](4), + // SignupPhaseStatusText: to.Ptr("q"), + // PeeringDbLastUpdateDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerOrgName: to.Ptr("nshrwjhhggmdaqlpc"), + // CustomerEmail: to.Ptr("zdjgibsidydyzm"), + // CustomerTransitAsn: to.Ptr("habgklnxqzmozqpazoyejwiphezpi"), + // CustomerAsn: to.Ptr("hgrelgnrtdkleisnepfolu"), + // CustomerAsnEstimatedEgressPeekGbps: to.Ptr[float32](10), + // CustomerEntitlementSKUID: to.Ptr("b"), + // CustomerEntitlementSKUGUID: to.Ptr("rvzmdpxyflgqetvpwupnfaxsweiiz"), + // CustomerEntitlementSKUName: to.Ptr("waaqfijr"), + // CustomerEntitlementExpiration: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // OptionalProperty1: to.Ptr("qhmwxza"), + // OptionalProperty2: to.Ptr("l"), + // OptionalProperty3: to.Ptr("mblwwvbie"), + // OptionalProperty4: to.Ptr("vzuek"), + // OptionalProperty5: to.Ptr("fzjodscdfcdr"), + // }, + // StatusCode: to.Ptr("oytrfgfhk"), + // StatusText: to.Ptr("pqitblihwfrq"), + // StatusDetails: to.Ptr("kvxqjbldcwqgslerajc"), + // Status: to.Ptr("stwi"), + // Error: &armconnectedcache.ErrorDetail{ + // Code: to.Ptr("dkvgvtftpsjsbhlnapvihefxneoggs"), + // Message: to.Ptr("okakgyfnmyob"), + // Details: []*armconnectedcache.ErrorDetail{ + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key2096": to.Ptr("uzoqqgqnnaiagdqilrjiezogx"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/ao"), + // }, + // } + } +} + +// Generated from example definition: 2023-05-01-preview/IspCustomers_Update_MaximumSet_Gen.json +func ExampleIspCustomersClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armconnectedcache.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewIspCustomersClient().Update(ctx, "rgConnectedCache", "MccRPTest2", armconnectedcache.PatchResource{ + Tags: map[string]*string{ + "key1653": to.Ptr("nzjczrhclhkndesgy"), + }, + }, 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 = armconnectedcache.IspCustomersClientUpdateResponse{ + // IspCustomerResource: &armconnectedcache.IspCustomerResource{ + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rgConnectedCache/providers/Microsoft.ConnectedCache/ispCustomers/MccRPTest2"), + // Name: to.Ptr("MCCTPTest2"), + // Type: to.Ptr("Microsoft.ConnectedCache/ispCustomers"), + // Location: to.Ptr("westus"), + // Properties: &armconnectedcache.CustomerProperty{ + // ProvisioningState: to.Ptr(armconnectedcache.ProvisioningStateSucceeded), + // Customer: &armconnectedcache.CustomerEntity{ + // FullyQualifiedResourceID: to.Ptr("uqsbtgae"), + // CustomerID: to.Ptr("nqxuzybu"), + // CustomerName: to.Ptr("mkpzynfqihnjfdbaqbqwyhd"), + // ContactEmail: to.Ptr("xquos"), + // ContactPhone: to.Ptr("vue"), + // ContactName: to.Ptr("wxyqjoyoscmvimgwhpitxky"), + // IsEntitled: to.Ptr(true), + // ReleaseVersion: to.Ptr[int32](20), + // CreateAsyncOperationID: to.Ptr("zjpvgirzxecwmnfyofqkikst"), + // DeleteAsyncOperationID: to.Ptr("ajtdyoyecybeaxzyztjkvvtx"), + // ClientTenantID: to.Ptr("fproidkpgvpdnac"), + // SynchWithAzureAttemptsCount: to.Ptr[int32](17), + // LastSyncWithAzureTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.777Z"); return t}()), + // IsEnterpriseManaged: to.Ptr(true), + // ShouldMigrate: to.Ptr(true), + // ResendSignupCode: to.Ptr(true), + // VerifySignupCode: to.Ptr(true), + // }, + // AdditionalCustomerProperties: &armconnectedcache.AdditionalCustomerProperties{ + // PeeringDbLastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheEfficiency: to.Ptr[float32](20), + // CustomerPropertiesOverviewAverageEgressMbps: to.Ptr[float32](8), + // CustomerPropertiesOverviewAverageMissMbps: to.Ptr[float32](19), + // CustomerPropertiesOverviewEgressMbpsMax: to.Ptr[float32](15), + // CustomerPropertiesOverviewEgressMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewMissMbpsMax: to.Ptr[float32](28), + // CustomerPropertiesOverviewMissMbpsMaxDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerPropertiesOverviewCacheNodesHealthyCount: to.Ptr[int32](24), + // CustomerPropertiesOverviewCacheNodesUnhealthyCount: to.Ptr[int32](15), + // SignupStatus: to.Ptr(true), + // SignupStatusCode: to.Ptr[int32](21), + // SignupStatusText: to.Ptr("dccv"), + // SignupPhaseStatusCode: to.Ptr[int32](4), + // SignupPhaseStatusText: to.Ptr("q"), + // PeeringDbLastUpdateDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // CustomerOrgName: to.Ptr("nshrwjhhggmdaqlpc"), + // CustomerEmail: to.Ptr("zdjgibsidydyzm"), + // CustomerTransitAsn: to.Ptr("habgklnxqzmozqpazoyejwiphezpi"), + // CustomerAsn: to.Ptr("hgrelgnrtdkleisnepfolu"), + // CustomerAsnEstimatedEgressPeekGbps: to.Ptr[float32](10), + // CustomerEntitlementSKUID: to.Ptr("b"), + // CustomerEntitlementSKUGUID: to.Ptr("rvzmdpxyflgqetvpwupnfaxsweiiz"), + // CustomerEntitlementSKUName: to.Ptr("waaqfijr"), + // CustomerEntitlementExpiration: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.773Z"); return t}()), + // OptionalProperty1: to.Ptr("qhmwxza"), + // OptionalProperty2: to.Ptr("l"), + // OptionalProperty3: to.Ptr("mblwwvbie"), + // OptionalProperty4: to.Ptr("vzuek"), + // OptionalProperty5: to.Ptr("fzjodscdfcdr"), + // }, + // StatusCode: to.Ptr("jax"), + // StatusText: to.Ptr("vsqydgruhuwuyipsplylgiqmkcv"), + // StatusDetails: to.Ptr("wmtksbahlbxrzaksogdbozfi"), + // Status: to.Ptr("rhfjbcr"), + // }, + // Tags: map[string]*string{ + // "key1878": to.Ptr("warz"), + // }, + // SystemData: &armconnectedcache.SystemData{ + // CreatedBy: to.Ptr("gambtqj"), + // CreatedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // LastModifiedBy: to.Ptr("qomgaceiessgnuogz"), + // LastModifiedByType: to.Ptr(armconnectedcache.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-30T00:54:04.771Z"); return t}()), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/models.go b/sdk/resourcemanager/connectedcache/armconnectedcache/models.go new file mode 100644 index 000000000000..0809ee407c17 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/models.go @@ -0,0 +1,897 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armconnectedcache + +import "time" + +// AdditionalCacheNodeProperties - Model representing cache node for connected cache resource +type AdditionalCacheNodeProperties struct { + // Auto update or fast update version + AutoUpdateVersion *string + + // Cache node resource Bgp configuration. + BgpConfiguration *BgpConfiguration + + // issues list to return the issues as part of the additional cache node properties + CacheNodePropertiesDetailsIssuesList []*string + + // Cache node resource drive configurations. + DriveConfiguration []*CacheNodeDriveConfiguration + + // Cache node resource requires a proxy + IsProxyRequired *ProxyRequired + + // Operating system of the cache node + OSType *OsType + + // Optional property #1 of Mcc response object + OptionalProperty1 *string + + // Optional property #2 of Mcc response object + OptionalProperty2 *string + + // Optional property #3 of Mcc response object + OptionalProperty3 *string + + // Optional property #4 of Mcc response object + OptionalProperty4 *string + + // Optional property #5 of Mcc response object + OptionalProperty5 *string + + // Cache node resource Mcc proxy Url + ProxyURL *string + + // proxyUrl configuration of the cache node + ProxyURLConfiguration *ProxyURLConfiguration + + // Update Cycle Type + UpdateCycleType *CycleType + + // Update related information details + UpdateInfoDetails *string + + // customer requested date time for mcc install of update cycle + UpdateRequestedDateTime *time.Time + + // READ-ONLY; Cache node resource aggregated status code. + AggregatedStatusCode *int32 + + // READ-ONLY; Cache node resource aggregated status details. + AggregatedStatusDetails *string + + // READ-ONLY; Cache node resource aggregated status text. + AggregatedStatusText *string + + // READ-ONLY; Auto update version that is the applied to update on mcc cache node + AutoUpdateAppliedVersion *string + + // READ-ONLY; Auto update last applied date time of mcc install + AutoUpdateLastAppliedDateTime *time.Time + + // READ-ONLY; Auto Update status details from the backend after applying the new version details + AutoUpdateLastAppliedDetails *string + + // READ-ONLY; Last applied auto update state for mcc install of auto update cycle + AutoUpdateLastAppliedState *string + + // READ-ONLY; Auto update last triggered date time of mcc install + AutoUpdateLastTriggeredDateTime *time.Time + + // READ-ONLY; Auto update last applied date time of mcc install + AutoUpdateNextAvailableDateTime *time.Time + + // READ-ONLY; Auto update version that is the Next available version to update on mcc cache node + AutoUpdateNextAvailableVersion *string + + // READ-ONLY; Cache node resource state as integer. + CacheNodeState *int32 + + // READ-ONLY; Cache node resource detailed state text. + CacheNodeStateDetailedText *string + + // READ-ONLY; Cache node resource short state text. + CacheNodeStateShortText *string + + // READ-ONLY; Cache node resource flag indicating if cache node has been physically installed or provisioned on their physical + // lab. + IsProvisioned *bool + + // READ-ONLY; Cache node resource Mcc product version. + ProductVersion *string +} + +// AdditionalCustomerProperties - Model representing customer for connected cache resource +type AdditionalCustomerProperties struct { + // Customer resource Asn (autonomous system number). + CustomerAsn *string + + // Customer resource contact email. + CustomerEmail *string + + // Customer resource entitlement expiration date string. + CustomerEntitlementExpiration *time.Time + + // Customer resource entitlement Sku Guid. + CustomerEntitlementSKUGUID *string + + // Customer resource entitlement Sku Id. + CustomerEntitlementSKUID *string + + // Customer resource entitlement Sku name. + CustomerEntitlementSKUName *string + + // Customer resource transit Asn (autonomous system number). + CustomerTransitAsn *string + + // Customer resource transit state. + CustomerTransitState *CustomerTransitState + + // Optional property #1 of Mcc response object. + OptionalProperty1 *string + + // Optional property #2 of Mcc response object. + OptionalProperty2 *string + + // Optional property #3 of Mcc response object. + OptionalProperty3 *string + + // Optional property #4 of Mcc response object. + OptionalProperty4 *string + + // Optional property #5 of Mcc response object. + OptionalProperty5 *string + + // READ-ONLY; Customer resource estimated Asn peering peak in Gbps. + CustomerAsnEstimatedEgressPeekGbps *float32 + + // READ-ONLY; Customer resource owner organization name. + CustomerOrgName *string + + // READ-ONLY; Customer resource average egress in Mbps. + CustomerPropertiesOverviewAverageEgressMbps *float32 + + // READ-ONLY; Customer resource average cache miss throughput in Mbps. + CustomerPropertiesOverviewAverageMissMbps *float32 + + // READ-ONLY; Customer resource cache efficiency. + CustomerPropertiesOverviewCacheEfficiency *float32 + + // READ-ONLY; Customer resource total healthy cache nodes. + CustomerPropertiesOverviewCacheNodesHealthyCount *int32 + + // READ-ONLY; Customer resource total unhealthy cache nodes. + CustomerPropertiesOverviewCacheNodesUnhealthyCount *int32 + + // READ-ONLY; Customer resource maximum egress in Mbps. + CustomerPropertiesOverviewEgressMbpsMax *float32 + + // READ-ONLY; Customer resource peak egress timestamp. + CustomerPropertiesOverviewEgressMbpsMaxDateTime *time.Time + + // READ-ONLY; Customer resource maximum cache miss throughput in Mbps. + CustomerPropertiesOverviewMissMbpsMax *float32 + + // READ-ONLY; Customer resource peak cache miss throughput timestamp. + CustomerPropertiesOverviewMissMbpsMaxDateTime *time.Time + + // READ-ONLY; Customer resource last PeeringDB update timestamp. + PeeringDbLastUpdateDate *time.Time + + // READ-ONLY; Customer resource last PeeringDB update timestamp. + PeeringDbLastUpdateTime *time.Time + + // READ-ONLY; Customer resource signup phase status code as integer. + SignupPhaseStatusCode *int32 + + // READ-ONLY; Customer resource signup phase status as string text. + SignupPhaseStatusText *string + + // READ-ONLY; Customer resource signup status as boolean. + SignupStatus *bool + + // READ-ONLY; Customer resource signup status as integer code. + SignupStatusCode *int32 + + // READ-ONLY; Customer resource signup status as string text. + SignupStatusText *string +} + +// BgpCidrsConfiguration - Mcc cache node Bgp Cidr details. +type BgpCidrsConfiguration struct { + // READ-ONLY; Mcc cache node Bgp Cidr details. + BgpCidrs []*string +} + +// BgpConfiguration - Bgp configuration of cache node +type BgpConfiguration struct { + // Asn to ip address mapping + AsnToIPAddressMapping *string +} + +// CacheNodeDriveConfiguration - Drive configuration for cache node +type CacheNodeDriveConfiguration struct { + // corresponding nginx cache number. Valid cache numbers are 1 - 20 + CacheNumber *int32 + + // full binding for corresponding nginx cache drive + NginxMapping *string + + // physical path location of the folder used for caching content + PhysicalPath *string + + // physical size of the drive used for caching content + SizeInGb *int32 +} + +// CacheNodeEntity - Model representing Cache Node for ConnectedCache resource +type CacheNodeEntity struct { + // Customer requested day of week for mcc install of auto update cycle + AutoUpdateRequestedDay *int32 + + // Customer requested time of the day for mcc install of auto update cycle, should be hh:mm + AutoUpdateRequestedTime *string + + // Customer requested week of month for mcc install of auto update cycle + AutoUpdateRequestedWeek *int32 + + // Auto Update Ring Type which is slow or fast etc. + AutoUpdateRingType *AutoUpdateRingType + + // Cache node resource identifier of the cache node + CacheNodeID *string + + // Cache node resource name. + CacheNodeName *string + + // Cache node resource comma separated values of Cidrs. + CidrCSV []*string + + // Cache node resource current Cidr range precedence selection type. + CidrSelectionType *int32 + + // Cache node resource customer resource Asn (autonomous system number) + CustomerAsn *int32 + + // Cache node resource customer index as string. + CustomerIndex *string + + // Cache node resource customer resource name. + CustomerName *string + + // FQDN(fully qualified domain name) value of the mcc cache node + FullyQualifiedDomainName *string + + // Cache node resource Azure fully qualified resource Id. + FullyQualifiedResourceID *string + + // Cache node resource Ip address. + IPAddress *string + + // Cache node resource flag for indicating if cache node is enabled. + IsEnabled *bool + + // Cache node resource flag for determining if managed by enterprise as boolean. + IsEnterpriseManaged *bool + + // Cache node resource maximum allowed egress in Mbps. + MaxAllowableEgressInMbps *int32 + + // Cache node resource flag for determining if customer will be migrated. + ShouldMigrate *bool + + // READ-ONLY; Cache node resource total addressable space defined by the Cidr Csv block. + AddressSpace *int32 + + // READ-ONLY; Cache node resource total addressable space defined by Bgp and Cidr Csv blocks. + BgpAddressSpace *int32 + + // READ-ONLY; Cache node resource Bgp block count. + BgpCidrBlocksCount *int32 + + // READ-ONLY; Cache node resource last Bgp Cidr Csv update timestamp + BgpCidrCSVLastUpdateTime *time.Time + + // READ-ONLY; Cache node resource bytes truncated from Bgp output file. + BgpFileBytesTruncated *int32 + + // READ-ONLY; Cache node resource last Bgp report timestamp. + BgpLastReportedTime *time.Time + + // READ-ONLY; Cache node resource Bgp record count. + BgpNumberOfRecords *int32 + + // READ-ONLY; Cache node resource Bgp update count. + BgpNumberOfTimesUpdated *int32 + + // READ-ONLY; Cache node resource Bgp review feedback text. + BgpReviewFeedback *string + + // READ-ONLY; Cache node resource Bgp review state string text. + BgpReviewState *BgpReviewStateEnum + + // READ-ONLY; Cache node resource Bgp review state string text in detail. + BgpReviewStateText *string + + // READ-ONLY; Cache node resource category. + Category *string + + // READ-ONLY; Cache node resource last Cidr Csv update timestamp + CidrCSVLastUpdateTime *time.Time + + // READ-ONLY; Cache node resource customer resource client tenant Id of subscription. + ClientTenantID *string + + // READ-ONLY; Cache node resource configuration state. + ConfigurationState *ConfigurationState + + // READ-ONLY; Cache node resource configuration state text. + ConfigurationStateText *string + + // READ-ONLY; Cache node resource container configuration details. + ContainerConfigurations *string + + // READ-ONLY; Cache node resource Mcc container configuration details re-sync trigger. + ContainerResyncTrigger *int32 + + // READ-ONLY; Cache node resource create async operation Id. + CreateAsyncOperationID *string + + // READ-ONLY; Cache node resource customer resource GUID Id. + CustomerID *string + + // READ-ONLY; Cache node resource deletion async operation Id. + DeleteAsyncOperationID *string + + // READ-ONLY; Cache node resource Mcc Container Id Uri. + ImageURI *string + + // READ-ONLY; Cache node resource flag for indicating the cache node resource is frozen (not selectable, not editable in UI). + IsFrozen *bool + + // READ-ONLY; Cache node resource last sync timestamp. + LastSyncWithAzureTimestamp *time.Time + + // READ-ONLY; Cache node resource last backend updated timestamp. + LastUpdatedTimestamp *time.Time + + // READ-ONLY; Cache node resource maximum allowed probability of egress. + MaxAllowableProbability *float32 + + // READ-ONLY; Cache node resource release version. + ReleaseVersion *int32 + + // READ-ONLY; Cache node resource review feedback text. + ReviewFeedback *string + + // READ-ONLY; Cache node resource review process state as integer + ReviewState *int32 + + // READ-ONLY; Cache node resource review state text. + ReviewStateText *string + + // READ-ONLY; Cache node resource attempts to sync with Azure. + SynchWithAzureAttemptsCount *int32 + + // READ-ONLY; Cache node resource Mcc container deployment worker connection count. + WorkerConnections *int32 + + // READ-ONLY; Cache node resource last updated Mcc container deployment worker connection count timestamp. + WorkerConnectionsLastUpdatedDateTime *time.Time + + // READ-ONLY; Cache node resource Azure XCid. + XCid *string +} + +// CacheNodeInstallProperties - Mcc cache node resource install script properties. +type CacheNodeInstallProperties struct { + // Mcc cache node resource Id. + CacheNodeID *string + + // Mcc customer resource Id. + CustomerID *string + + // READ-ONLY; Mcc primary account key. Internal to Mcc. + PrimaryAccountKey *string + + // READ-ONLY; Mcc Iot Central temporary device registration key, used once. + RegistrationKey *string + + // READ-ONLY; Mcc secondary account key. Internal to Mcc. + SecondaryAccountKey *string +} + +// CacheNodeOldResponse - Model representing Cache Node for ConnectedCache resource +type CacheNodeOldResponse struct { + // The error details + Error *ErrorDetail + + // statusCode used to get code details of Mcc response object + StatusCode *string + + // statusDetails used to get inner details of Mcc response object + StatusDetails *string + + // statusText used to get status details in string format of Mcc response object + StatusText *string + + // READ-ONLY; The provisioned state of the resource + ProvisioningState *ProvisioningState + + // READ-ONLY; status of the HTTP error code + Status *string +} + +// CacheNodePreviewResource - Concrete tracked resource types can be created by aliasing this type using a specific property +// type. +type CacheNodePreviewResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *CacheNodeOldResponse + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Name of the Customer resource + Name *string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *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 +} + +// CacheNodePreviewResourceListResult - The response of a CacheNodePreviewResource list operation. +type CacheNodePreviewResourceListResult struct { + // REQUIRED; The CacheNodePreviewResource items on this page + Value []*CacheNodePreviewResource + + // The link to the next page of items + NextLink *string +} + +// CacheNodeProperty - Model representing an Mcc cache node connectedCache resource +type CacheNodeProperty struct { + // Mcc cache node resource additional properties. + AdditionalCacheNodeProperties *AdditionalCacheNodeProperties + + // Mcc cache node resource (cache node entity). + CacheNode *CacheNodeEntity + + // Mcc response error details. + Error *ErrorDetail + + // Mcc response status code. + StatusCode *string + + // Mcc response status details for retrieving response inner details. + StatusDetails *string + + // Mcc response status text as string for retrieving status details. + StatusText *string + + // READ-ONLY; The provisioned state of the resource + ProvisioningState *ProvisioningState + + // READ-ONLY; HTTP error status code. + Status *string +} + +// CustomerEntity - Model representing Customer resource for ConnectedCache resource +type CustomerEntity struct { + // Customer resource client tenant Id of subscription. + ClientTenantID *string + + // Customer resource contact email. + ContactEmail *string + + // Customer resource contact full name. + ContactName *string + + // Customer resource contact phone. + ContactPhone *string + + // Customer resource name. + CustomerName *string + + // Customer resource Azure fully qualified resource Id. + FullyQualifiedResourceID *string + + // Customer resource flag for enterprise management as boolean. + IsEnterpriseManaged *bool + + // Customer resource entitlement flag as boolean. + IsEntitled *bool + + // Customer resource Mcc release version. + ReleaseVersion *int32 + + // Customer resource flag for resending signup code as boolean. + ResendSignupCode *bool + + // Customer resource flag for migration. + ShouldMigrate *bool + + // Customer resource flag for requiring verification of signup code as boolean. + VerifySignupCode *bool + + // Customer resource phrase for verifying signup. + VerifySignupPhrase *string + + // READ-ONLY; Customer resource create async operation Id. + CreateAsyncOperationID *string + + // READ-ONLY; Customer resource Guid Id. + CustomerID *string + + // READ-ONLY; Customer resource deletion async operation Id. + DeleteAsyncOperationID *string + + // READ-ONLY; Customer resource last Azure sync timestamp. + LastSyncWithAzureTimestamp *time.Time + + // READ-ONLY; Customer resource sync attempts. + SynchWithAzureAttemptsCount *int32 +} + +// CustomerProperty - Model representing customer for connectedCache resource +type CustomerProperty struct { + // Mcc customer resource additional properties. + AdditionalCustomerProperties *AdditionalCustomerProperties + + // Mcc customer resource (customer entity). + Customer *CustomerEntity + + // READ-ONLY; Mcc response error details. + Error *ErrorDetail + + // READ-ONLY; The provisioned state of the resource + ProvisioningState *ProvisioningState + + // READ-ONLY; HTTP error status code. + Status *string + + // READ-ONLY; Mcc response status code. + StatusCode *string + + // READ-ONLY; Mcc response status details for retrieving response inner details. + StatusDetails *string + + // READ-ONLY; Mcc response status text as string for retrieving status details. + StatusText *string +} + +// EnterpriseMccCacheNodeResource - Represents the high level Nodes needed to provision cache node resources +type EnterpriseMccCacheNodeResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *CacheNodeProperty + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Name of the ConnectedCache resource + Name *string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *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 +} + +// EnterpriseMccCacheNodeResourceListResult - The response of a EnterpriseMccCacheNodeResource list operation. +type EnterpriseMccCacheNodeResourceListResult struct { + // REQUIRED; The EnterpriseMccCacheNodeResource items on this page + Value []*EnterpriseMccCacheNodeResource + + // The link to the next page of items + NextLink *string +} + +// EnterpriseMccCustomerResource - Represents the high level Nodes needed to provision customer resources +type EnterpriseMccCustomerResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *CustomerProperty + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Name of the Customer resource + Name *string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *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 +} + +// EnterpriseMccCustomerResourceListResult - The response of a EnterpriseMccCustomerResource list operation. +type EnterpriseMccCustomerResourceListResult struct { + // REQUIRED; The EnterpriseMccCustomerResource items on this page + Value []*EnterpriseMccCustomerResource + + // The link to the next page of items + NextLink *string +} + +// EnterprisePreviewResource - ConnectedCache Resource. Represents the high level Nodes needed to provision CacheNode and +// customer resources used in private preview +type EnterprisePreviewResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *CacheNodeOldResponse + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Name of the Customer resource + Name *string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *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 +} + +// EnterprisePreviewResourceListResult - The response of a EnterprisePreviewResource list operation. +type EnterprisePreviewResourceListResult struct { + // REQUIRED; The EnterprisePreviewResource items on this page + Value []*EnterprisePreviewResource + + // The link to the next page of items + NextLink *string +} + +// ErrorAdditionalInfo - The resource management error additional info. +type ErrorAdditionalInfo struct { + // READ-ONLY; The additional info. + Info *ErrorAdditionalInfoInfo + + // READ-ONLY; The additional info type. + Type *string +} + +type ErrorAdditionalInfoInfo struct { +} + +// 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 +} + +// IspCacheNodeResource - Represents the high level Nodes needed to provision cache node resources +type IspCacheNodeResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *CacheNodeProperty + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Name of the ConnectedCache resource + Name *string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *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 +} + +// IspCacheNodeResourceListResult - The response of a IspCacheNodeResource list operation. +type IspCacheNodeResourceListResult struct { + // REQUIRED; The IspCacheNodeResource items on this page + Value []*IspCacheNodeResource + + // The link to the next page of items + NextLink *string +} + +// IspCustomerResource - Represents the high level Nodes needed to provision isp customer resources +type IspCustomerResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *CustomerProperty + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Name of the Customer resource + Name *string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *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 +} + +// IspCustomerResourceListResult - The response of a IspCustomerResource list operation. +type IspCustomerResourceListResult struct { + // REQUIRED; The IspCustomerResource items on this page + Value []*IspCustomerResource + + // The link to the next page of items + NextLink *string +} + +// MccCacheNodeBgpCidrDetails - Represents all Cidr details of the Bgp request for a specific cache node resource +type MccCacheNodeBgpCidrDetails struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // Mcc cache node resource Bgp Cidr properties. + Properties *BgpCidrsConfiguration + + // 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 +} + +// MccCacheNodeInstallDetails - Mcc cache node resource all install details. +type MccCacheNodeInstallDetails struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // Mcc cache node resource install script details. + Properties *CacheNodeInstallProperties + + // 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 +} + +// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +type Operation struct { + // Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + ActionType *ActionType + + // READ-ONLY; Localized display information for this particular operation. + Display *OperationDisplay + + // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure + // Resource Manager/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 and 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 { + // REQUIRED; The Operation items on this page + Value []*Operation + + // The link to the next page of items + NextLink *string +} + +// PatchResource - Mcc PATCH operation properties. +type PatchResource struct { + // Resource tags. + Tags map[string]*string +} + +// ProxyURLConfiguration - ProxyUrl configuration of cache node +type ProxyURLConfiguration struct { + // Host Proxy Address configuration along with port number. This can be a proxy or ip address. ex: xx.xx.xx.xxxx:80 or host + // name http://exampleproxy.com:80 + ProxyURL *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 +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/models_serde.go b/sdk/resourcemanager/connectedcache/armconnectedcache/models_serde.go new file mode 100644 index 000000000000..0a2659d79975 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/models_serde.go @@ -0,0 +1,1827 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armconnectedcache + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AdditionalCacheNodeProperties. +func (a AdditionalCacheNodeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "aggregatedStatusCode", a.AggregatedStatusCode) + populate(objectMap, "aggregatedStatusDetails", a.AggregatedStatusDetails) + populate(objectMap, "aggregatedStatusText", a.AggregatedStatusText) + populate(objectMap, "autoUpdateAppliedVersion", a.AutoUpdateAppliedVersion) + populateDateTimeRFC3339(objectMap, "autoUpdateLastAppliedDateTime", a.AutoUpdateLastAppliedDateTime) + populate(objectMap, "autoUpdateLastAppliedDetails", a.AutoUpdateLastAppliedDetails) + populate(objectMap, "autoUpdateLastAppliedState", a.AutoUpdateLastAppliedState) + populateDateTimeRFC3339(objectMap, "autoUpdateLastTriggeredDateTime", a.AutoUpdateLastTriggeredDateTime) + populateDateTimeRFC3339(objectMap, "autoUpdateNextAvailableDateTime", a.AutoUpdateNextAvailableDateTime) + populate(objectMap, "autoUpdateNextAvailableVersion", a.AutoUpdateNextAvailableVersion) + populate(objectMap, "autoUpdateVersion", a.AutoUpdateVersion) + populate(objectMap, "bgpConfiguration", a.BgpConfiguration) + populate(objectMap, "cacheNodePropertiesDetailsIssuesList", a.CacheNodePropertiesDetailsIssuesList) + populate(objectMap, "cacheNodeState", a.CacheNodeState) + populate(objectMap, "cacheNodeStateDetailedText", a.CacheNodeStateDetailedText) + populate(objectMap, "cacheNodeStateShortText", a.CacheNodeStateShortText) + populate(objectMap, "driveConfiguration", a.DriveConfiguration) + populate(objectMap, "isProvisioned", a.IsProvisioned) + populate(objectMap, "isProxyRequired", a.IsProxyRequired) + populate(objectMap, "osType", a.OSType) + populate(objectMap, "optionalProperty1", a.OptionalProperty1) + populate(objectMap, "optionalProperty2", a.OptionalProperty2) + populate(objectMap, "optionalProperty3", a.OptionalProperty3) + populate(objectMap, "optionalProperty4", a.OptionalProperty4) + populate(objectMap, "optionalProperty5", a.OptionalProperty5) + populate(objectMap, "productVersion", a.ProductVersion) + populate(objectMap, "proxyUrl", a.ProxyURL) + populate(objectMap, "proxyUrlConfiguration", a.ProxyURLConfiguration) + populate(objectMap, "updateCycleType", a.UpdateCycleType) + populate(objectMap, "updateInfoDetails", a.UpdateInfoDetails) + populateDateTimeRFC3339(objectMap, "updateRequestedDateTime", a.UpdateRequestedDateTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdditionalCacheNodeProperties. +func (a *AdditionalCacheNodeProperties) UnmarshalJSON(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) + } + for key, val := range rawMsg { + var err error + switch key { + case "aggregatedStatusCode": + err = unpopulate(val, "AggregatedStatusCode", &a.AggregatedStatusCode) + delete(rawMsg, key) + case "aggregatedStatusDetails": + err = unpopulate(val, "AggregatedStatusDetails", &a.AggregatedStatusDetails) + delete(rawMsg, key) + case "aggregatedStatusText": + err = unpopulate(val, "AggregatedStatusText", &a.AggregatedStatusText) + delete(rawMsg, key) + case "autoUpdateAppliedVersion": + err = unpopulate(val, "AutoUpdateAppliedVersion", &a.AutoUpdateAppliedVersion) + delete(rawMsg, key) + case "autoUpdateLastAppliedDateTime": + err = unpopulateDateTimeRFC3339(val, "AutoUpdateLastAppliedDateTime", &a.AutoUpdateLastAppliedDateTime) + delete(rawMsg, key) + case "autoUpdateLastAppliedDetails": + err = unpopulate(val, "AutoUpdateLastAppliedDetails", &a.AutoUpdateLastAppliedDetails) + delete(rawMsg, key) + case "autoUpdateLastAppliedState": + err = unpopulate(val, "AutoUpdateLastAppliedState", &a.AutoUpdateLastAppliedState) + delete(rawMsg, key) + case "autoUpdateLastTriggeredDateTime": + err = unpopulateDateTimeRFC3339(val, "AutoUpdateLastTriggeredDateTime", &a.AutoUpdateLastTriggeredDateTime) + delete(rawMsg, key) + case "autoUpdateNextAvailableDateTime": + err = unpopulateDateTimeRFC3339(val, "AutoUpdateNextAvailableDateTime", &a.AutoUpdateNextAvailableDateTime) + delete(rawMsg, key) + case "autoUpdateNextAvailableVersion": + err = unpopulate(val, "AutoUpdateNextAvailableVersion", &a.AutoUpdateNextAvailableVersion) + delete(rawMsg, key) + case "autoUpdateVersion": + err = unpopulate(val, "AutoUpdateVersion", &a.AutoUpdateVersion) + delete(rawMsg, key) + case "bgpConfiguration": + err = unpopulate(val, "BgpConfiguration", &a.BgpConfiguration) + delete(rawMsg, key) + case "cacheNodePropertiesDetailsIssuesList": + err = unpopulate(val, "CacheNodePropertiesDetailsIssuesList", &a.CacheNodePropertiesDetailsIssuesList) + delete(rawMsg, key) + case "cacheNodeState": + err = unpopulate(val, "CacheNodeState", &a.CacheNodeState) + delete(rawMsg, key) + case "cacheNodeStateDetailedText": + err = unpopulate(val, "CacheNodeStateDetailedText", &a.CacheNodeStateDetailedText) + delete(rawMsg, key) + case "cacheNodeStateShortText": + err = unpopulate(val, "CacheNodeStateShortText", &a.CacheNodeStateShortText) + delete(rawMsg, key) + case "driveConfiguration": + err = unpopulate(val, "DriveConfiguration", &a.DriveConfiguration) + delete(rawMsg, key) + case "isProvisioned": + err = unpopulate(val, "IsProvisioned", &a.IsProvisioned) + delete(rawMsg, key) + case "isProxyRequired": + err = unpopulate(val, "IsProxyRequired", &a.IsProxyRequired) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &a.OSType) + delete(rawMsg, key) + case "optionalProperty1": + err = unpopulate(val, "OptionalProperty1", &a.OptionalProperty1) + delete(rawMsg, key) + case "optionalProperty2": + err = unpopulate(val, "OptionalProperty2", &a.OptionalProperty2) + delete(rawMsg, key) + case "optionalProperty3": + err = unpopulate(val, "OptionalProperty3", &a.OptionalProperty3) + delete(rawMsg, key) + case "optionalProperty4": + err = unpopulate(val, "OptionalProperty4", &a.OptionalProperty4) + delete(rawMsg, key) + case "optionalProperty5": + err = unpopulate(val, "OptionalProperty5", &a.OptionalProperty5) + delete(rawMsg, key) + case "productVersion": + err = unpopulate(val, "ProductVersion", &a.ProductVersion) + delete(rawMsg, key) + case "proxyUrl": + err = unpopulate(val, "ProxyURL", &a.ProxyURL) + delete(rawMsg, key) + case "proxyUrlConfiguration": + err = unpopulate(val, "ProxyURLConfiguration", &a.ProxyURLConfiguration) + delete(rawMsg, key) + case "updateCycleType": + err = unpopulate(val, "UpdateCycleType", &a.UpdateCycleType) + delete(rawMsg, key) + case "updateInfoDetails": + err = unpopulate(val, "UpdateInfoDetails", &a.UpdateInfoDetails) + delete(rawMsg, key) + case "updateRequestedDateTime": + err = unpopulateDateTimeRFC3339(val, "UpdateRequestedDateTime", &a.UpdateRequestedDateTime) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AdditionalCustomerProperties. +func (a AdditionalCustomerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "customerAsn", a.CustomerAsn) + populate(objectMap, "customerAsnEstimatedEgressPeekGbps", a.CustomerAsnEstimatedEgressPeekGbps) + populate(objectMap, "customerEmail", a.CustomerEmail) + populateDateTimeRFC3339(objectMap, "customerEntitlementExpiration", a.CustomerEntitlementExpiration) + populate(objectMap, "customerEntitlementSkuGuid", a.CustomerEntitlementSKUGUID) + populate(objectMap, "customerEntitlementSkuId", a.CustomerEntitlementSKUID) + populate(objectMap, "customerEntitlementSkuName", a.CustomerEntitlementSKUName) + populate(objectMap, "customerOrgName", a.CustomerOrgName) + populate(objectMap, "customerPropertiesOverviewAverageEgressMbps", a.CustomerPropertiesOverviewAverageEgressMbps) + populate(objectMap, "customerPropertiesOverviewAverageMissMbps", a.CustomerPropertiesOverviewAverageMissMbps) + populate(objectMap, "customerPropertiesOverviewCacheEfficiency", a.CustomerPropertiesOverviewCacheEfficiency) + populate(objectMap, "customerPropertiesOverviewCacheNodesHealthyCount", a.CustomerPropertiesOverviewCacheNodesHealthyCount) + populate(objectMap, "customerPropertiesOverviewCacheNodesUnhealthyCount", a.CustomerPropertiesOverviewCacheNodesUnhealthyCount) + populate(objectMap, "customerPropertiesOverviewEgressMbpsMax", a.CustomerPropertiesOverviewEgressMbpsMax) + populateDateTimeRFC3339(objectMap, "customerPropertiesOverviewEgressMbpsMaxDateTime", a.CustomerPropertiesOverviewEgressMbpsMaxDateTime) + populate(objectMap, "customerPropertiesOverviewMissMbpsMax", a.CustomerPropertiesOverviewMissMbpsMax) + populateDateTimeRFC3339(objectMap, "customerPropertiesOverviewMissMbpsMaxDateTime", a.CustomerPropertiesOverviewMissMbpsMaxDateTime) + populate(objectMap, "customerTransitAsn", a.CustomerTransitAsn) + populate(objectMap, "customerTransitState", a.CustomerTransitState) + populate(objectMap, "optionalProperty1", a.OptionalProperty1) + populate(objectMap, "optionalProperty2", a.OptionalProperty2) + populate(objectMap, "optionalProperty3", a.OptionalProperty3) + populate(objectMap, "optionalProperty4", a.OptionalProperty4) + populate(objectMap, "optionalProperty5", a.OptionalProperty5) + populateDateTimeRFC3339(objectMap, "peeringDbLastUpdateDate", a.PeeringDbLastUpdateDate) + populateDateTimeRFC3339(objectMap, "peeringDbLastUpdateTime", a.PeeringDbLastUpdateTime) + populate(objectMap, "signupPhaseStatusCode", a.SignupPhaseStatusCode) + populate(objectMap, "signupPhaseStatusText", a.SignupPhaseStatusText) + populate(objectMap, "signupStatus", a.SignupStatus) + populate(objectMap, "signupStatusCode", a.SignupStatusCode) + populate(objectMap, "signupStatusText", a.SignupStatusText) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdditionalCustomerProperties. +func (a *AdditionalCustomerProperties) UnmarshalJSON(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) + } + for key, val := range rawMsg { + var err error + switch key { + case "customerAsn": + err = unpopulate(val, "CustomerAsn", &a.CustomerAsn) + delete(rawMsg, key) + case "customerAsnEstimatedEgressPeekGbps": + err = unpopulate(val, "CustomerAsnEstimatedEgressPeekGbps", &a.CustomerAsnEstimatedEgressPeekGbps) + delete(rawMsg, key) + case "customerEmail": + err = unpopulate(val, "CustomerEmail", &a.CustomerEmail) + delete(rawMsg, key) + case "customerEntitlementExpiration": + err = unpopulateDateTimeRFC3339(val, "CustomerEntitlementExpiration", &a.CustomerEntitlementExpiration) + delete(rawMsg, key) + case "customerEntitlementSkuGuid": + err = unpopulate(val, "CustomerEntitlementSKUGUID", &a.CustomerEntitlementSKUGUID) + delete(rawMsg, key) + case "customerEntitlementSkuId": + err = unpopulate(val, "CustomerEntitlementSKUID", &a.CustomerEntitlementSKUID) + delete(rawMsg, key) + case "customerEntitlementSkuName": + err = unpopulate(val, "CustomerEntitlementSKUName", &a.CustomerEntitlementSKUName) + delete(rawMsg, key) + case "customerOrgName": + err = unpopulate(val, "CustomerOrgName", &a.CustomerOrgName) + delete(rawMsg, key) + case "customerPropertiesOverviewAverageEgressMbps": + err = unpopulate(val, "CustomerPropertiesOverviewAverageEgressMbps", &a.CustomerPropertiesOverviewAverageEgressMbps) + delete(rawMsg, key) + case "customerPropertiesOverviewAverageMissMbps": + err = unpopulate(val, "CustomerPropertiesOverviewAverageMissMbps", &a.CustomerPropertiesOverviewAverageMissMbps) + delete(rawMsg, key) + case "customerPropertiesOverviewCacheEfficiency": + err = unpopulate(val, "CustomerPropertiesOverviewCacheEfficiency", &a.CustomerPropertiesOverviewCacheEfficiency) + delete(rawMsg, key) + case "customerPropertiesOverviewCacheNodesHealthyCount": + err = unpopulate(val, "CustomerPropertiesOverviewCacheNodesHealthyCount", &a.CustomerPropertiesOverviewCacheNodesHealthyCount) + delete(rawMsg, key) + case "customerPropertiesOverviewCacheNodesUnhealthyCount": + err = unpopulate(val, "CustomerPropertiesOverviewCacheNodesUnhealthyCount", &a.CustomerPropertiesOverviewCacheNodesUnhealthyCount) + delete(rawMsg, key) + case "customerPropertiesOverviewEgressMbpsMax": + err = unpopulate(val, "CustomerPropertiesOverviewEgressMbpsMax", &a.CustomerPropertiesOverviewEgressMbpsMax) + delete(rawMsg, key) + case "customerPropertiesOverviewEgressMbpsMaxDateTime": + err = unpopulateDateTimeRFC3339(val, "CustomerPropertiesOverviewEgressMbpsMaxDateTime", &a.CustomerPropertiesOverviewEgressMbpsMaxDateTime) + delete(rawMsg, key) + case "customerPropertiesOverviewMissMbpsMax": + err = unpopulate(val, "CustomerPropertiesOverviewMissMbpsMax", &a.CustomerPropertiesOverviewMissMbpsMax) + delete(rawMsg, key) + case "customerPropertiesOverviewMissMbpsMaxDateTime": + err = unpopulateDateTimeRFC3339(val, "CustomerPropertiesOverviewMissMbpsMaxDateTime", &a.CustomerPropertiesOverviewMissMbpsMaxDateTime) + delete(rawMsg, key) + case "customerTransitAsn": + err = unpopulate(val, "CustomerTransitAsn", &a.CustomerTransitAsn) + delete(rawMsg, key) + case "customerTransitState": + err = unpopulate(val, "CustomerTransitState", &a.CustomerTransitState) + delete(rawMsg, key) + case "optionalProperty1": + err = unpopulate(val, "OptionalProperty1", &a.OptionalProperty1) + delete(rawMsg, key) + case "optionalProperty2": + err = unpopulate(val, "OptionalProperty2", &a.OptionalProperty2) + delete(rawMsg, key) + case "optionalProperty3": + err = unpopulate(val, "OptionalProperty3", &a.OptionalProperty3) + delete(rawMsg, key) + case "optionalProperty4": + err = unpopulate(val, "OptionalProperty4", &a.OptionalProperty4) + delete(rawMsg, key) + case "optionalProperty5": + err = unpopulate(val, "OptionalProperty5", &a.OptionalProperty5) + delete(rawMsg, key) + case "peeringDbLastUpdateDate": + err = unpopulateDateTimeRFC3339(val, "PeeringDbLastUpdateDate", &a.PeeringDbLastUpdateDate) + delete(rawMsg, key) + case "peeringDbLastUpdateTime": + err = unpopulateDateTimeRFC3339(val, "PeeringDbLastUpdateTime", &a.PeeringDbLastUpdateTime) + delete(rawMsg, key) + case "signupPhaseStatusCode": + err = unpopulate(val, "SignupPhaseStatusCode", &a.SignupPhaseStatusCode) + delete(rawMsg, key) + case "signupPhaseStatusText": + err = unpopulate(val, "SignupPhaseStatusText", &a.SignupPhaseStatusText) + delete(rawMsg, key) + case "signupStatus": + err = unpopulate(val, "SignupStatus", &a.SignupStatus) + delete(rawMsg, key) + case "signupStatusCode": + err = unpopulate(val, "SignupStatusCode", &a.SignupStatusCode) + delete(rawMsg, key) + case "signupStatusText": + err = unpopulate(val, "SignupStatusText", &a.SignupStatusText) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BgpCidrsConfiguration. +func (b BgpCidrsConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "bgpCidrs", b.BgpCidrs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BgpCidrsConfiguration. +func (b *BgpCidrsConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "bgpCidrs": + err = unpopulate(val, "BgpCidrs", &b.BgpCidrs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BgpConfiguration. +func (b BgpConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "asnToIpAddressMapping", b.AsnToIPAddressMapping) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BgpConfiguration. +func (b *BgpConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "asnToIpAddressMapping": + err = unpopulate(val, "AsnToIPAddressMapping", &b.AsnToIPAddressMapping) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CacheNodeDriveConfiguration. +func (c CacheNodeDriveConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "cacheNumber", c.CacheNumber) + populate(objectMap, "nginxMapping", c.NginxMapping) + populate(objectMap, "physicalPath", c.PhysicalPath) + populate(objectMap, "sizeInGb", c.SizeInGb) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CacheNodeDriveConfiguration. +func (c *CacheNodeDriveConfiguration) UnmarshalJSON(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) + } + for key, val := range rawMsg { + var err error + switch key { + case "cacheNumber": + err = unpopulate(val, "CacheNumber", &c.CacheNumber) + delete(rawMsg, key) + case "nginxMapping": + err = unpopulate(val, "NginxMapping", &c.NginxMapping) + delete(rawMsg, key) + case "physicalPath": + err = unpopulate(val, "PhysicalPath", &c.PhysicalPath) + delete(rawMsg, key) + case "sizeInGb": + err = unpopulate(val, "SizeInGb", &c.SizeInGb) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CacheNodeEntity. +func (c CacheNodeEntity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "addressSpace", c.AddressSpace) + populate(objectMap, "autoUpdateRequestedDay", c.AutoUpdateRequestedDay) + populate(objectMap, "autoUpdateRequestedTime", c.AutoUpdateRequestedTime) + populate(objectMap, "autoUpdateRequestedWeek", c.AutoUpdateRequestedWeek) + populate(objectMap, "autoUpdateRingType", c.AutoUpdateRingType) + populate(objectMap, "bgpAddressSpace", c.BgpAddressSpace) + populate(objectMap, "bgpCidrBlocksCount", c.BgpCidrBlocksCount) + populateDateTimeRFC3339(objectMap, "bgpCidrCsvLastUpdateTime", c.BgpCidrCSVLastUpdateTime) + populate(objectMap, "bgpFileBytesTruncated", c.BgpFileBytesTruncated) + populateDateTimeRFC3339(objectMap, "bgpLastReportedTime", c.BgpLastReportedTime) + populate(objectMap, "bgpNumberOfRecords", c.BgpNumberOfRecords) + populate(objectMap, "bgpNumberOfTimesUpdated", c.BgpNumberOfTimesUpdated) + populate(objectMap, "bgpReviewFeedback", c.BgpReviewFeedback) + populate(objectMap, "bgpReviewState", c.BgpReviewState) + populate(objectMap, "bgpReviewStateText", c.BgpReviewStateText) + populate(objectMap, "cacheNodeId", c.CacheNodeID) + populate(objectMap, "cacheNodeName", c.CacheNodeName) + populate(objectMap, "category", c.Category) + populate(objectMap, "cidrCsv", c.CidrCSV) + populateDateTimeRFC3339(objectMap, "cidrCsvLastUpdateTime", c.CidrCSVLastUpdateTime) + populate(objectMap, "cidrSelectionType", c.CidrSelectionType) + populate(objectMap, "clientTenantId", c.ClientTenantID) + populate(objectMap, "configurationState", c.ConfigurationState) + populate(objectMap, "configurationStateText", c.ConfigurationStateText) + populate(objectMap, "containerConfigurations", c.ContainerConfigurations) + populate(objectMap, "containerResyncTrigger", c.ContainerResyncTrigger) + populate(objectMap, "createAsyncOperationId", c.CreateAsyncOperationID) + populate(objectMap, "customerAsn", c.CustomerAsn) + populate(objectMap, "customerId", c.CustomerID) + populate(objectMap, "customerIndex", c.CustomerIndex) + populate(objectMap, "customerName", c.CustomerName) + populate(objectMap, "deleteAsyncOperationId", c.DeleteAsyncOperationID) + populate(objectMap, "fullyQualifiedDomainName", c.FullyQualifiedDomainName) + populate(objectMap, "fullyQualifiedResourceId", c.FullyQualifiedResourceID) + populate(objectMap, "ipAddress", c.IPAddress) + populate(objectMap, "imageUri", c.ImageURI) + populate(objectMap, "isEnabled", c.IsEnabled) + populate(objectMap, "isEnterpriseManaged", c.IsEnterpriseManaged) + populate(objectMap, "isFrozen", c.IsFrozen) + populateDateTimeRFC3339(objectMap, "lastSyncWithAzureTimestamp", c.LastSyncWithAzureTimestamp) + populateDateTimeRFC3339(objectMap, "lastUpdatedTimestamp", c.LastUpdatedTimestamp) + populate(objectMap, "maxAllowableEgressInMbps", c.MaxAllowableEgressInMbps) + populate(objectMap, "maxAllowableProbability", c.MaxAllowableProbability) + populate(objectMap, "releaseVersion", c.ReleaseVersion) + populate(objectMap, "reviewFeedback", c.ReviewFeedback) + populate(objectMap, "reviewState", c.ReviewState) + populate(objectMap, "reviewStateText", c.ReviewStateText) + populate(objectMap, "shouldMigrate", c.ShouldMigrate) + populate(objectMap, "synchWithAzureAttemptsCount", c.SynchWithAzureAttemptsCount) + populate(objectMap, "workerConnections", c.WorkerConnections) + populateDateTimeRFC3339(objectMap, "workerConnectionsLastUpdatedDateTime", c.WorkerConnectionsLastUpdatedDateTime) + populate(objectMap, "xCid", c.XCid) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CacheNodeEntity. +func (c *CacheNodeEntity) UnmarshalJSON(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) + } + for key, val := range rawMsg { + var err error + switch key { + case "addressSpace": + err = unpopulate(val, "AddressSpace", &c.AddressSpace) + delete(rawMsg, key) + case "autoUpdateRequestedDay": + err = unpopulate(val, "AutoUpdateRequestedDay", &c.AutoUpdateRequestedDay) + delete(rawMsg, key) + case "autoUpdateRequestedTime": + err = unpopulate(val, "AutoUpdateRequestedTime", &c.AutoUpdateRequestedTime) + delete(rawMsg, key) + case "autoUpdateRequestedWeek": + err = unpopulate(val, "AutoUpdateRequestedWeek", &c.AutoUpdateRequestedWeek) + delete(rawMsg, key) + case "autoUpdateRingType": + err = unpopulate(val, "AutoUpdateRingType", &c.AutoUpdateRingType) + delete(rawMsg, key) + case "bgpAddressSpace": + err = unpopulate(val, "BgpAddressSpace", &c.BgpAddressSpace) + delete(rawMsg, key) + case "bgpCidrBlocksCount": + err = unpopulate(val, "BgpCidrBlocksCount", &c.BgpCidrBlocksCount) + delete(rawMsg, key) + case "bgpCidrCsvLastUpdateTime": + err = unpopulateDateTimeRFC3339(val, "BgpCidrCSVLastUpdateTime", &c.BgpCidrCSVLastUpdateTime) + delete(rawMsg, key) + case "bgpFileBytesTruncated": + err = unpopulate(val, "BgpFileBytesTruncated", &c.BgpFileBytesTruncated) + delete(rawMsg, key) + case "bgpLastReportedTime": + err = unpopulateDateTimeRFC3339(val, "BgpLastReportedTime", &c.BgpLastReportedTime) + delete(rawMsg, key) + case "bgpNumberOfRecords": + err = unpopulate(val, "BgpNumberOfRecords", &c.BgpNumberOfRecords) + delete(rawMsg, key) + case "bgpNumberOfTimesUpdated": + err = unpopulate(val, "BgpNumberOfTimesUpdated", &c.BgpNumberOfTimesUpdated) + delete(rawMsg, key) + case "bgpReviewFeedback": + err = unpopulate(val, "BgpReviewFeedback", &c.BgpReviewFeedback) + delete(rawMsg, key) + case "bgpReviewState": + err = unpopulate(val, "BgpReviewState", &c.BgpReviewState) + delete(rawMsg, key) + case "bgpReviewStateText": + err = unpopulate(val, "BgpReviewStateText", &c.BgpReviewStateText) + delete(rawMsg, key) + case "cacheNodeId": + err = unpopulate(val, "CacheNodeID", &c.CacheNodeID) + delete(rawMsg, key) + case "cacheNodeName": + err = unpopulate(val, "CacheNodeName", &c.CacheNodeName) + delete(rawMsg, key) + case "category": + err = unpopulate(val, "Category", &c.Category) + delete(rawMsg, key) + case "cidrCsv": + err = unpopulate(val, "CidrCSV", &c.CidrCSV) + delete(rawMsg, key) + case "cidrCsvLastUpdateTime": + err = unpopulateDateTimeRFC3339(val, "CidrCSVLastUpdateTime", &c.CidrCSVLastUpdateTime) + delete(rawMsg, key) + case "cidrSelectionType": + err = unpopulate(val, "CidrSelectionType", &c.CidrSelectionType) + delete(rawMsg, key) + case "clientTenantId": + err = unpopulate(val, "ClientTenantID", &c.ClientTenantID) + delete(rawMsg, key) + case "configurationState": + err = unpopulate(val, "ConfigurationState", &c.ConfigurationState) + delete(rawMsg, key) + case "configurationStateText": + err = unpopulate(val, "ConfigurationStateText", &c.ConfigurationStateText) + delete(rawMsg, key) + case "containerConfigurations": + err = unpopulate(val, "ContainerConfigurations", &c.ContainerConfigurations) + delete(rawMsg, key) + case "containerResyncTrigger": + err = unpopulate(val, "ContainerResyncTrigger", &c.ContainerResyncTrigger) + delete(rawMsg, key) + case "createAsyncOperationId": + err = unpopulate(val, "CreateAsyncOperationID", &c.CreateAsyncOperationID) + delete(rawMsg, key) + case "customerAsn": + err = unpopulate(val, "CustomerAsn", &c.CustomerAsn) + delete(rawMsg, key) + case "customerId": + err = unpopulate(val, "CustomerID", &c.CustomerID) + delete(rawMsg, key) + case "customerIndex": + err = unpopulate(val, "CustomerIndex", &c.CustomerIndex) + delete(rawMsg, key) + case "customerName": + err = unpopulate(val, "CustomerName", &c.CustomerName) + delete(rawMsg, key) + case "deleteAsyncOperationId": + err = unpopulate(val, "DeleteAsyncOperationID", &c.DeleteAsyncOperationID) + delete(rawMsg, key) + case "fullyQualifiedDomainName": + err = unpopulate(val, "FullyQualifiedDomainName", &c.FullyQualifiedDomainName) + delete(rawMsg, key) + case "fullyQualifiedResourceId": + err = unpopulate(val, "FullyQualifiedResourceID", &c.FullyQualifiedResourceID) + delete(rawMsg, key) + case "ipAddress": + err = unpopulate(val, "IPAddress", &c.IPAddress) + delete(rawMsg, key) + case "imageUri": + err = unpopulate(val, "ImageURI", &c.ImageURI) + delete(rawMsg, key) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &c.IsEnabled) + delete(rawMsg, key) + case "isEnterpriseManaged": + err = unpopulate(val, "IsEnterpriseManaged", &c.IsEnterpriseManaged) + delete(rawMsg, key) + case "isFrozen": + err = unpopulate(val, "IsFrozen", &c.IsFrozen) + delete(rawMsg, key) + case "lastSyncWithAzureTimestamp": + err = unpopulateDateTimeRFC3339(val, "LastSyncWithAzureTimestamp", &c.LastSyncWithAzureTimestamp) + delete(rawMsg, key) + case "lastUpdatedTimestamp": + err = unpopulateDateTimeRFC3339(val, "LastUpdatedTimestamp", &c.LastUpdatedTimestamp) + delete(rawMsg, key) + case "maxAllowableEgressInMbps": + err = unpopulate(val, "MaxAllowableEgressInMbps", &c.MaxAllowableEgressInMbps) + delete(rawMsg, key) + case "maxAllowableProbability": + err = unpopulate(val, "MaxAllowableProbability", &c.MaxAllowableProbability) + delete(rawMsg, key) + case "releaseVersion": + err = unpopulate(val, "ReleaseVersion", &c.ReleaseVersion) + delete(rawMsg, key) + case "reviewFeedback": + err = unpopulate(val, "ReviewFeedback", &c.ReviewFeedback) + delete(rawMsg, key) + case "reviewState": + err = unpopulate(val, "ReviewState", &c.ReviewState) + delete(rawMsg, key) + case "reviewStateText": + err = unpopulate(val, "ReviewStateText", &c.ReviewStateText) + delete(rawMsg, key) + case "shouldMigrate": + err = unpopulate(val, "ShouldMigrate", &c.ShouldMigrate) + delete(rawMsg, key) + case "synchWithAzureAttemptsCount": + err = unpopulate(val, "SynchWithAzureAttemptsCount", &c.SynchWithAzureAttemptsCount) + delete(rawMsg, key) + case "workerConnections": + err = unpopulate(val, "WorkerConnections", &c.WorkerConnections) + delete(rawMsg, key) + case "workerConnectionsLastUpdatedDateTime": + err = unpopulateDateTimeRFC3339(val, "WorkerConnectionsLastUpdatedDateTime", &c.WorkerConnectionsLastUpdatedDateTime) + delete(rawMsg, key) + case "xCid": + err = unpopulate(val, "XCid", &c.XCid) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CacheNodeInstallProperties. +func (c CacheNodeInstallProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "cacheNodeId", c.CacheNodeID) + populate(objectMap, "customerId", c.CustomerID) + populate(objectMap, "primaryAccountKey", c.PrimaryAccountKey) + populate(objectMap, "registrationKey", c.RegistrationKey) + populate(objectMap, "secondaryAccountKey", c.SecondaryAccountKey) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CacheNodeInstallProperties. +func (c *CacheNodeInstallProperties) UnmarshalJSON(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) + } + for key, val := range rawMsg { + var err error + switch key { + case "cacheNodeId": + err = unpopulate(val, "CacheNodeID", &c.CacheNodeID) + delete(rawMsg, key) + case "customerId": + err = unpopulate(val, "CustomerID", &c.CustomerID) + delete(rawMsg, key) + case "primaryAccountKey": + err = unpopulate(val, "PrimaryAccountKey", &c.PrimaryAccountKey) + delete(rawMsg, key) + case "registrationKey": + err = unpopulate(val, "RegistrationKey", &c.RegistrationKey) + delete(rawMsg, key) + case "secondaryAccountKey": + err = unpopulate(val, "SecondaryAccountKey", &c.SecondaryAccountKey) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CacheNodeOldResponse. +func (c CacheNodeOldResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", c.Error) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "status", c.Status) + populate(objectMap, "statusCode", c.StatusCode) + populate(objectMap, "statusDetails", c.StatusDetails) + populate(objectMap, "statusText", c.StatusText) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CacheNodeOldResponse. +func (c *CacheNodeOldResponse) UnmarshalJSON(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) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &c.Error) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &c.Status) + delete(rawMsg, key) + case "statusCode": + err = unpopulate(val, "StatusCode", &c.StatusCode) + delete(rawMsg, key) + case "statusDetails": + err = unpopulate(val, "StatusDetails", &c.StatusDetails) + delete(rawMsg, key) + case "statusText": + err = unpopulate(val, "StatusText", &c.StatusText) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CacheNodePreviewResource. +func (c CacheNodePreviewResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CacheNodePreviewResource. +func (c *CacheNodePreviewResource) UnmarshalJSON(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) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CacheNodePreviewResourceListResult. +func (c CacheNodePreviewResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CacheNodePreviewResourceListResult. +func (c *CacheNodePreviewResourceListResult) UnmarshalJSON(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) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CacheNodeProperty. +func (c CacheNodeProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalCacheNodeProperties", c.AdditionalCacheNodeProperties) + populate(objectMap, "cacheNode", c.CacheNode) + populate(objectMap, "error", c.Error) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "status", c.Status) + populate(objectMap, "statusCode", c.StatusCode) + populate(objectMap, "statusDetails", c.StatusDetails) + populate(objectMap, "statusText", c.StatusText) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CacheNodeProperty. +func (c *CacheNodeProperty) UnmarshalJSON(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) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalCacheNodeProperties": + err = unpopulate(val, "AdditionalCacheNodeProperties", &c.AdditionalCacheNodeProperties) + delete(rawMsg, key) + case "cacheNode": + err = unpopulate(val, "CacheNode", &c.CacheNode) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &c.Error) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &c.Status) + delete(rawMsg, key) + case "statusCode": + err = unpopulate(val, "StatusCode", &c.StatusCode) + delete(rawMsg, key) + case "statusDetails": + err = unpopulate(val, "StatusDetails", &c.StatusDetails) + delete(rawMsg, key) + case "statusText": + err = unpopulate(val, "StatusText", &c.StatusText) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CustomerEntity. +func (c CustomerEntity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientTenantId", c.ClientTenantID) + populate(objectMap, "contactEmail", c.ContactEmail) + populate(objectMap, "contactName", c.ContactName) + populate(objectMap, "contactPhone", c.ContactPhone) + populate(objectMap, "createAsyncOperationId", c.CreateAsyncOperationID) + populate(objectMap, "customerId", c.CustomerID) + populate(objectMap, "customerName", c.CustomerName) + populate(objectMap, "deleteAsyncOperationId", c.DeleteAsyncOperationID) + populate(objectMap, "fullyQualifiedResourceId", c.FullyQualifiedResourceID) + populate(objectMap, "isEnterpriseManaged", c.IsEnterpriseManaged) + populate(objectMap, "isEntitled", c.IsEntitled) + populateDateTimeRFC3339(objectMap, "lastSyncWithAzureTimestamp", c.LastSyncWithAzureTimestamp) + populate(objectMap, "releaseVersion", c.ReleaseVersion) + populate(objectMap, "resendSignupCode", c.ResendSignupCode) + populate(objectMap, "shouldMigrate", c.ShouldMigrate) + populate(objectMap, "synchWithAzureAttemptsCount", c.SynchWithAzureAttemptsCount) + populate(objectMap, "verifySignupCode", c.VerifySignupCode) + populate(objectMap, "verifySignupPhrase", c.VerifySignupPhrase) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomerEntity. +func (c *CustomerEntity) UnmarshalJSON(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) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientTenantId": + err = unpopulate(val, "ClientTenantID", &c.ClientTenantID) + delete(rawMsg, key) + case "contactEmail": + err = unpopulate(val, "ContactEmail", &c.ContactEmail) + delete(rawMsg, key) + case "contactName": + err = unpopulate(val, "ContactName", &c.ContactName) + delete(rawMsg, key) + case "contactPhone": + err = unpopulate(val, "ContactPhone", &c.ContactPhone) + delete(rawMsg, key) + case "createAsyncOperationId": + err = unpopulate(val, "CreateAsyncOperationID", &c.CreateAsyncOperationID) + delete(rawMsg, key) + case "customerId": + err = unpopulate(val, "CustomerID", &c.CustomerID) + delete(rawMsg, key) + case "customerName": + err = unpopulate(val, "CustomerName", &c.CustomerName) + delete(rawMsg, key) + case "deleteAsyncOperationId": + err = unpopulate(val, "DeleteAsyncOperationID", &c.DeleteAsyncOperationID) + delete(rawMsg, key) + case "fullyQualifiedResourceId": + err = unpopulate(val, "FullyQualifiedResourceID", &c.FullyQualifiedResourceID) + delete(rawMsg, key) + case "isEnterpriseManaged": + err = unpopulate(val, "IsEnterpriseManaged", &c.IsEnterpriseManaged) + delete(rawMsg, key) + case "isEntitled": + err = unpopulate(val, "IsEntitled", &c.IsEntitled) + delete(rawMsg, key) + case "lastSyncWithAzureTimestamp": + err = unpopulateDateTimeRFC3339(val, "LastSyncWithAzureTimestamp", &c.LastSyncWithAzureTimestamp) + delete(rawMsg, key) + case "releaseVersion": + err = unpopulate(val, "ReleaseVersion", &c.ReleaseVersion) + delete(rawMsg, key) + case "resendSignupCode": + err = unpopulate(val, "ResendSignupCode", &c.ResendSignupCode) + delete(rawMsg, key) + case "shouldMigrate": + err = unpopulate(val, "ShouldMigrate", &c.ShouldMigrate) + delete(rawMsg, key) + case "synchWithAzureAttemptsCount": + err = unpopulate(val, "SynchWithAzureAttemptsCount", &c.SynchWithAzureAttemptsCount) + delete(rawMsg, key) + case "verifySignupCode": + err = unpopulate(val, "VerifySignupCode", &c.VerifySignupCode) + delete(rawMsg, key) + case "verifySignupPhrase": + err = unpopulate(val, "VerifySignupPhrase", &c.VerifySignupPhrase) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CustomerProperty. +func (c CustomerProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalCustomerProperties", c.AdditionalCustomerProperties) + populate(objectMap, "customer", c.Customer) + populate(objectMap, "error", c.Error) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "status", c.Status) + populate(objectMap, "statusCode", c.StatusCode) + populate(objectMap, "statusDetails", c.StatusDetails) + populate(objectMap, "statusText", c.StatusText) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomerProperty. +func (c *CustomerProperty) UnmarshalJSON(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) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalCustomerProperties": + err = unpopulate(val, "AdditionalCustomerProperties", &c.AdditionalCustomerProperties) + delete(rawMsg, key) + case "customer": + err = unpopulate(val, "Customer", &c.Customer) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &c.Error) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &c.Status) + delete(rawMsg, key) + case "statusCode": + err = unpopulate(val, "StatusCode", &c.StatusCode) + delete(rawMsg, key) + case "statusDetails": + err = unpopulate(val, "StatusDetails", &c.StatusDetails) + delete(rawMsg, key) + case "statusText": + err = unpopulate(val, "StatusText", &c.StatusText) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EnterpriseMccCacheNodeResource. +func (e EnterpriseMccCacheNodeResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", e.ID) + populate(objectMap, "location", e.Location) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "systemData", e.SystemData) + populate(objectMap, "tags", e.Tags) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnterpriseMccCacheNodeResource. +func (e *EnterpriseMccCacheNodeResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &e.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &e.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EnterpriseMccCacheNodeResourceListResult. +func (e EnterpriseMccCacheNodeResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnterpriseMccCacheNodeResourceListResult. +func (e *EnterpriseMccCacheNodeResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + 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", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EnterpriseMccCustomerResource. +func (e EnterpriseMccCustomerResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", e.ID) + populate(objectMap, "location", e.Location) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "systemData", e.SystemData) + populate(objectMap, "tags", e.Tags) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnterpriseMccCustomerResource. +func (e *EnterpriseMccCustomerResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &e.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &e.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EnterpriseMccCustomerResourceListResult. +func (e EnterpriseMccCustomerResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnterpriseMccCustomerResourceListResult. +func (e *EnterpriseMccCustomerResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + 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", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EnterprisePreviewResource. +func (e EnterprisePreviewResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", e.ID) + populate(objectMap, "location", e.Location) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "systemData", e.SystemData) + populate(objectMap, "tags", e.Tags) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnterprisePreviewResource. +func (e *EnterprisePreviewResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &e.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &e.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EnterprisePreviewResourceListResult. +func (e EnterprisePreviewResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnterprisePreviewResourceListResult. +func (e *EnterprisePreviewResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + 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", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "info", e.Info) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + 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", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + delete(rawMsg, key) + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IspCacheNodeResource. +func (i IspCacheNodeResource) 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 IspCacheNodeResource. +func (i *IspCacheNodeResource) UnmarshalJSON(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 IspCacheNodeResourceListResult. +func (i IspCacheNodeResourceListResult) 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 IspCacheNodeResourceListResult. +func (i *IspCacheNodeResourceListResult) UnmarshalJSON(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 IspCustomerResource. +func (i IspCustomerResource) 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 IspCustomerResource. +func (i *IspCustomerResource) UnmarshalJSON(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 IspCustomerResourceListResult. +func (i IspCustomerResourceListResult) 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 IspCustomerResourceListResult. +func (i *IspCustomerResourceListResult) UnmarshalJSON(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 MccCacheNodeBgpCidrDetails. +func (m MccCacheNodeBgpCidrDetails) 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 MccCacheNodeBgpCidrDetails. +func (m *MccCacheNodeBgpCidrDetails) UnmarshalJSON(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 MccCacheNodeInstallDetails. +func (m MccCacheNodeInstallDetails) 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 MccCacheNodeInstallDetails. +func (m *MccCacheNodeInstallDetails) UnmarshalJSON(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 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 PatchResource. +func (p PatchResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tags", p.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PatchResource. +func (p *PatchResource) UnmarshalJSON(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 "tags": + err = unpopulate(val, "Tags", &p.Tags) + 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 ProxyURLConfiguration. +func (p ProxyURLConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "proxyUrl", p.ProxyURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyURLConfiguration. +func (p *ProxyURLConfiguration) UnmarshalJSON(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 "proxyUrl": + err = unpopulate(val, "ProxyURL", &p.ProxyURL) + 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 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 +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v any) error { + if data == nil || string(data) == "null" { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/operations_client.go b/sdk/resourcemanager/connectedcache/armconnectedcache/operations_client.go similarity index 84% rename from sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/operations_client.go rename to sdk/resourcemanager/connectedcache/armconnectedcache/operations_client.go index b8bc3adcba32..0099d85a32aa 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/operations_client.go +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/operations_client.go @@ -1,12 +1,8 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. -package armworkloadssapvirtualinstance +package armconnectedcache import ( "context" @@ -37,9 +33,9 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO return client, nil } -// NewListPager - Lists all the available API operations under this PR +// NewListPager - List the operations for the provider // -// Generated from API version 2023-10-01-preview +// Generated from API version 2023-05-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]{ @@ -65,14 +61,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.Workloads/operations" +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.ConnectedCache/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") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/operations_client_example_test.go b/sdk/resourcemanager/connectedcache/armconnectedcache/operations_client_example_test.go new file mode 100644 index 000000000000..dbee9b83e9bc --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/operations_client_example_test.go @@ -0,0 +1,56 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armconnectedcache_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/connectedcache/armconnectedcache" + "log" +) + +// Generated from example definition: 2023-05-01-preview/Operations_List_MaximumSet_Gen.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 := armconnectedcache.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 = armconnectedcache.OperationsClientListResponse{ + // OperationListResult: armconnectedcache.OperationListResult{ + // Value: []*armconnectedcache.Operation{ + // { + // Name: to.Ptr("operationName"), + // Display: &armconnectedcache.OperationDisplay{ + // Provider: to.Ptr("providerName"), + // Resource: to.Ptr("resourceName"), + // Operation: to.Ptr("operationName"), + // Description: to.Ptr("zkcugoxocugvzcsedehxwbxiuvrb"), + // }, + // IsDataAction: to.Ptr(true), + // Origin: to.Ptr(armconnectedcache.OriginUser), + // ActionType: to.Ptr(armconnectedcache.ActionTypeInternal), + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/options.go b/sdk/resourcemanager/connectedcache/armconnectedcache/options.go new file mode 100644 index 000000000000..ace5356a6a0d --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/options.go @@ -0,0 +1,234 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armconnectedcache + +// CacheNodesOperationsClientBeginCreateorUpdateOptions contains the optional parameters for the CacheNodesOperationsClient.BeginCreateorUpdate +// method. +type CacheNodesOperationsClientBeginCreateorUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// CacheNodesOperationsClientDeleteOptions contains the optional parameters for the CacheNodesOperationsClient.Delete method. +type CacheNodesOperationsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// CacheNodesOperationsClientGetOptions contains the optional parameters for the CacheNodesOperationsClient.Get method. +type CacheNodesOperationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// CacheNodesOperationsClientListByResourceGroupOptions contains the optional parameters for the CacheNodesOperationsClient.NewListByResourceGroupPager +// method. +type CacheNodesOperationsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// CacheNodesOperationsClientListBySubscriptionOptions contains the optional parameters for the CacheNodesOperationsClient.NewListBySubscriptionPager +// method. +type CacheNodesOperationsClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// CacheNodesOperationsClientUpdateOptions contains the optional parameters for the CacheNodesOperationsClient.Update method. +type CacheNodesOperationsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// EnterpriseCustomerOperationsClientBeginCreateOrUpdateOptions contains the optional parameters for the EnterpriseCustomerOperationsClient.BeginCreateOrUpdate +// method. +type EnterpriseCustomerOperationsClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// EnterpriseCustomerOperationsClientDeleteOptions contains the optional parameters for the EnterpriseCustomerOperationsClient.Delete +// method. +type EnterpriseCustomerOperationsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// EnterpriseCustomerOperationsClientGetOptions contains the optional parameters for the EnterpriseCustomerOperationsClient.Get +// method. +type EnterpriseCustomerOperationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// EnterpriseCustomerOperationsClientListByResourceGroupOptions contains the optional parameters for the EnterpriseCustomerOperationsClient.NewListByResourceGroupPager +// method. +type EnterpriseCustomerOperationsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// EnterpriseCustomerOperationsClientListBySubscriptionOptions contains the optional parameters for the EnterpriseCustomerOperationsClient.NewListBySubscriptionPager +// method. +type EnterpriseCustomerOperationsClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// EnterpriseCustomerOperationsClientUpdateOptions contains the optional parameters for the EnterpriseCustomerOperationsClient.Update +// method. +type EnterpriseCustomerOperationsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// EnterpriseMccCacheNodesOperationsClientBeginCreateOrUpdateOptions contains the optional parameters for the EnterpriseMccCacheNodesOperationsClient.BeginCreateOrUpdate +// method. +type EnterpriseMccCacheNodesOperationsClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// EnterpriseMccCacheNodesOperationsClientBeginDeleteOptions contains the optional parameters for the EnterpriseMccCacheNodesOperationsClient.BeginDelete +// method. +type EnterpriseMccCacheNodesOperationsClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// EnterpriseMccCacheNodesOperationsClientGetCacheNodeInstallDetailsOptions contains the optional parameters for the EnterpriseMccCacheNodesOperationsClient.GetCacheNodeInstallDetails +// method. +type EnterpriseMccCacheNodesOperationsClientGetCacheNodeInstallDetailsOptions struct { + // placeholder for future optional parameters +} + +// EnterpriseMccCacheNodesOperationsClientGetOptions contains the optional parameters for the EnterpriseMccCacheNodesOperationsClient.Get +// method. +type EnterpriseMccCacheNodesOperationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceOptions contains the optional parameters for +// the EnterpriseMccCacheNodesOperationsClient.NewListByEnterpriseMccCustomerResourcePager method. +type EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceOptions struct { + // placeholder for future optional parameters +} + +// EnterpriseMccCacheNodesOperationsClientUpdateOptions contains the optional parameters for the EnterpriseMccCacheNodesOperationsClient.Update +// method. +type EnterpriseMccCacheNodesOperationsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// EnterpriseMccCustomersClientBeginCreateOrUpdateOptions contains the optional parameters for the EnterpriseMccCustomersClient.BeginCreateOrUpdate +// method. +type EnterpriseMccCustomersClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// EnterpriseMccCustomersClientBeginDeleteOptions contains the optional parameters for the EnterpriseMccCustomersClient.BeginDelete +// method. +type EnterpriseMccCustomersClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// EnterpriseMccCustomersClientGetOptions contains the optional parameters for the EnterpriseMccCustomersClient.Get method. +type EnterpriseMccCustomersClientGetOptions struct { + // placeholder for future optional parameters +} + +// EnterpriseMccCustomersClientListByResourceGroupOptions contains the optional parameters for the EnterpriseMccCustomersClient.NewListByResourceGroupPager +// method. +type EnterpriseMccCustomersClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// EnterpriseMccCustomersClientListBySubscriptionOptions contains the optional parameters for the EnterpriseMccCustomersClient.NewListBySubscriptionPager +// method. +type EnterpriseMccCustomersClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// EnterpriseMccCustomersClientUpdateOptions contains the optional parameters for the EnterpriseMccCustomersClient.Update +// method. +type EnterpriseMccCustomersClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// IspCacheNodesOperationsClientBeginCreateOrUpdateOptions contains the optional parameters for the IspCacheNodesOperationsClient.BeginCreateOrUpdate +// method. +type IspCacheNodesOperationsClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// IspCacheNodesOperationsClientBeginDeleteOptions contains the optional parameters for the IspCacheNodesOperationsClient.BeginDelete +// method. +type IspCacheNodesOperationsClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// IspCacheNodesOperationsClientGetBgpCidrsOptions contains the optional parameters for the IspCacheNodesOperationsClient.GetBgpCidrs +// method. +type IspCacheNodesOperationsClientGetBgpCidrsOptions struct { + // placeholder for future optional parameters +} + +// IspCacheNodesOperationsClientGetCacheNodeInstallDetailsOptions contains the optional parameters for the IspCacheNodesOperationsClient.GetCacheNodeInstallDetails +// method. +type IspCacheNodesOperationsClientGetCacheNodeInstallDetailsOptions struct { + // placeholder for future optional parameters +} + +// IspCacheNodesOperationsClientGetOptions contains the optional parameters for the IspCacheNodesOperationsClient.Get method. +type IspCacheNodesOperationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// IspCacheNodesOperationsClientListByIspCustomerResourceOptions contains the optional parameters for the IspCacheNodesOperationsClient.NewListByIspCustomerResourcePager +// method. +type IspCacheNodesOperationsClientListByIspCustomerResourceOptions struct { + // placeholder for future optional parameters +} + +// IspCacheNodesOperationsClientUpdateOptions contains the optional parameters for the IspCacheNodesOperationsClient.Update +// method. +type IspCacheNodesOperationsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// IspCustomersClientBeginCreateOrUpdateOptions contains the optional parameters for the IspCustomersClient.BeginCreateOrUpdate +// method. +type IspCustomersClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// IspCustomersClientBeginDeleteOptions contains the optional parameters for the IspCustomersClient.BeginDelete method. +type IspCustomersClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// IspCustomersClientGetOptions contains the optional parameters for the IspCustomersClient.Get method. +type IspCustomersClientGetOptions struct { + // placeholder for future optional parameters +} + +// IspCustomersClientListByResourceGroupOptions contains the optional parameters for the IspCustomersClient.NewListByResourceGroupPager +// method. +type IspCustomersClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// IspCustomersClientListBySubscriptionOptions contains the optional parameters for the IspCustomersClient.NewListBySubscriptionPager +// method. +type IspCustomersClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// IspCustomersClientUpdateOptions contains the optional parameters for the IspCustomersClient.Update method. +type IspCustomersClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/responses.go b/sdk/resourcemanager/connectedcache/armconnectedcache/responses.go new file mode 100644 index 000000000000..501b070cb846 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/responses.go @@ -0,0 +1,230 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armconnectedcache + +// CacheNodesOperationsClientCreateorUpdateResponse contains the response from method CacheNodesOperationsClient.BeginCreateorUpdate. +type CacheNodesOperationsClientCreateorUpdateResponse struct { + // Concrete tracked resource types can be created by aliasing this type using a specific property type. + CacheNodePreviewResource +} + +// CacheNodesOperationsClientDeleteResponse contains the response from method CacheNodesOperationsClient.Delete. +type CacheNodesOperationsClientDeleteResponse struct { + // placeholder for future response values +} + +// CacheNodesOperationsClientGetResponse contains the response from method CacheNodesOperationsClient.Get. +type CacheNodesOperationsClientGetResponse struct { + // Concrete tracked resource types can be created by aliasing this type using a specific property type. + CacheNodePreviewResource +} + +// CacheNodesOperationsClientListByResourceGroupResponse contains the response from method CacheNodesOperationsClient.NewListByResourceGroupPager. +type CacheNodesOperationsClientListByResourceGroupResponse struct { + // The response of a CacheNodePreviewResource list operation. + CacheNodePreviewResourceListResult +} + +// CacheNodesOperationsClientListBySubscriptionResponse contains the response from method CacheNodesOperationsClient.NewListBySubscriptionPager. +type CacheNodesOperationsClientListBySubscriptionResponse struct { + // The response of a CacheNodePreviewResource list operation. + CacheNodePreviewResourceListResult +} + +// CacheNodesOperationsClientUpdateResponse contains the response from method CacheNodesOperationsClient.Update. +type CacheNodesOperationsClientUpdateResponse struct { + // Concrete tracked resource types can be created by aliasing this type using a specific property type. + CacheNodePreviewResource +} + +// EnterpriseCustomerOperationsClientCreateOrUpdateResponse contains the response from method EnterpriseCustomerOperationsClient.BeginCreateOrUpdate. +type EnterpriseCustomerOperationsClientCreateOrUpdateResponse struct { + // ConnectedCache Resource. Represents the high level Nodes needed to provision CacheNode and customer resources used in private + // preview + EnterprisePreviewResource +} + +// EnterpriseCustomerOperationsClientDeleteResponse contains the response from method EnterpriseCustomerOperationsClient.Delete. +type EnterpriseCustomerOperationsClientDeleteResponse struct { + // placeholder for future response values +} + +// EnterpriseCustomerOperationsClientGetResponse contains the response from method EnterpriseCustomerOperationsClient.Get. +type EnterpriseCustomerOperationsClientGetResponse struct { + // ConnectedCache Resource. Represents the high level Nodes needed to provision CacheNode and customer resources used in private + // preview + EnterprisePreviewResource +} + +// EnterpriseCustomerOperationsClientListByResourceGroupResponse contains the response from method EnterpriseCustomerOperationsClient.NewListByResourceGroupPager. +type EnterpriseCustomerOperationsClientListByResourceGroupResponse struct { + // The response of a EnterprisePreviewResource list operation. + EnterprisePreviewResourceListResult +} + +// EnterpriseCustomerOperationsClientListBySubscriptionResponse contains the response from method EnterpriseCustomerOperationsClient.NewListBySubscriptionPager. +type EnterpriseCustomerOperationsClientListBySubscriptionResponse struct { + // The response of a EnterprisePreviewResource list operation. + EnterprisePreviewResourceListResult +} + +// EnterpriseCustomerOperationsClientUpdateResponse contains the response from method EnterpriseCustomerOperationsClient.Update. +type EnterpriseCustomerOperationsClientUpdateResponse struct { + // ConnectedCache Resource. Represents the high level Nodes needed to provision CacheNode and customer resources used in private + // preview + EnterprisePreviewResource +} + +// EnterpriseMccCacheNodesOperationsClientCreateOrUpdateResponse contains the response from method EnterpriseMccCacheNodesOperationsClient.BeginCreateOrUpdate. +type EnterpriseMccCacheNodesOperationsClientCreateOrUpdateResponse struct { + // Represents the high level Nodes needed to provision cache node resources + EnterpriseMccCacheNodeResource +} + +// EnterpriseMccCacheNodesOperationsClientDeleteResponse contains the response from method EnterpriseMccCacheNodesOperationsClient.BeginDelete. +type EnterpriseMccCacheNodesOperationsClientDeleteResponse struct { + // placeholder for future response values +} + +// EnterpriseMccCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse contains the response from method EnterpriseMccCacheNodesOperationsClient.GetCacheNodeInstallDetails. +type EnterpriseMccCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse struct { + // Mcc cache node resource all install details. + MccCacheNodeInstallDetails +} + +// EnterpriseMccCacheNodesOperationsClientGetResponse contains the response from method EnterpriseMccCacheNodesOperationsClient.Get. +type EnterpriseMccCacheNodesOperationsClientGetResponse struct { + // Represents the high level Nodes needed to provision cache node resources + EnterpriseMccCacheNodeResource +} + +// EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceResponse contains the response from method EnterpriseMccCacheNodesOperationsClient.NewListByEnterpriseMccCustomerResourcePager. +type EnterpriseMccCacheNodesOperationsClientListByEnterpriseMccCustomerResourceResponse struct { + // The response of a EnterpriseMccCacheNodeResource list operation. + EnterpriseMccCacheNodeResourceListResult +} + +// EnterpriseMccCacheNodesOperationsClientUpdateResponse contains the response from method EnterpriseMccCacheNodesOperationsClient.Update. +type EnterpriseMccCacheNodesOperationsClientUpdateResponse struct { + // Represents the high level Nodes needed to provision cache node resources + EnterpriseMccCacheNodeResource +} + +// EnterpriseMccCustomersClientCreateOrUpdateResponse contains the response from method EnterpriseMccCustomersClient.BeginCreateOrUpdate. +type EnterpriseMccCustomersClientCreateOrUpdateResponse struct { + // Represents the high level Nodes needed to provision customer resources + EnterpriseMccCustomerResource +} + +// EnterpriseMccCustomersClientDeleteResponse contains the response from method EnterpriseMccCustomersClient.BeginDelete. +type EnterpriseMccCustomersClientDeleteResponse struct { + // placeholder for future response values +} + +// EnterpriseMccCustomersClientGetResponse contains the response from method EnterpriseMccCustomersClient.Get. +type EnterpriseMccCustomersClientGetResponse struct { + // Represents the high level Nodes needed to provision customer resources + EnterpriseMccCustomerResource +} + +// EnterpriseMccCustomersClientListByResourceGroupResponse contains the response from method EnterpriseMccCustomersClient.NewListByResourceGroupPager. +type EnterpriseMccCustomersClientListByResourceGroupResponse struct { + // The response of a EnterpriseMccCustomerResource list operation. + EnterpriseMccCustomerResourceListResult +} + +// EnterpriseMccCustomersClientListBySubscriptionResponse contains the response from method EnterpriseMccCustomersClient.NewListBySubscriptionPager. +type EnterpriseMccCustomersClientListBySubscriptionResponse struct { + // The response of a EnterpriseMccCustomerResource list operation. + EnterpriseMccCustomerResourceListResult +} + +// EnterpriseMccCustomersClientUpdateResponse contains the response from method EnterpriseMccCustomersClient.Update. +type EnterpriseMccCustomersClientUpdateResponse struct { + // Represents the high level Nodes needed to provision customer resources + EnterpriseMccCustomerResource +} + +// IspCacheNodesOperationsClientCreateOrUpdateResponse contains the response from method IspCacheNodesOperationsClient.BeginCreateOrUpdate. +type IspCacheNodesOperationsClientCreateOrUpdateResponse struct { + // Represents the high level Nodes needed to provision cache node resources + IspCacheNodeResource +} + +// IspCacheNodesOperationsClientDeleteResponse contains the response from method IspCacheNodesOperationsClient.BeginDelete. +type IspCacheNodesOperationsClientDeleteResponse struct { + // placeholder for future response values +} + +// IspCacheNodesOperationsClientGetBgpCidrsResponse contains the response from method IspCacheNodesOperationsClient.GetBgpCidrs. +type IspCacheNodesOperationsClientGetBgpCidrsResponse struct { + // Represents all Cidr details of the Bgp request for a specific cache node resource + MccCacheNodeBgpCidrDetails +} + +// IspCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse contains the response from method IspCacheNodesOperationsClient.GetCacheNodeInstallDetails. +type IspCacheNodesOperationsClientGetCacheNodeInstallDetailsResponse struct { + // Mcc cache node resource all install details. + MccCacheNodeInstallDetails +} + +// IspCacheNodesOperationsClientGetResponse contains the response from method IspCacheNodesOperationsClient.Get. +type IspCacheNodesOperationsClientGetResponse struct { + // Represents the high level Nodes needed to provision cache node resources + IspCacheNodeResource +} + +// IspCacheNodesOperationsClientListByIspCustomerResourceResponse contains the response from method IspCacheNodesOperationsClient.NewListByIspCustomerResourcePager. +type IspCacheNodesOperationsClientListByIspCustomerResourceResponse struct { + // The response of a IspCacheNodeResource list operation. + IspCacheNodeResourceListResult +} + +// IspCacheNodesOperationsClientUpdateResponse contains the response from method IspCacheNodesOperationsClient.Update. +type IspCacheNodesOperationsClientUpdateResponse struct { + // Represents the high level Nodes needed to provision cache node resources + IspCacheNodeResource +} + +// IspCustomersClientCreateOrUpdateResponse contains the response from method IspCustomersClient.BeginCreateOrUpdate. +type IspCustomersClientCreateOrUpdateResponse struct { + // Represents the high level Nodes needed to provision isp customer resources + IspCustomerResource +} + +// IspCustomersClientDeleteResponse contains the response from method IspCustomersClient.BeginDelete. +type IspCustomersClientDeleteResponse struct { + // placeholder for future response values +} + +// IspCustomersClientGetResponse contains the response from method IspCustomersClient.Get. +type IspCustomersClientGetResponse struct { + // Represents the high level Nodes needed to provision isp customer resources + IspCustomerResource +} + +// IspCustomersClientListByResourceGroupResponse contains the response from method IspCustomersClient.NewListByResourceGroupPager. +type IspCustomersClientListByResourceGroupResponse struct { + // The response of a IspCustomerResource list operation. + IspCustomerResourceListResult +} + +// IspCustomersClientListBySubscriptionResponse contains the response from method IspCustomersClient.NewListBySubscriptionPager. +type IspCustomersClientListBySubscriptionResponse struct { + // The response of a IspCustomerResource list operation. + IspCustomerResourceListResult +} + +// IspCustomersClientUpdateResponse contains the response from method IspCustomersClient.Update. +type IspCustomersClientUpdateResponse struct { + // Represents the high level Nodes needed to provision isp customer resources + IspCustomerResource +} + +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. +type OperationsClientListResponse struct { + // 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 +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/time_rfc3339.go b/sdk/resourcemanager/connectedcache/armconnectedcache/time_rfc3339.go new file mode 100644 index 000000000000..80cd130867ef --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/time_rfc3339.go @@ -0,0 +1,109 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armconnectedcache + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) + +const ( + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` +) + +type dateTimeRFC3339 time.Time + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + return err +} + +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + +func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { + return nil + } + var aux dateTimeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/tsp-location.yaml b/sdk/resourcemanager/connectedcache/armconnectedcache/tsp-location.yaml new file mode 100644 index 000000000000..383511ea17a6 --- /dev/null +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/connectedcache/ConnectedCache.Management +commit: df55cd8178ddd870dbd0c3b1e25c80e3ff48826c +repo: Azure/azure-rest-api-specs +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/contoso/armcontoso/CHANGELOG.md b/sdk/resourcemanager/contoso/armcontoso/CHANGELOG.md new file mode 100644 index 000000000000..f4e75a266bbf --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 0.1.0 (2024-11-19) +### Other Changes + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/contoso/armcontoso` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt). \ No newline at end of file diff --git a/sdk/resourcemanager/contoso/armcontoso/LICENSE.txt b/sdk/resourcemanager/contoso/armcontoso/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/resourcemanager/contoso/armcontoso/README.md b/sdk/resourcemanager/contoso/armcontoso/README.md new file mode 100644 index 000000000000..aef1020792c7 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/README.md @@ -0,0 +1,92 @@ +# Azure Contoso Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/contoso/armcontoso)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/contoso/armcontoso) + +The `armcontoso` module provides operations for working with Azure Contoso. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/contoso/armcontoso) + +# Getting started + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.18 or above (You could download and install the latest version of Go from [here](https://go.dev/doc/install). It will replace the existing Go on your machine. If you want to install multiple Go versions on the same machine, you could refer this [doc](https://go.dev/doc/manage-install).) + +## Install the package + +This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management. + +Install the Azure Contoso module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/contoso/armcontoso +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Contoso. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more. + +```go +cred, err := azidentity.NewDefaultAzureCredential(nil) +``` + +For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). + +## Client Factory + +Azure Contoso module consists of one or more clients. We provide a client factory which could be used to create any client in this module. + +```go +clientFactory, err := armcontoso.NewClientFactory(, cred, nil) +``` + +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). + +```go +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, +} +clientFactory, err := armcontoso.NewClientFactory(, cred, &options) +``` + +## Clients + +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.NewEmployeesClient() +``` + +## Fakes + +The fake package contains types used for constructing in-memory fake servers used in unit tests. +This allows writing tests to cover various success/error conditions without the need for connecting to a live service. + +Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes. + +## Provide Feedback + +If you encounter bugs or have suggestions, please +[open an issue](https://github.com/Azure/azure-sdk-for-go/issues) and assign the `Contoso` label. + +# Contributing + +This project welcomes contributions and suggestions. Most contributions require +you to agree to a Contributor License Agreement (CLA) declaring that you have +the right to, and actually do, grant us the rights to use your contribution. +For details, visit [https://cla.microsoft.com](https://cla.microsoft.com). + +When you submit a pull request, a CLA-bot will automatically determine whether +you need to provide a CLA and decorate the PR appropriately (e.g., label, +comment). Simply follow the instructions provided by the bot. You will only +need to do this once across all repos using our CLA. + +This project has adopted the +[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information, see the +[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any +additional questions or comments. \ No newline at end of file diff --git a/sdk/resourcemanager/contoso/armcontoso/ci.yml b/sdk/resourcemanager/contoso/armcontoso/ci.yml new file mode 100644 index 000000000000..a068465b72a2 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/ci.yml @@ -0,0 +1,28 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/contoso/armcontoso/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/contoso/armcontoso/ + +extends: + template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/contoso/armcontoso' diff --git a/sdk/resourcemanager/contoso/armcontoso/client_factory.go b/sdk/resourcemanager/contoso/armcontoso/client_factory.go new file mode 100644 index 000000000000..0a0944ec82c6 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/client_factory.go @@ -0,0 +1,48 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armcontoso + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" +) + +// ClientFactory is a client factory used to create any client in this module. +// Don't use this type directly, use NewClientFactory instead. +type ClientFactory struct { + subscriptionID string + internal *arm.Client +} + +// 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 - The ID of the target subscription. The value must be an UUID. +// - 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) { + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, + internal: internal, + }, nil +} + +// NewEmployeesClient creates a new instance of EmployeesClient. +func (c *ClientFactory) NewEmployeesClient() *EmployeesClient { + return &EmployeesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewOperationsClient creates a new instance of OperationsClient. +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + return &OperationsClient{ + internal: c.internal, + } +} diff --git a/sdk/resourcemanager/contoso/armcontoso/constants.go b/sdk/resourcemanager/contoso/armcontoso/constants.go new file mode 100644 index 000000000000..35ca72f6b867 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/constants.go @@ -0,0 +1,104 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armcontoso + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/contoso/armcontoso" + moduleVersion = "v0.1.0" +) + +// ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +type ActionType string + +const ( + // ActionTypeInternal - Actions are for internal-only APIs. + ActionTypeInternal ActionType = "Internal" +) + +// PossibleActionTypeValues returns the possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ + ActionTypeInternal, + } +} + +// CreatedByType - The kind of entity that created the resource. +type CreatedByType string + +const ( + // CreatedByTypeApplication - The entity was created by an application. + CreatedByTypeApplication CreatedByType = "Application" + // CreatedByTypeKey - The entity was created by a key. + CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeManagedIdentity - The entity was created by a managed identity. + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + // CreatedByTypeUser - The entity was created by a user. + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + +// 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 ( + // OriginSystem - Indicates the operation is initiated by a system. + OriginSystem Origin = "system" + // OriginUser - Indicates the operation is initiated by a user. + OriginUser Origin = "user" + // OriginUserSystem - Indicates the operation is initiated by a user or system. + OriginUserSystem Origin = "user,system" +) + +// PossibleOriginValues returns the possible values for the Origin const type. +func PossibleOriginValues() []Origin { + return []Origin{ + OriginSystem, + OriginUser, + OriginUserSystem, + } +} + +// ProvisioningState - The resource provisioning state. +type ProvisioningState string + +const ( + // ProvisioningStateAccepted - The resource create request has been accepted + ProvisioningStateAccepted ProvisioningState = "Accepted" + // ProvisioningStateCanceled - Resource creation was canceled. + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateDeleting - The resource is being deleted + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed - Resource creation failed. + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateProvisioning - The resource is being provisioned + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + // ProvisioningStateSucceeded - Resource has been created. + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating - The resource is updating + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateAccepted, + ProvisioningStateCanceled, + ProvisioningStateDeleting, + ProvisioningStateFailed, + ProvisioningStateProvisioning, + ProvisioningStateSucceeded, + ProvisioningStateUpdating, + } +} diff --git a/sdk/resourcemanager/contoso/armcontoso/employees_client.go b/sdk/resourcemanager/contoso/armcontoso/employees_client.go new file mode 100644 index 000000000000..311519c051e9 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/employees_client.go @@ -0,0 +1,444 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armcontoso + +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" +) + +// EmployeesClient contains the methods for the Employees group. +// Don't use this type directly, use NewEmployeesClient() instead. +type EmployeesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewEmployeesClient creates a new instance of EmployeesClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewEmployeesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*EmployeesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &EmployeesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a Employee +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - employeeName - The name of the Employee +// - resource - Resource create parameters. +// - options - EmployeesClientBeginCreateOrUpdateOptions contains the optional parameters for the EmployeesClient.BeginCreateOrUpdate +// method. +func (client *EmployeesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, employeeName string, resource Employee, options *EmployeesClientBeginCreateOrUpdateOptions) (*runtime.Poller[EmployeesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, employeeName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[EmployeesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[EmployeesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a Employee +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-10-01-preview +func (client *EmployeesClient) createOrUpdate(ctx context.Context, resourceGroupName string, employeeName string, resource Employee, options *EmployeesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "EmployeesClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, employeeName, resource, 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 +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *EmployeesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, employeeName string, resource Employee, _ *EmployeesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Contoso/employees/{employeeName}" + 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 employeeName == "" { + return nil, errors.New("parameter employeeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{employeeName}", url.PathEscape(employeeName)) + 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", "2021-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Delete a Employee +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - employeeName - The name of the Employee +// - options - EmployeesClientBeginDeleteOptions contains the optional parameters for the EmployeesClient.BeginDelete method. +func (client *EmployeesClient) BeginDelete(ctx context.Context, resourceGroupName string, employeeName string, options *EmployeesClientBeginDeleteOptions) (*runtime.Poller[EmployeesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, employeeName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[EmployeesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[EmployeesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a Employee +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-10-01-preview +func (client *EmployeesClient) deleteOperation(ctx context.Context, resourceGroupName string, employeeName string, options *EmployeesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "EmployeesClient.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, employeeName, 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.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *EmployeesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, employeeName string, _ *EmployeesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Contoso/employees/{employeeName}" + 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 employeeName == "" { + return nil, errors.New("parameter employeeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{employeeName}", url.PathEscape(employeeName)) + 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", "2021-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a Employee +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - employeeName - The name of the Employee +// - options - EmployeesClientGetOptions contains the optional parameters for the EmployeesClient.Get method. +func (client *EmployeesClient) Get(ctx context.Context, resourceGroupName string, employeeName string, options *EmployeesClientGetOptions) (EmployeesClientGetResponse, error) { + var err error + const operationName = "EmployeesClient.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, employeeName, options) + if err != nil { + return EmployeesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return EmployeesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return EmployeesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *EmployeesClient) getCreateRequest(ctx context.Context, resourceGroupName string, employeeName string, _ *EmployeesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Contoso/employees/{employeeName}" + 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 employeeName == "" { + return nil, errors.New("parameter employeeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{employeeName}", url.PathEscape(employeeName)) + 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", "2021-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 *EmployeesClient) getHandleResponse(resp *http.Response) (EmployeesClientGetResponse, error) { + result := EmployeesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Employee); err != nil { + return EmployeesClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List Employee resources by resource group +// +// Generated from API version 2021-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - EmployeesClientListByResourceGroupOptions contains the optional parameters for the EmployeesClient.NewListByResourceGroupPager +// method. +func (client *EmployeesClient) NewListByResourceGroupPager(resourceGroupName string, options *EmployeesClientListByResourceGroupOptions) *runtime.Pager[EmployeesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[EmployeesClientListByResourceGroupResponse]{ + More: func(page EmployeesClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *EmployeesClientListByResourceGroupResponse) (EmployeesClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "EmployeesClient.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 EmployeesClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *EmployeesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *EmployeesClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Contoso/employees" + 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", "2021-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 *EmployeesClient) listByResourceGroupHandleResponse(resp *http.Response) (EmployeesClientListByResourceGroupResponse, error) { + result := EmployeesClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EmployeeListResult); err != nil { + return EmployeesClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List Employee resources by subscription ID +// +// Generated from API version 2021-10-01-preview +// - options - EmployeesClientListBySubscriptionOptions contains the optional parameters for the EmployeesClient.NewListBySubscriptionPager +// method. +func (client *EmployeesClient) NewListBySubscriptionPager(options *EmployeesClientListBySubscriptionOptions) *runtime.Pager[EmployeesClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[EmployeesClientListBySubscriptionResponse]{ + More: func(page EmployeesClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *EmployeesClientListBySubscriptionResponse) (EmployeesClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "EmployeesClient.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 EmployeesClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *EmployeesClient) listBySubscriptionCreateRequest(ctx context.Context, _ *EmployeesClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Contoso/employees" + 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", "2021-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 *EmployeesClient) listBySubscriptionHandleResponse(resp *http.Response) (EmployeesClientListBySubscriptionResponse, error) { + result := EmployeesClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EmployeeListResult); err != nil { + return EmployeesClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// Update - Update a Employee +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - employeeName - The name of the Employee +// - properties - The resource properties to be updated. +// - options - EmployeesClientUpdateOptions contains the optional parameters for the EmployeesClient.Update method. +func (client *EmployeesClient) Update(ctx context.Context, resourceGroupName string, employeeName string, properties Employee, options *EmployeesClientUpdateOptions) (EmployeesClientUpdateResponse, error) { + var err error + const operationName = "EmployeesClient.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, employeeName, properties, options) + if err != nil { + return EmployeesClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return EmployeesClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return EmployeesClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *EmployeesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, employeeName string, properties Employee, _ *EmployeesClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Contoso/employees/{employeeName}" + 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 employeeName == "" { + return nil, errors.New("parameter employeeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{employeeName}", url.PathEscape(employeeName)) + 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", "2021-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *EmployeesClient) updateHandleResponse(resp *http.Response) (EmployeesClientUpdateResponse, error) { + result := EmployeesClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Employee); err != nil { + return EmployeesClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/contoso/armcontoso/employees_client_example_test.go b/sdk/resourcemanager/contoso/armcontoso/employees_client_example_test.go new file mode 100644 index 000000000000..6ab59a44808c --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/employees_client_example_test.go @@ -0,0 +1,302 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armcontoso_test + +import ( + "context" + "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/contoso/armcontoso" + "log" +) + +// Generated from example definition: 2021-10-01-preview/Employees_CreateOrUpdate.json +func ExampleEmployeesClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontoso.NewClientFactory("11809CA1-E126-4017-945E-AA795CD5C5A9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewEmployeesClient().BeginCreateOrUpdate(ctx, "rgopenapi", "9KF-f-8b", armcontoso.Employee{ + Properties: &armcontoso.EmployeeProperties{ + Age: to.Ptr[int32](30), + City: to.Ptr("gydhnntudughbmxlkyzrskcdkotrxn"), + Profile: []byte("ms"), + }, + Tags: map[string]*string{ + "key2913": to.Ptr("urperxmkkhhkp"), + }, + Location: to.Ptr("itajgxyqozseoygnl"), + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %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 = armcontoso.EmployeesClientCreateOrUpdateResponse{ + // Employee: &armcontoso.Employee{ + // Properties: &armcontoso.EmployeeProperties{ + // Age: to.Ptr[int32](30), + // City: to.Ptr("gydhnntudughbmxlkyzrskcdkotrxn"), + // Profile: []byte("ms"), + // ProvisioningState: to.Ptr(armcontoso.ProvisioningStateSucceeded), + // }, + // Tags: map[string]*string{ + // "key2913": to.Ptr("urperxmkkhhkp"), + // }, + // Location: to.Ptr("itajgxyqozseoygnl"), + // ID: to.Ptr("/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/rgopenapi/providers/Microsoft.Contoso/employees/le-8MU--J3W6q8D386p3-iT3"), + // Name: to.Ptr("xepyxhpb"), + // Type: to.Ptr("svvamxrdnnv"), + // SystemData: &armcontoso.SystemData{ + // CreatedBy: to.Ptr("iewyxsnriqktsvp"), + // CreatedByType: to.Ptr(armcontoso.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-19T00:28:48.610Z"); return t}()), + // LastModifiedBy: to.Ptr("xrchbnnuzierzpxw"), + // LastModifiedByType: to.Ptr(armcontoso.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-19T00:28:48.610Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2021-10-01-preview/Employees_Delete.json +func ExampleEmployeesClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontoso.NewClientFactory("11809CA1-E126-4017-945E-AA795CD5C5A9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewEmployeesClient().BeginDelete(ctx, "rgopenapi", "5vX--BxSu3ux48rI4O9OQ569", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: 2021-10-01-preview/Employees_Get.json +func ExampleEmployeesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontoso.NewClientFactory("11809CA1-E126-4017-945E-AA795CD5C5A9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewEmployeesClient().Get(ctx, "rgopenapi", "le-8MU--J3W6q8D386p3-iT3", 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 = armcontoso.EmployeesClientGetResponse{ + // Employee: &armcontoso.Employee{ + // Properties: &armcontoso.EmployeeProperties{ + // Age: to.Ptr[int32](30), + // City: to.Ptr("gydhnntudughbmxlkyzrskcdkotrxn"), + // Profile: []byte("ms"), + // ProvisioningState: to.Ptr(armcontoso.ProvisioningStateSucceeded), + // }, + // Tags: map[string]*string{ + // "key2913": to.Ptr("urperxmkkhhkp"), + // }, + // Location: to.Ptr("itajgxyqozseoygnl"), + // ID: to.Ptr("/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/rgopenapi/providers/Microsoft.Contoso/employees/le-8MU--J3W6q8D386p3-iT3"), + // Name: to.Ptr("xepyxhpb"), + // Type: to.Ptr("svvamxrdnnv"), + // SystemData: &armcontoso.SystemData{ + // CreatedBy: to.Ptr("iewyxsnriqktsvp"), + // CreatedByType: to.Ptr(armcontoso.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-19T00:28:48.610Z"); return t}()), + // LastModifiedBy: to.Ptr("xrchbnnuzierzpxw"), + // LastModifiedByType: to.Ptr(armcontoso.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-19T00:28:48.610Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2021-10-01-preview/Employees_ListByResourceGroup.json +func ExampleEmployeesClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontoso.NewClientFactory("11809CA1-E126-4017-945E-AA795CD5C5A9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewEmployeesClient().NewListByResourceGroupPager("rgopenapi", 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 = armcontoso.EmployeesClientListByResourceGroupResponse{ + // EmployeeListResult: armcontoso.EmployeeListResult{ + // Value: []*armcontoso.Employee{ + // { + // Properties: &armcontoso.EmployeeProperties{ + // Age: to.Ptr[int32](30), + // City: to.Ptr("gydhnntudughbmxlkyzrskcdkotrxn"), + // Profile: []byte("ms"), + // ProvisioningState: to.Ptr(armcontoso.ProvisioningStateSucceeded), + // }, + // Tags: map[string]*string{ + // "key2913": to.Ptr("urperxmkkhhkp"), + // }, + // Location: to.Ptr("itajgxyqozseoygnl"), + // ID: to.Ptr("/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/rgopenapi/providers/Microsoft.Contoso/employees/test"), + // Name: to.Ptr("xepyxhpb"), + // Type: to.Ptr("svvamxrdnnv"), + // SystemData: &armcontoso.SystemData{ + // CreatedBy: to.Ptr("iewyxsnriqktsvp"), + // CreatedByType: to.Ptr(armcontoso.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-19T00:28:48.610Z"); return t}()), + // LastModifiedBy: to.Ptr("xrchbnnuzierzpxw"), + // LastModifiedByType: to.Ptr(armcontoso.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-19T00:28:48.610Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2021-10-01-preview/Employees_ListBySubscription.json +func ExampleEmployeesClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontoso.NewClientFactory("11809CA1-E126-4017-945E-AA795CD5C5A9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewEmployeesClient().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 = armcontoso.EmployeesClientListBySubscriptionResponse{ + // EmployeeListResult: armcontoso.EmployeeListResult{ + // Value: []*armcontoso.Employee{ + // { + // Properties: &armcontoso.EmployeeProperties{ + // Age: to.Ptr[int32](30), + // City: to.Ptr("gydhnntudughbmxlkyzrskcdkotrxn"), + // Profile: []byte("ms"), + // ProvisioningState: to.Ptr(armcontoso.ProvisioningStateSucceeded), + // }, + // Tags: map[string]*string{ + // "key2913": to.Ptr("urperxmkkhhkp"), + // }, + // Location: to.Ptr("itajgxyqozseoygnl"), + // ID: to.Ptr("/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/rgopenapi/providers/Microsoft.Contoso/employees/test"), + // Name: to.Ptr("xepyxhpb"), + // Type: to.Ptr("svvamxrdnnv"), + // SystemData: &armcontoso.SystemData{ + // CreatedBy: to.Ptr("iewyxsnriqktsvp"), + // CreatedByType: to.Ptr(armcontoso.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-19T00:28:48.610Z"); return t}()), + // LastModifiedBy: to.Ptr("xrchbnnuzierzpxw"), + // LastModifiedByType: to.Ptr(armcontoso.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-19T00:28:48.610Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2021-10-01-preview/Employees_Update.json +func ExampleEmployeesClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontoso.NewClientFactory("11809CA1-E126-4017-945E-AA795CD5C5A9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewEmployeesClient().Update(ctx, "rgopenapi", "-XhyNJ--", armcontoso.Employee{ + Tags: map[string]*string{ + "key7952": to.Ptr("no"), + }, + Properties: &armcontoso.EmployeeProperties{ + Age: to.Ptr[int32](24), + City: to.Ptr("uyfg"), + Profile: []byte("oapgijcswfkruiuuzbwco"), + }, + }, 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 = armcontoso.EmployeesClientUpdateResponse{ + // Employee: &armcontoso.Employee{ + // Properties: &armcontoso.EmployeeProperties{ + // Age: to.Ptr[int32](30), + // City: to.Ptr("gydhnntudughbmxlkyzrskcdkotrxn"), + // Profile: []byte("ms"), + // ProvisioningState: to.Ptr(armcontoso.ProvisioningStateSucceeded), + // }, + // Tags: map[string]*string{ + // "key2913": to.Ptr("urperxmkkhhkp"), + // }, + // Location: to.Ptr("itajgxyqozseoygnl"), + // ID: to.Ptr("/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/contoso/providers/Microsoft.Contoso/employees/test"), + // Name: to.Ptr("xepyxhpb"), + // Type: to.Ptr("svvamxrdnnv"), + // SystemData: &armcontoso.SystemData{ + // CreatedBy: to.Ptr("iewyxsnriqktsvp"), + // CreatedByType: to.Ptr(armcontoso.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-19T00:28:48.610Z"); return t}()), + // LastModifiedBy: to.Ptr("xrchbnnuzierzpxw"), + // LastModifiedByType: to.Ptr(armcontoso.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-19T00:28:48.610Z"); return t}()), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/contoso/armcontoso/fake/employees_server.go b/sdk/resourcemanager/contoso/armcontoso/fake/employees_server.go new file mode 100644 index 000000000000..cd478a5d611e --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/fake/employees_server.go @@ -0,0 +1,361 @@ +// 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) Go Code Generator. DO NOT EDIT. + +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/contoso/armcontoso" + "net/http" + "net/url" + "regexp" +) + +// EmployeesServer is a fake server for instances of the armcontoso.EmployeesClient type. +type EmployeesServer struct { + // BeginCreateOrUpdate is the fake for method EmployeesClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, employeeName string, resource armcontoso.Employee, options *armcontoso.EmployeesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armcontoso.EmployeesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method EmployeesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, employeeName string, options *armcontoso.EmployeesClientBeginDeleteOptions) (resp azfake.PollerResponder[armcontoso.EmployeesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method EmployeesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, employeeName string, options *armcontoso.EmployeesClientGetOptions) (resp azfake.Responder[armcontoso.EmployeesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method EmployeesClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armcontoso.EmployeesClientListByResourceGroupOptions) (resp azfake.PagerResponder[armcontoso.EmployeesClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method EmployeesClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armcontoso.EmployeesClientListBySubscriptionOptions) (resp azfake.PagerResponder[armcontoso.EmployeesClientListBySubscriptionResponse]) + + // Update is the fake for method EmployeesClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, employeeName string, properties armcontoso.Employee, options *armcontoso.EmployeesClientUpdateOptions) (resp azfake.Responder[armcontoso.EmployeesClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewEmployeesServerTransport creates a new instance of EmployeesServerTransport with the provided implementation. +// The returned EmployeesServerTransport instance is connected to an instance of armcontoso.EmployeesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewEmployeesServerTransport(srv *EmployeesServer) *EmployeesServerTransport { + return &EmployeesServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armcontoso.EmployeesClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armcontoso.EmployeesClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armcontoso.EmployeesClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armcontoso.EmployeesClientListBySubscriptionResponse]](), + } +} + +// EmployeesServerTransport connects instances of armcontoso.EmployeesClient to instances of EmployeesServer. +// Don't use this type directly, use NewEmployeesServerTransport instead. +type EmployeesServerTransport struct { + srv *EmployeesServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armcontoso.EmployeesClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armcontoso.EmployeesClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armcontoso.EmployeesClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armcontoso.EmployeesClientListBySubscriptionResponse]] +} + +// Do implements the policy.Transporter interface for EmployeesServerTransport. +func (e *EmployeesServerTransport) 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")} + } + + return e.dispatchToMethodFake(req, method) +} + +func (e *EmployeesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if employeesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = employeesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "EmployeesClient.BeginCreateOrUpdate": + res.resp, res.err = e.dispatchBeginCreateOrUpdate(req) + case "EmployeesClient.BeginDelete": + res.resp, res.err = e.dispatchBeginDelete(req) + case "EmployeesClient.Get": + res.resp, res.err = e.dispatchGet(req) + case "EmployeesClient.NewListByResourceGroupPager": + res.resp, res.err = e.dispatchNewListByResourceGroupPager(req) + case "EmployeesClient.NewListBySubscriptionPager": + res.resp, res.err = e.dispatchNewListBySubscriptionPager(req) + case "EmployeesClient.Update": + res.resp, res.err = e.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (e *EmployeesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if e.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := e.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Contoso/employees/(?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[armcontoso.Employee](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + employeeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("employeeName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, employeeNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + e.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + e.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + e.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (e *EmployeesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if e.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := e.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Contoso/employees/(?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 + } + employeeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("employeeName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginDelete(req.Context(), resourceGroupNameParam, employeeNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + e.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) { + e.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) { + e.beginDelete.remove(req) + } + + return resp, nil +} + +func (e *EmployeesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if e.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\.Contoso/employees/(?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 + } + employeeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("employeeName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.Get(req.Context(), resourceGroupNameParam, employeeNameParam, 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).Employee, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (e *EmployeesServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if e.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := e.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Contoso/employees` + 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 := e.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + e.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armcontoso.EmployeesClientListByResourceGroupResponse, 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) { + e.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + e.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (e *EmployeesServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if e.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := e.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Contoso/employees` + 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 := e.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + e.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armcontoso.EmployeesClientListBySubscriptionResponse, 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) { + e.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + e.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (e *EmployeesServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if e.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\.Contoso/employees/(?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[armcontoso.Employee](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + employeeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("employeeName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.Update(req.Context(), resourceGroupNameParam, employeeNameParam, 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).Employee, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to EmployeesServerTransport +var employeesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/contoso/armcontoso/fake/internal.go b/sdk/resourcemanager/contoso/armcontoso/fake/internal.go new file mode 100644 index 000000000000..7425b6a669e2 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/fake/internal.go @@ -0,0 +1,65 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "net/http" + "sync" +) + +type result struct { + resp *http.Response + err error +} + +type nonRetriableError struct { + error +} + +func (nonRetriableError) NonRetriable() { + // marker method +} + +func contains[T comparable](s []T, v T) bool { + for _, vv := range s { + if vv == v { + return true + } + } + return false +} + +func newTracker[T any]() *tracker[T] { + return &tracker[T]{ + items: map[string]*T{}, + } +} + +type tracker[T any] struct { + items map[string]*T + mu sync.Mutex +} + +func (p *tracker[T]) get(req *http.Request) *T { + p.mu.Lock() + defer p.mu.Unlock() + if item, ok := p.items[server.SanitizePagerPollerPath(req.URL.Path)]; ok { + return item + } + return nil +} + +func (p *tracker[T]) add(req *http.Request, item *T) { + p.mu.Lock() + defer p.mu.Unlock() + p.items[server.SanitizePagerPollerPath(req.URL.Path)] = item +} + +func (p *tracker[T]) remove(req *http.Request) { + p.mu.Lock() + defer p.mu.Unlock() + delete(p.items, server.SanitizePagerPollerPath(req.URL.Path)) +} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/operations_server.go b/sdk/resourcemanager/contoso/armcontoso/fake/operations_server.go similarity index 56% rename from sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/operations_server.go rename to sdk/resourcemanager/contoso/armcontoso/fake/operations_server.go index 3a4100f996de..c33444bdc46a 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/operations_server.go +++ b/sdk/resourcemanager/contoso/armcontoso/fake/operations_server.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -15,32 +11,32 @@ import ( "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/hybridconnectivity/armhybridconnectivity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/contoso/armcontoso" "net/http" ) -// OperationsServer is a fake server for instances of the armhybridconnectivity.OperationsClient type. +// OperationsServer is a fake server for instances of the armcontoso.OperationsClient type. type OperationsServer struct { // NewListPager is the fake for method OperationsClient.NewListPager // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armhybridconnectivity.OperationsClientListOptions) (resp azfake.PagerResponder[armhybridconnectivity.OperationsClientListResponse]) + NewListPager func(options *armcontoso.OperationsClientListOptions) (resp azfake.PagerResponder[armcontoso.OperationsClientListResponse]) } // NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. -// The returned OperationsServerTransport instance is connected to an instance of armhybridconnectivity.OperationsClient via the +// The returned OperationsServerTransport instance is connected to an instance of armcontoso.OperationsClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewOperationsServerTransport(srv *OperationsServer) *OperationsServerTransport { return &OperationsServerTransport{ srv: srv, - newListPager: newTracker[azfake.PagerResponder[armhybridconnectivity.OperationsClientListResponse]](), + newListPager: newTracker[azfake.PagerResponder[armcontoso.OperationsClientListResponse]](), } } -// OperationsServerTransport connects instances of armhybridconnectivity.OperationsClient to instances of OperationsServer. +// OperationsServerTransport connects instances of armcontoso.OperationsClient to instances of OperationsServer. // Don't use this type directly, use NewOperationsServerTransport instead. type OperationsServerTransport struct { srv *OperationsServer - newListPager *tracker[azfake.PagerResponder[armhybridconnectivity.OperationsClientListResponse]] + newListPager *tracker[azfake.PagerResponder[armcontoso.OperationsClientListResponse]] } // Do implements the policy.Transporter interface for OperationsServerTransport. @@ -51,21 +47,40 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return o.dispatchToMethodFake(req, method) +} - switch method { - case "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -77,7 +92,7 @@ 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 *armhybridconnectivity.OperationsClientListResponse, createLink func() string) { + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcontoso.OperationsClientListResponse, createLink func() string) { page.NextLink = to.Ptr(createLink()) }) } @@ -94,3 +109,9 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/contoso/armcontoso/fake/server_factory.go b/sdk/resourcemanager/contoso/armcontoso/fake/server_factory.go new file mode 100644 index 000000000000..9ddfd8463c5a --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/fake/server_factory.go @@ -0,0 +1,79 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" + "sync" +) + +// ServerFactory is a fake server for instances of the armcontoso.ClientFactory type. +type ServerFactory struct { + // EmployeesServer contains the fakes for client EmployeesClient + EmployeesServer EmployeesServer + + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer +} + +// NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. +// The returned ServerFactoryTransport instance is connected to an instance of armcontoso.ClientFactory via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { + return &ServerFactoryTransport{ + srv: srv, + } +} + +// ServerFactoryTransport connects instances of armcontoso.ClientFactory to instances of ServerFactory. +// Don't use this type directly, use NewServerFactoryTransport instead. +type ServerFactoryTransport struct { + srv *ServerFactory + trMu sync.Mutex + trEmployeesServer *EmployeesServerTransport + trOperationsServer *OperationsServerTransport +} + +// Do implements the policy.Transporter interface for ServerFactoryTransport. +func (s *ServerFactoryTransport) 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")} + } + + client := method[:strings.Index(method, ".")] + var resp *http.Response + var err error + + switch client { + case "EmployeesClient": + initServer(s, &s.trEmployeesServer, func() *EmployeesServerTransport { return NewEmployeesServerTransport(&s.srv.EmployeesServer) }) + resp, err = s.trEmployeesServer.Do(req) + case "OperationsClient": + initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) + resp, err = s.trOperationsServer.Do(req) + default: + err = fmt.Errorf("unhandled client %s", client) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func initServer[T any](s *ServerFactoryTransport, dst **T, src func() *T) { + s.trMu.Lock() + if *dst == nil { + *dst = src() + } + s.trMu.Unlock() +} diff --git a/sdk/resourcemanager/contoso/armcontoso/fake/time_rfc3339.go b/sdk/resourcemanager/contoso/armcontoso/fake/time_rfc3339.go new file mode 100644 index 000000000000..87ee11e83b32 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/fake/time_rfc3339.go @@ -0,0 +1,109 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) + +const ( + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` +) + +type dateTimeRFC3339 time.Time + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + return err +} + +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + +func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { + return nil + } + var aux dateTimeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/contoso/armcontoso/go.mod b/sdk/resourcemanager/contoso/armcontoso/go.mod new file mode 100644 index 000000000000..be8cf57f99ca --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/go.mod @@ -0,0 +1,21 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/contoso/armcontoso + +go 1.18 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 +) + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect + github.com/golang-jwt/jwt/v5 v5.2.1 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect + github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect + golang.org/x/crypto v0.27.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/text v0.18.0 // indirect +) diff --git a/sdk/resourcemanager/contoso/armcontoso/go.sum b/sdk/resourcemanager/contoso/armcontoso/go.sum new file mode 100644 index 000000000000..cbddbbd9ecec --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/go.sum @@ -0,0 +1,29 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 h1:JZg6HRh6W6U4OLl6lk7BZ7BLisIzM9dG1R50zUk9C/M= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0/go.mod h1:YL1xnZ6QejvQHWJrX/AvhFl4WW4rqHVoKspWNVwFk0M= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= +github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/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-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/contoso/armcontoso/models.go b/sdk/resourcemanager/contoso/armcontoso/models.go new file mode 100644 index 000000000000..707e3fe63289 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/models.go @@ -0,0 +1,125 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armcontoso + +import "time" + +// Employee resource +type Employee struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *EmployeeProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; The name of the Employee + Name *string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *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 +} + +// EmployeeListResult - The response of a Employee list operation. +type EmployeeListResult struct { + // REQUIRED; The Employee items on this page + Value []*Employee + + // The link to the next page of items + NextLink *string +} + +// EmployeeProperties - Employee properties +type EmployeeProperties struct { + // Age of employee + Age *int32 + + // City of employee + City *string + + // Profile of employee + Profile []byte + + // READ-ONLY; The status of the last operation. + ProvisioningState *ProvisioningState +} + +// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +type Operation struct { + // Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + ActionType *ActionType + + // READ-ONLY; Localized display information for this particular operation. + Display *OperationDisplay + + // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure + // Resource Manager/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 and 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 { + // REQUIRED; The Operation items on this page + Value []*Operation + + // The link to the next page of items + NextLink *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 +} diff --git a/sdk/resourcemanager/contoso/armcontoso/models_serde.go b/sdk/resourcemanager/contoso/armcontoso/models_serde.go new file mode 100644 index 000000000000..b3254af63ba4 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/models_serde.go @@ -0,0 +1,328 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armcontoso + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type Employee. +func (e Employee) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", e.ID) + populate(objectMap, "location", e.Location) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "systemData", e.SystemData) + populate(objectMap, "tags", e.Tags) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Employee. +func (e *Employee) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &e.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &e.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EmployeeListResult. +func (e EmployeeListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EmployeeListResult. +func (e *EmployeeListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + 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", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EmployeeProperties. +func (e EmployeeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "age", e.Age) + populate(objectMap, "city", e.City) + populateByteArray(objectMap, "profile", e.Profile, func() any { + return runtime.EncodeByteArray(e.Profile, runtime.Base64URLFormat) + }) + populate(objectMap, "provisioningState", e.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EmployeeProperties. +func (e *EmployeeProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "age": + err = unpopulate(val, "Age", &e.Age) + delete(rawMsg, key) + case "city": + err = unpopulate(val, "City", &e.City) + delete(rawMsg, key) + case "profile": + if val != nil && string(val) != "null" { + err = runtime.DecodeByteArray(string(val), &e.Profile, runtime.Base64URLFormat) + } + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + 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) { + 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 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 +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func populateByteArray[T any](m map[string]any, k string, b []T, convert func() any) { + if azcore.IsNullValue(b) { + m[k] = nil + } else if len(b) == 0 { + return + } else { + m[k] = convert() + } +} + +func unpopulate(data json.RawMessage, fn string, v any) error { + if data == nil || string(data) == "null" { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/contoso/armcontoso/operations_client.go b/sdk/resourcemanager/contoso/armcontoso/operations_client.go new file mode 100644 index 000000000000..2a060162ef11 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/operations_client.go @@ -0,0 +1,84 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armcontoso + +import ( + "context" + "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" +) + +// OperationsClient contains the methods for the Operations group. +// Don't use this type directly, use NewOperationsClient() instead. +type OperationsClient struct { + internal *arm.Client +} + +// NewOperationsClient creates a new instance of OperationsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &OperationsClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - List the operations for the provider +// +// Generated from API version 2021-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 page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.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, options) + }, nil) + if err != nil { + return OperationsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Contoso/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", "2021-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { + result := OperationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { + return OperationsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/contoso/armcontoso/operations_client_example_test.go b/sdk/resourcemanager/contoso/armcontoso/operations_client_example_test.go new file mode 100644 index 000000000000..1dfcba0118e7 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/operations_client_example_test.go @@ -0,0 +1,56 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armcontoso_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/contoso/armcontoso" + "log" +) + +// Generated from example definition: 2021-10-01-preview/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 := armcontoso.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 = armcontoso.OperationsClientListResponse{ + // OperationListResult: armcontoso.OperationListResult{ + // Value: []*armcontoso.Operation{ + // { + // Name: to.Ptr("ymeow"), + // IsDataAction: to.Ptr(true), + // Display: &armcontoso.OperationDisplay{ + // Provider: to.Ptr("qxyznq"), + // Resource: to.Ptr("bqfwkox"), + // Operation: to.Ptr("td"), + // Description: to.Ptr("yvgkhsuwartgxb"), + // }, + // Origin: to.Ptr(armcontoso.OriginUser), + // ActionType: to.Ptr(armcontoso.ActionTypeInternal), + // }, + // }, + // NextLink: to.Ptr("https://sample.com/nextLink"), + // }, + // } + } +} diff --git a/sdk/resourcemanager/contoso/armcontoso/options.go b/sdk/resourcemanager/contoso/armcontoso/options.go new file mode 100644 index 000000000000..11fee1c76771 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/options.go @@ -0,0 +1,45 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armcontoso + +// EmployeesClientBeginCreateOrUpdateOptions contains the optional parameters for the EmployeesClient.BeginCreateOrUpdate +// method. +type EmployeesClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// EmployeesClientBeginDeleteOptions contains the optional parameters for the EmployeesClient.BeginDelete method. +type EmployeesClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// EmployeesClientGetOptions contains the optional parameters for the EmployeesClient.Get method. +type EmployeesClientGetOptions struct { + // placeholder for future optional parameters +} + +// EmployeesClientListByResourceGroupOptions contains the optional parameters for the EmployeesClient.NewListByResourceGroupPager +// method. +type EmployeesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// EmployeesClientListBySubscriptionOptions contains the optional parameters for the EmployeesClient.NewListBySubscriptionPager +// method. +type EmployeesClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// EmployeesClientUpdateOptions contains the optional parameters for the EmployeesClient.Update method. +type EmployeesClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/contoso/armcontoso/responses.go b/sdk/resourcemanager/contoso/armcontoso/responses.go new file mode 100644 index 000000000000..9b28221cf0cb --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/responses.go @@ -0,0 +1,46 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armcontoso + +// EmployeesClientCreateOrUpdateResponse contains the response from method EmployeesClient.BeginCreateOrUpdate. +type EmployeesClientCreateOrUpdateResponse struct { + // Employee resource + Employee +} + +// EmployeesClientDeleteResponse contains the response from method EmployeesClient.BeginDelete. +type EmployeesClientDeleteResponse struct { + // placeholder for future response values +} + +// EmployeesClientGetResponse contains the response from method EmployeesClient.Get. +type EmployeesClientGetResponse struct { + // Employee resource + Employee +} + +// EmployeesClientListByResourceGroupResponse contains the response from method EmployeesClient.NewListByResourceGroupPager. +type EmployeesClientListByResourceGroupResponse struct { + // The response of a Employee list operation. + EmployeeListResult +} + +// EmployeesClientListBySubscriptionResponse contains the response from method EmployeesClient.NewListBySubscriptionPager. +type EmployeesClientListBySubscriptionResponse struct { + // The response of a Employee list operation. + EmployeeListResult +} + +// EmployeesClientUpdateResponse contains the response from method EmployeesClient.Update. +type EmployeesClientUpdateResponse struct { + // Employee resource + Employee +} + +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. +type OperationsClientListResponse struct { + // 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 +} diff --git a/sdk/resourcemanager/contoso/armcontoso/time_rfc3339.go b/sdk/resourcemanager/contoso/armcontoso/time_rfc3339.go new file mode 100644 index 000000000000..fd129d84c771 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/time_rfc3339.go @@ -0,0 +1,109 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armcontoso + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) + +const ( + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` +) + +type dateTimeRFC3339 time.Time + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + return err +} + +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + +func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { + return nil + } + var aux dateTimeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/contoso/armcontoso/tsp-location.yaml b/sdk/resourcemanager/contoso/armcontoso/tsp-location.yaml new file mode 100644 index 000000000000..3d9d18a2205b --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/contosowidgetmanager/Contoso.Management +commit: df55cd8178ddd870dbd0c3b1e25c80e3ff48826c +repo: Azure/azure-rest-api-specs +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/CHANGELOG.md b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/CHANGELOG.md index 30f1580b8077..e027a35ecb4b 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/CHANGELOG.md +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/CHANGELOG.md @@ -1,5 +1,45 @@ # Release History +## 1.0.0 (2024-11-19) +### Breaking Changes + +- Type of `AgentProfile.ResourcePredictions` has been changed from `any` to `*ResourcePredictions` +- Type of `PoolUpdateProperties.AgentProfile` has been changed from `AgentProfileUpdateClassification` to `AgentProfileClassification` +- Type of `Quota.Name` has been changed from `*string` to `*QuotaName` +- Type of `Stateful.ResourcePredictions` has been changed from `any` to `*ResourcePredictions` +- Type of `StatelessAgentProfile.ResourcePredictions` has been changed from `any` to `*ResourcePredictions` +- Enum `ActionType` has been removed +- Enum `Origin` has been removed +- Function `*AgentProfileUpdate.GetAgentProfileUpdate` has been removed +- Function `*AutomaticResourcePredictionsProfileUpdate.GetResourcePredictionsProfileUpdate` has been removed +- Function `*ManualResourcePredictionsProfileUpdate.GetResourcePredictionsProfileUpdate` has been removed +- Function `*OperationsClient.NewListPager` has been removed +- Function `*ResourcePredictionsProfileUpdate.GetResourcePredictionsProfileUpdate` has been removed +- Function `*StatefulUpdate.GetAgentProfileUpdate` has been removed +- Function `*StatelessAgentProfileUpdate.GetAgentProfileUpdate` has been removed +- Function `*SubscriptionUsagesClient.NewListByLocationPager` has been removed +- Struct `AutomaticResourcePredictionsProfileUpdate` has been removed +- Struct `ManualResourcePredictionsProfileUpdate` has been removed +- Struct `Operation` has been removed +- Struct `OperationDisplay` has been removed +- Struct `OperationListResult` has been removed +- Struct `QuotaListResult` has been removed +- Struct `QuotaProperties` has been removed +- Struct `StatefulUpdate` has been removed +- Struct `StatelessAgentProfileUpdate` has been removed +- Field `Properties`, `SystemData`, `Type` of struct `Quota` has been removed + +### Features Added + +- New function `*OperationsClient.NewlistMethodPager(*operationsClientlistMethodOptions) *runtime.Pager[operationsClientlistMethodResponse]` +- New function `PossibleactionTypeValues() []actionType` +- New function `PossibleoriginValues() []origin` +- New function `*SubscriptionUsagesClient.NewUsagesPager(string, *SubscriptionUsagesClientUsagesOptions) *runtime.Pager[SubscriptionUsagesClientUsagesResponse]` +- New struct `PagedQuota` +- New struct `ResourcePredictions` +- New field `CurrentValue`, `Limit`, `Unit` in struct `Quota` + + ## 0.1.0 (2024-05-24) ### Other Changes diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/autorest.md b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/autorest.md deleted file mode 100644 index 2ea4855f1b0b..000000000000 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/autorest.md +++ /dev/null @@ -1,13 +0,0 @@ -### AutoRest Configuration - -> see https://aka.ms/autorest - -``` yaml -azure-arm: true -require: -- https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/devopsinfrastructure/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/devopsinfrastructure/resource-manager/readme.go.md -license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 -tag: package-preview-2024-04 -``` \ No newline at end of file diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/build.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/build.go deleted file mode 100644 index 22c30d6f8220..000000000000 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/build.go +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. - -// This file enables 'go generate' to regenerate this specific SDK -//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate -alwaysSetBodyParamRequired -removeUnreferencedTypes resourcemanager/devopsinfrastructure/armdevopsinfrastructure - -package armdevopsinfrastructure diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/client_factory.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/client_factory.go index 09bab6db20b0..1f7ea53e09ba 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/client_factory.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/client_factory.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdevopsinfrastructure diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/constants.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/constants.go index cbed5af7fe2f..e0a423a1402a 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/constants.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/constants.go @@ -1,32 +1,14 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdevopsinfrastructure const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure" - moduleVersion = "v0.1.0" -) - -// ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. -type ActionType string - -const ( - ActionTypeInternal ActionType = "Internal" + moduleVersion = "v1.0.0" ) -// PossibleActionTypeValues returns the possible values for the ActionType const type. -func PossibleActionTypeValues() []ActionType { - return []ActionType{ - ActionTypeInternal, - } -} - // AzureDevOpsPermissionType - Determines who has admin permissions to the Azure DevOps pool. type AzureDevOpsPermissionType string @@ -69,14 +51,18 @@ func PossibleCachingTypeValues() []CachingType { } } -// CreatedByType - The type of identity that created the resource. +// CreatedByType - The kind of entity that created the resource. type CreatedByType string const ( - CreatedByTypeApplication CreatedByType = "Application" - CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeApplication - The entity was created by an application. + CreatedByTypeApplication CreatedByType = "Application" + // CreatedByTypeKey - The entity was created by a key. + CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeManagedIdentity - The entity was created by a managed identity. CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - CreatedByTypeUser CreatedByType = "User" + // CreatedByTypeUser - The entity was created by a user. + CreatedByTypeUser CreatedByType = "User" ) // PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. @@ -111,10 +97,14 @@ func PossibleLogonTypeValues() []LogonType { type ManagedServiceIdentityType string const ( - ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" - ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned" + // ManagedServiceIdentityTypeNone - No managed identity. + ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" + // ManagedServiceIdentityTypeSystemAssigned - System assigned managed identity. + ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned" + // ManagedServiceIdentityTypeSystemAssignedUserAssigned - System and user assigned managed identity. ManagedServiceIdentityTypeSystemAssignedUserAssigned ManagedServiceIdentityType = "SystemAssigned,UserAssigned" - ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" + // ManagedServiceIdentityTypeUserAssigned - User assigned managed identity. + ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" ) // PossibleManagedServiceIdentityTypeValues returns the possible values for the ManagedServiceIdentityType const type. @@ -127,25 +117,6 @@ func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { } } -// 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 ( - OriginSystem Origin = "system" - OriginUser Origin = "user" - OriginUserSystem Origin = "user,system" -) - -// PossibleOriginValues returns the possible values for the Origin const type. -func PossibleOriginValues() []Origin { - return []Origin{ - OriginSystem, - OriginUser, - OriginUserSystem, - } -} - // OsDiskStorageAccountType - The storage account type of the OS disk. type OsDiskStorageAccountType string @@ -245,11 +216,14 @@ func PossibleResourcePredictionsProfileTypeValues() []ResourcePredictionsProfile } } +// ResourceSKURestrictionsReasonCode - Describes the reason for SKU restriction. type ResourceSKURestrictionsReasonCode string const ( + // ResourceSKURestrictionsReasonCodeNotAvailableForSubscription - The restriction is not available for this subscription. ResourceSKURestrictionsReasonCodeNotAvailableForSubscription ResourceSKURestrictionsReasonCode = "NotAvailableForSubscription" - ResourceSKURestrictionsReasonCodeQuotaID ResourceSKURestrictionsReasonCode = "QuotaId" + // ResourceSKURestrictionsReasonCodeQuotaID - The restriction is due to exceeding a quota limitation. + ResourceSKURestrictionsReasonCodeQuotaID ResourceSKURestrictionsReasonCode = "QuotaId" ) // PossibleResourceSKURestrictionsReasonCodeValues returns the possible values for the ResourceSKURestrictionsReasonCode const type. @@ -260,11 +234,14 @@ func PossibleResourceSKURestrictionsReasonCodeValues() []ResourceSKURestrictions } } +// ResourceSKURestrictionsType - Describes the kind of SKU restrictions that can exist type ResourceSKURestrictionsType string const ( + // ResourceSKURestrictionsTypeLocation - SKU restricted by location. ResourceSKURestrictionsTypeLocation ResourceSKURestrictionsType = "Location" - ResourceSKURestrictionsTypeZone ResourceSKURestrictionsType = "Zone" + // ResourceSKURestrictionsTypeZone - SKU restricted by availability zone. + ResourceSKURestrictionsTypeZone ResourceSKURestrictionsType = "Zone" ) // PossibleResourceSKURestrictionsTypeValues returns the possible values for the ResourceSKURestrictionsType const type. @@ -346,3 +323,40 @@ func PossibleStorageAccountTypeValues() []StorageAccountType { StorageAccountTypeStandardSSDZRS, } } + +// actionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +type actionType string + +const ( + // actionTypeInternal - Actions are for internal-only APIs. + actionTypeInternal actionType = "Internal" +) + +// PossibleactionTypeValues returns the possible values for the actionType const type. +func PossibleactionTypeValues() []actionType { + return []actionType{ + actionTypeInternal, + } +} + +// 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 ( + // originSystem - Indicates the operation is initiated by a system. + originSystem origin = "system" + // originUser - Indicates the operation is initiated by a user. + originUser origin = "user" + // originUserSystem - Indicates the operation is initiated by a user or system. + originUserSystem origin = "user,system" +) + +// PossibleoriginValues returns the possible values for the origin const type. +func PossibleoriginValues() []origin { + return []origin{ + originSystem, + originUser, + originUserSystem, + } +} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/imageversions_server.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/imageversions_server.go index d9ec0b40e596..f1deb466d4ac 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/imageversions_server.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/imageversions_server.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -53,21 +49,40 @@ func (i *ImageVersionsServerTransport) Do(req *http.Request) (*http.Response, er return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return i.dispatchToMethodFake(req, method) +} - switch method { - case "ImageVersionsClient.NewListByImagePager": - resp, err = i.dispatchNewListByImagePager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (i *ImageVersionsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if imageVersionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = imageVersionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ImageVersionsClient.NewListByImagePager": + res.resp, res.err = i.dispatchNewListByImagePager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (i *ImageVersionsServerTransport) dispatchNewListByImagePager(req *http.Request) (*http.Response, error) { @@ -110,3 +125,9 @@ func (i *ImageVersionsServerTransport) dispatchNewListByImagePager(req *http.Req } return resp, nil } + +// set this to conditionally intercept incoming requests to ImageVersionsServerTransport +var imageVersionsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/internal.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/internal.go index 5f75802a569e..7425b6a669e2 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/internal.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/internal.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -14,6 +10,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/pools_server.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/pools_server.go index 9df8c0a1cbea..170370591c3f 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/pools_server.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/pools_server.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -29,7 +25,7 @@ type PoolsServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, poolName string, resource armdevopsinfrastructure.Pool, options *armdevopsinfrastructure.PoolsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armdevopsinfrastructure.PoolsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method PoolsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, poolName string, options *armdevopsinfrastructure.PoolsClientBeginDeleteOptions) (resp azfake.PollerResponder[armdevopsinfrastructure.PoolsClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method PoolsClient.Get @@ -82,31 +78,50 @@ func (p *PoolsServerTransport) Do(req *http.Request) (*http.Response, error) { return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return p.dispatchToMethodFake(req, method) +} - switch method { - case "PoolsClient.BeginCreateOrUpdate": - resp, err = p.dispatchBeginCreateOrUpdate(req) - case "PoolsClient.BeginDelete": - resp, err = p.dispatchBeginDelete(req) - case "PoolsClient.Get": - resp, err = p.dispatchGet(req) - case "PoolsClient.NewListByResourceGroupPager": - resp, err = p.dispatchNewListByResourceGroupPager(req) - case "PoolsClient.NewListBySubscriptionPager": - resp, err = p.dispatchNewListBySubscriptionPager(req) - case "PoolsClient.BeginUpdate": - resp, err = p.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (p *PoolsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if poolsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = poolsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PoolsClient.BeginCreateOrUpdate": + res.resp, res.err = p.dispatchBeginCreateOrUpdate(req) + case "PoolsClient.BeginDelete": + res.resp, res.err = p.dispatchBeginDelete(req) + case "PoolsClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "PoolsClient.NewListByResourceGroupPager": + res.resp, res.err = p.dispatchNewListByResourceGroupPager(req) + case "PoolsClient.NewListBySubscriptionPager": + res.resp, res.err = p.dispatchNewListBySubscriptionPager(req) + case "PoolsClient.BeginUpdate": + res.resp, res.err = p.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (p *PoolsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -190,9 +205,9 @@ func (p *PoolsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Res return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { p.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { p.beginDelete.remove(req) @@ -351,3 +366,9 @@ func (p *PoolsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Res return resp, nil } + +// set this to conditionally intercept incoming requests to PoolsServerTransport +var poolsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/resourcedetails_server.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/resourcedetails_server.go index 644027e03be0..1c8b334fc009 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/resourcedetails_server.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/resourcedetails_server.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -53,21 +49,40 @@ func (r *ResourceDetailsServerTransport) Do(req *http.Request) (*http.Response, return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return r.dispatchToMethodFake(req, method) +} - switch method { - case "ResourceDetailsClient.NewListByPoolPager": - resp, err = r.dispatchNewListByPoolPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (r *ResourceDetailsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if resourceDetailsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = resourceDetailsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ResourceDetailsClient.NewListByPoolPager": + res.resp, res.err = r.dispatchNewListByPoolPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (r *ResourceDetailsServerTransport) dispatchNewListByPoolPager(req *http.Request) (*http.Response, error) { @@ -110,3 +125,9 @@ func (r *ResourceDetailsServerTransport) dispatchNewListByPoolPager(req *http.Re } return resp, nil } + +// set this to conditionally intercept incoming requests to ResourceDetailsServerTransport +var resourceDetailsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/server_factory.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/server_factory.go index e8dc200ba92c..d2a77f346a59 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/server_factory.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/server_factory.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -19,11 +15,22 @@ import ( // ServerFactory is a fake server for instances of the armdevopsinfrastructure.ClientFactory type. type ServerFactory struct { - ImageVersionsServer ImageVersionsServer - OperationsServer OperationsServer - PoolsServer PoolsServer - ResourceDetailsServer ResourceDetailsServer - SKUServer SKUServer + // ImageVersionsServer contains the fakes for client ImageVersionsClient + ImageVersionsServer ImageVersionsServer + + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer + + // PoolsServer contains the fakes for client PoolsClient + PoolsServer PoolsServer + + // ResourceDetailsServer contains the fakes for client ResourceDetailsClient + ResourceDetailsServer ResourceDetailsServer + + // SKUServer contains the fakes for client SKUClient + SKUServer SKUServer + + // SubscriptionUsagesServer contains the fakes for client SubscriptionUsagesClient SubscriptionUsagesServer SubscriptionUsagesServer } diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/sku_server.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/sku_server.go index 7bc441779a45..77e4b048e3a6 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/sku_server.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/sku_server.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -53,21 +49,40 @@ func (s *SKUServerTransport) Do(req *http.Request) (*http.Response, error) { return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return s.dispatchToMethodFake(req, method) +} - switch method { - case "SKUClient.NewListByLocationPager": - resp, err = s.dispatchNewListByLocationPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (s *SKUServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if skuServerTransportInterceptor != nil { + res.resp, res.err, intercepted = skuServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SKUClient.NewListByLocationPager": + res.resp, res.err = s.dispatchNewListByLocationPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *SKUServerTransport) dispatchNewListByLocationPager(req *http.Request) (*http.Response, error) { @@ -106,3 +121,9 @@ func (s *SKUServerTransport) dispatchNewListByLocationPager(req *http.Request) ( } return resp, nil } + +// set this to conditionally intercept incoming requests to SKUServerTransport +var skuServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/subscriptionusages_server.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/subscriptionusages_server.go index 814de64be755..3cf219301c20 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/subscriptionusages_server.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/subscriptionusages_server.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -23,9 +19,9 @@ import ( // SubscriptionUsagesServer is a fake server for instances of the armdevopsinfrastructure.SubscriptionUsagesClient type. type SubscriptionUsagesServer struct { - // NewListByLocationPager is the fake for method SubscriptionUsagesClient.NewListByLocationPager + // NewUsagesPager is the fake for method SubscriptionUsagesClient.NewUsagesPager // HTTP status codes to indicate success: http.StatusOK - NewListByLocationPager func(locationName string, options *armdevopsinfrastructure.SubscriptionUsagesClientListByLocationOptions) (resp azfake.PagerResponder[armdevopsinfrastructure.SubscriptionUsagesClientListByLocationResponse]) + NewUsagesPager func(location string, options *armdevopsinfrastructure.SubscriptionUsagesClientUsagesOptions) (resp azfake.PagerResponder[armdevopsinfrastructure.SubscriptionUsagesClientUsagesResponse]) } // NewSubscriptionUsagesServerTransport creates a new instance of SubscriptionUsagesServerTransport with the provided implementation. @@ -33,16 +29,16 @@ type SubscriptionUsagesServer struct { // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewSubscriptionUsagesServerTransport(srv *SubscriptionUsagesServer) *SubscriptionUsagesServerTransport { return &SubscriptionUsagesServerTransport{ - srv: srv, - newListByLocationPager: newTracker[azfake.PagerResponder[armdevopsinfrastructure.SubscriptionUsagesClientListByLocationResponse]](), + srv: srv, + newUsagesPager: newTracker[azfake.PagerResponder[armdevopsinfrastructure.SubscriptionUsagesClientUsagesResponse]](), } } // SubscriptionUsagesServerTransport connects instances of armdevopsinfrastructure.SubscriptionUsagesClient to instances of SubscriptionUsagesServer. // Don't use this type directly, use NewSubscriptionUsagesServerTransport instead. type SubscriptionUsagesServerTransport struct { - srv *SubscriptionUsagesServer - newListByLocationPager *tracker[azfake.PagerResponder[armdevopsinfrastructure.SubscriptionUsagesClientListByLocationResponse]] + srv *SubscriptionUsagesServer + newUsagesPager *tracker[azfake.PagerResponder[armdevopsinfrastructure.SubscriptionUsagesClientUsagesResponse]] } // Do implements the policy.Transporter interface for SubscriptionUsagesServerTransport. @@ -53,56 +49,81 @@ func (s *SubscriptionUsagesServerTransport) Do(req *http.Request) (*http.Respons return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return s.dispatchToMethodFake(req, method) +} - switch method { - case "SubscriptionUsagesClient.NewListByLocationPager": - resp, err = s.dispatchNewListByLocationPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (s *SubscriptionUsagesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if subscriptionUsagesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = subscriptionUsagesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SubscriptionUsagesClient.NewUsagesPager": + res.resp, res.err = s.dispatchNewUsagesPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } -func (s *SubscriptionUsagesServerTransport) dispatchNewListByLocationPager(req *http.Request) (*http.Response, error) { - if s.srv.NewListByLocationPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByLocationPager not implemented")} +func (s *SubscriptionUsagesServerTransport) dispatchNewUsagesPager(req *http.Request) (*http.Response, error) { + if s.srv.NewUsagesPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewUsagesPager not implemented")} } - newListByLocationPager := s.newListByLocationPager.get(req) - if newListByLocationPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevOpsInfrastructure/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/usages` + newUsagesPager := s.newUsagesPager.get(req) + if newUsagesPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevOpsInfrastructure/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/usages` 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) } - locationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("locationName")]) + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) if err != nil { return nil, err } - resp := s.srv.NewListByLocationPager(locationNameParam, nil) - newListByLocationPager = &resp - s.newListByLocationPager.add(req, newListByLocationPager) - server.PagerResponderInjectNextLinks(newListByLocationPager, req, func(page *armdevopsinfrastructure.SubscriptionUsagesClientListByLocationResponse, createLink func() string) { + resp := s.srv.NewUsagesPager(locationParam, nil) + newUsagesPager = &resp + s.newUsagesPager.add(req, newUsagesPager) + server.PagerResponderInjectNextLinks(newUsagesPager, req, func(page *armdevopsinfrastructure.SubscriptionUsagesClientUsagesResponse, createLink func() string) { page.NextLink = to.Ptr(createLink()) }) } - resp, err := server.PagerResponderNext(newListByLocationPager, req) + resp, err := server.PagerResponderNext(newUsagesPager, req) if err != nil { return nil, err } if !contains([]int{http.StatusOK}, resp.StatusCode) { - s.newListByLocationPager.remove(req) + s.newUsagesPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } - if !server.PagerResponderMore(newListByLocationPager) { - s.newListByLocationPager.remove(req) + if !server.PagerResponderMore(newUsagesPager) { + s.newUsagesPager.remove(req) } return resp, nil } + +// set this to conditionally intercept incoming requests to SubscriptionUsagesServerTransport +var subscriptionUsagesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/time_rfc3339.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/time_rfc3339.go index 81f308b0d343..87ee11e83b32 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/time_rfc3339.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/time_rfc3339.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -60,6 +56,9 @@ func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } tzOffset := tzOffsetRegex.Match(data) hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") var layout string diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.mod b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.mod index 12db711df587..8f0f110538ce 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.mod +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.mod @@ -3,7 +3,7 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructur go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 ) @@ -14,8 +14,8 @@ require ( github.com/google/uuid v1.6.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.25.0 // indirect - golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect - golang.org/x/text v0.16.0 // indirect + golang.org/x/crypto v0.27.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/text v0.18.0 // indirect ) diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.sum b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.sum index 09d275cb9a37..cbddbbd9ecec 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.sum +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.sum @@ -1,5 +1,5 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 h1:JZg6HRh6W6U4OLl6lk7BZ7BLisIzM9dG1R50zUk9C/M= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0/go.mod h1:YL1xnZ6QejvQHWJrX/AvhFl4WW4rqHVoKspWNVwFk0M= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= @@ -17,13 +17,13 @@ github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmd github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= -golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= -golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/imageversions_client.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/imageversions_client.go index 1285cf8f02d4..e67fb049e3a9 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/imageversions_client.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/imageversions_client.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdevopsinfrastructure @@ -45,7 +41,7 @@ func NewImageVersionsClient(subscriptionID string, credential azcore.TokenCreden // NewListByImagePager - List ImageVersion resources by Image // -// Generated from API version 2024-04-04-preview +// Generated from API version 2024-10-19 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - imageName - Name of the image. // - options - ImageVersionsClientListByImageOptions contains the optional parameters for the ImageVersionsClient.NewListByImagePager @@ -74,7 +70,7 @@ func (client *ImageVersionsClient) NewListByImagePager(resourceGroupName string, } // listByImageCreateRequest creates the ListByImage request. -func (client *ImageVersionsClient) listByImageCreateRequest(ctx context.Context, resourceGroupName string, imageName string, options *ImageVersionsClientListByImageOptions) (*policy.Request, error) { +func (client *ImageVersionsClient) listByImageCreateRequest(ctx context.Context, resourceGroupName string, imageName string, _ *ImageVersionsClientListByImageOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/images/{imageName}/versions" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -93,7 +89,7 @@ func (client *ImageVersionsClient) listByImageCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-04-preview") + reqQP.Set("api-version", "2024-10-19") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/imageversions_client_example_test.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/imageversions_client_example_test.go index 9949dcb23719..7b5921223ee3 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/imageversions_client_example_test.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/imageversions_client_example_test.go @@ -1,30 +1,24 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdevopsinfrastructure_test import ( "context" - "log" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/devopsinfrastructure/resource-manager/Microsoft.DevOpsInfrastructure/preview/2024-04-04-preview/examples/ImageVersions_ListByImage.json +// Generated from example definition: 2024-10-19/ImageVersions_ListByImage.json func ExampleImageVersionsClient_NewListByImagePager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armdevopsinfrastructure.NewClientFactory("", cred, nil) + clientFactory, err := armdevopsinfrastructure.NewClientFactory("a2e95d27-c161-4b61-bda4-11512c14c2c2", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -39,16 +33,19 @@ func ExampleImageVersionsClient_NewListByImagePager() { _ = 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.ImageVersionListResult = armdevopsinfrastructure.ImageVersionListResult{ - // Value: []*armdevopsinfrastructure.ImageVersion{ - // { - // Name: to.Ptr("2024.0417.0"), - // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/my-resource-group/providers/Microsoft.DevOpsInfrastructure/images/windows-2022/versions/2024.0417.0"), + // page = armdevopsinfrastructure.ImageVersionsClientListByImageResponse{ + // ImageVersionListResult: armdevopsinfrastructure.ImageVersionListResult{ + // Value: []*armdevopsinfrastructure.ImageVersion{ + // { + // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/my-resource-group/providers/Microsoft.DevOpsInfrastructure/images/windows-2022/versions/2024.0417.0"), + // Name: to.Ptr("2024.0417.0"), + // }, + // { + // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/my-resource-group/providers/Microsoft.DevOpsInfrastructure/images/windows-2022/versions/2024.0417.1"), + // Name: to.Ptr("2024.0417.1"), + // }, // }, - // { - // Name: to.Ptr("2024.0417.1"), - // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/my-resource-group/providers/Microsoft.DevOpsInfrastructure/images/windows-2022/versions/2024.0417.1"), - // }}, + // }, // } } } diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/interfaces.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/interfaces.go index 85e5dd582fa8..741df79d72aa 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/interfaces.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/interfaces.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdevopsinfrastructure @@ -17,15 +13,6 @@ type AgentProfileClassification interface { GetAgentProfile() *AgentProfile } -// AgentProfileUpdateClassification provides polymorphic access to related types. -// Call the interface's GetAgentProfileUpdate() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AgentProfileUpdate, *StatefulUpdate, *StatelessAgentProfileUpdate -type AgentProfileUpdateClassification interface { - // GetAgentProfileUpdate returns the AgentProfileUpdate content of the underlying type. - GetAgentProfileUpdate() *AgentProfileUpdate -} - // FabricProfileClassification provides polymorphic access to related types. // Call the interface's GetFabricProfile() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -52,12 +39,3 @@ type ResourcePredictionsProfileClassification interface { // GetResourcePredictionsProfile returns the ResourcePredictionsProfile content of the underlying type. GetResourcePredictionsProfile() *ResourcePredictionsProfile } - -// ResourcePredictionsProfileUpdateClassification provides polymorphic access to related types. -// Call the interface's GetResourcePredictionsProfileUpdate() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AutomaticResourcePredictionsProfileUpdate, *ManualResourcePredictionsProfileUpdate, *ResourcePredictionsProfileUpdate -type ResourcePredictionsProfileUpdateClassification interface { - // GetResourcePredictionsProfileUpdate returns the ResourcePredictionsProfileUpdate content of the underlying type. - GetResourcePredictionsProfileUpdate() *ResourcePredictionsProfileUpdate -} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models.go index 90f682a878c5..c4277557d087 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdevopsinfrastructure @@ -16,7 +12,7 @@ type AgentProfile struct { Kind *string // Defines pool buffer/stand-by agents. - ResourcePredictions any + ResourcePredictions *ResourcePredictions // Defines how the pool buffer/stand-by agents is provided. ResourcePredictionsProfile ResourcePredictionsProfileClassification @@ -25,24 +21,10 @@ type AgentProfile struct { // GetAgentProfile implements the AgentProfileClassification interface for type AgentProfile. func (a *AgentProfile) GetAgentProfile() *AgentProfile { return a } -// AgentProfileUpdate - The agent profile of the machines in the pool. -type AgentProfileUpdate struct { - // REQUIRED; Discriminator property for AgentProfile. - Kind *string - - // Defines pool buffer/stand-by agents. - ResourcePredictions any - - // Defines how the pool buffer/stand-by agents is provided. - ResourcePredictionsProfile ResourcePredictionsProfileUpdateClassification -} - -// GetAgentProfileUpdate implements the AgentProfileUpdateClassification interface for type AgentProfileUpdate. -func (a *AgentProfileUpdate) GetAgentProfileUpdate() *AgentProfileUpdate { return a } - // AutomaticResourcePredictionsProfile - The stand-by agent scheme is determined based on historical demand. type AutomaticResourcePredictionsProfile struct { - // REQUIRED; Determines how the stand-by scheme should be provided. + // CONSTANT; The stand-by agent scheme is determined based on historical demand. + // Field has constant value ResourcePredictionsProfileTypeAutomatic, any specified value is ignored. Kind *ResourcePredictionsProfileType // Determines the balance between cost and performance. @@ -56,25 +38,10 @@ func (a *AutomaticResourcePredictionsProfile) GetResourcePredictionsProfile() *R } } -// AutomaticResourcePredictionsProfileUpdate - The stand-by agent scheme is determined based on historical demand. -type AutomaticResourcePredictionsProfileUpdate struct { - // REQUIRED; Determines how the stand-by scheme should be provided. - Kind *ResourcePredictionsProfileType - - // Determines the balance between cost and performance. - PredictionPreference *PredictionPreference -} - -// GetResourcePredictionsProfileUpdate implements the ResourcePredictionsProfileUpdateClassification interface for type AutomaticResourcePredictionsProfileUpdate. -func (a *AutomaticResourcePredictionsProfileUpdate) GetResourcePredictionsProfileUpdate() *ResourcePredictionsProfileUpdate { - return &ResourcePredictionsProfileUpdate{ - Kind: a.Kind, - } -} - // AzureDevOpsOrganizationProfile - Azure DevOps organization profile type AzureDevOpsOrganizationProfile struct { - // REQUIRED; Discriminator property for OrganizationProfile. + // CONSTANT; Azure DevOps organization profile + // Field has constant value "AzureDevOps", any specified value is ignored. Kind *string // REQUIRED; The list of Azure DevOps organizations the pool should be present in. @@ -106,8 +73,7 @@ type AzureDevOpsPermissionProfile struct { // DataDisk - The data disk of the VMSS. type DataDisk struct { // The type of caching to be enabled for the data disks. The default value for caching is readwrite. For information about - // the caching options see: - // https://blogs.msdn.microsoft.com/windowsazurestorage/2012/06/27/exploring-windows-azure-drives-disks-and-images/. + // the caching options see: https://blogs.msdn.microsoft.com/windowsazurestorage/2012/06/27/exploring-windows-azure-drives-disks-and-images/. Caching *CachingType // The initial disk size in gigabytes. @@ -146,7 +112,8 @@ type GitHubOrganization struct { // GitHubOrganizationProfile - GitHub organization profile type GitHubOrganizationProfile struct { - // REQUIRED; Discriminator property for OrganizationProfile. + // CONSTANT; GitHub organization profile + // Field has constant value "GitHub", any specified value is ignored. Kind *string // REQUIRED; The list of GitHub organizations/repositories the pool should be present in. @@ -165,12 +132,12 @@ type ImageVersion struct { // The resource-specific properties for this resource. Properties *ImageVersionProperties - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" - ID *string - - // READ-ONLY; The name of the resource + // READ-ONLY; The name of the image version. Name *string + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData @@ -195,14 +162,10 @@ type ImageVersionProperties struct { // ManagedServiceIdentity - Managed service identity (system assigned and/or user assigned identities) type ManagedServiceIdentity struct { - // REQUIRED; Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + // REQUIRED; The type of managed identity assigned to this resource. Type *ManagedServiceIdentityType - // The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM - // resource ids in the form: - // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. - // The dictionary values can be empty objects ({}) in - // requests. + // The identities assigned to this resource by the user. UserAssignedIdentities map[string]*UserAssignedIdentity // READ-ONLY; The service principal ID of the system assigned identity. This property will only be provided for a system assigned @@ -215,7 +178,8 @@ type ManagedServiceIdentity struct { // ManualResourcePredictionsProfile - Customer provides the stand-by agent scheme. type ManualResourcePredictionsProfile struct { - // REQUIRED; Determines how the stand-by scheme should be provided. + // CONSTANT; Customer provides the stand-by agent scheme. + // Field has constant value ResourcePredictionsProfileTypeManual, any specified value is ignored. Kind *ResourcePredictionsProfileType } @@ -226,74 +190,12 @@ func (m *ManualResourcePredictionsProfile) GetResourcePredictionsProfile() *Reso } } -// ManualResourcePredictionsProfileUpdate - Customer provides the stand-by agent scheme. -type ManualResourcePredictionsProfileUpdate struct { - // REQUIRED; Determines how the stand-by scheme should be provided. - Kind *ResourcePredictionsProfileType -} - -// GetResourcePredictionsProfileUpdate implements the ResourcePredictionsProfileUpdateClassification interface for type ManualResourcePredictionsProfileUpdate. -func (m *ManualResourcePredictionsProfileUpdate) GetResourcePredictionsProfileUpdate() *ResourcePredictionsProfileUpdate { - return &ResourcePredictionsProfileUpdate{ - Kind: m.Kind, - } -} - // NetworkProfile - The network profile of the machines in the pool. type NetworkProfile struct { // REQUIRED; The subnet id on which to put all machines created in the pool. SubnetID *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 -} - // Organization - Defines an Azure DevOps organization. type Organization struct { // REQUIRED; The Azure DevOps organization URL in which the pool should be created. @@ -324,11 +226,23 @@ type OsProfile struct { SecretsManagementSettings *SecretsManagementSettings } +// PagedQuota - Paged collection of Quota items +type PagedQuota struct { + // REQUIRED; The Quota items on this page + Value []*Quota + + // The link to the next page of items + NextLink *string +} + // Pool - Concrete tracked resource types can be created by aliasing this type using a specific property type. type Pool struct { // REQUIRED; The geo-location where the resource lives Location *string + // READ-ONLY; Name of the pool. It needs to be globally unique. + Name *string + // The managed service identities assigned to this resource. Identity *ManagedServiceIdentity @@ -338,12 +252,9 @@ type Pool struct { // Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + // 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 @@ -401,7 +312,7 @@ type PoolUpdate struct { // The managed service identities assigned to this resource. Identity *ManagedServiceIdentity - // The updatable properties of the Pool. + // The resource-specific properties for this resource. Properties *PoolUpdateProperties // Resource tags. @@ -411,7 +322,7 @@ type PoolUpdate struct { // PoolUpdateProperties - The updatable properties of the Pool. type PoolUpdateProperties struct { // Defines how the machine will be handled once it executed a job. - AgentProfile AgentProfileUpdateClassification + AgentProfile AgentProfileClassification // The resource id of the DevCenter Project the pool belongs to. DevCenterProjectResourceID *string @@ -431,29 +342,20 @@ type PoolUpdateProperties struct { // Quota - Describes Resource Quota type Quota struct { - // The resource-specific properties for this resource. - Properties *QuotaProperties + // REQUIRED; The current usage of the resource. + CurrentValue *int64 - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + // REQUIRED; Fully qualified ARM resource id 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 -} + // REQUIRED; The maximum permitted usage of the resource. + Limit *int64 -// QuotaListResult - The response of a Quota list operation. -type QuotaListResult struct { - // REQUIRED; The Quota items on this page - Value []*Quota + // REQUIRED; The unit of usage measurement. + Unit *string - // The link to the next page of items - NextLink *string + // READ-ONLY; The name of the quota. + Name *QuotaName } // QuotaName - The Quota Names @@ -465,32 +367,17 @@ type QuotaName struct { Value *string } -// QuotaProperties - Describes Resource Quota properties -type QuotaProperties struct { - // REQUIRED; The current usage of the resource. - CurrentValue *int64 - - // REQUIRED; The maximum permitted usage of the resource. - Limit *int64 - - // REQUIRED; The details of the quota. - Name *QuotaName - - // REQUIRED; The unit of usage measurement. - Unit *string -} - // ResourceDetailsObject - A ResourceDetailsObject type ResourceDetailsObject struct { // The resource-specific properties for this resource. Properties *ResourceDetailsObjectProperties - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" - ID *string - - // READ-ONLY; The name of the resource + // READ-ONLY; The name of the resource. Name *string + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData @@ -519,6 +406,10 @@ type ResourceDetailsObjectProperties struct { Status *ResourceStatus } +// ResourcePredictions - Defines pool buffer. +type ResourcePredictions struct { +} + // ResourcePredictionsProfile - Determines how the stand-by scheme should be provided. type ResourcePredictionsProfile struct { // REQUIRED; Determines how the stand-by scheme should be provided. @@ -530,28 +421,17 @@ func (r *ResourcePredictionsProfile) GetResourcePredictionsProfile() *ResourcePr return r } -// ResourcePredictionsProfileUpdate - Determines how the stand-by scheme should be provided. -type ResourcePredictionsProfileUpdate struct { - // REQUIRED; Determines how the stand-by scheme should be provided. - Kind *ResourcePredictionsProfileType -} - -// GetResourcePredictionsProfileUpdate implements the ResourcePredictionsProfileUpdateClassification interface for type ResourcePredictionsProfileUpdate. -func (r *ResourcePredictionsProfileUpdate) GetResourcePredictionsProfileUpdate() *ResourcePredictionsProfileUpdate { - return r -} - // ResourceSKU - A ResourceSku type ResourceSKU struct { // The resource-specific properties for this resource. Properties *ResourceSKUProperties - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" - ID *string - - // READ-ONLY; The name of the resource + // READ-ONLY; The name of the SKU. Name *string + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData @@ -664,7 +544,8 @@ type SecretsManagementSettings struct { // Stateful profile meaning that the machines will be returned to the pool after running a job. type Stateful struct { - // REQUIRED; Discriminator property for AgentProfile. + // CONSTANT; Stateful profile meaning that the machines will be returned to the pool after running a job. + // Field has constant value "Stateful", any specified value is ignored. Kind *string // How long should the machine be kept around after it ran a workload when there are no stand-by agents. The maximum is one @@ -675,7 +556,7 @@ type Stateful struct { MaxAgentLifetime *string // Defines pool buffer/stand-by agents. - ResourcePredictions any + ResourcePredictions *ResourcePredictions // Defines how the pool buffer/stand-by agents is provided. ResourcePredictionsProfile ResourcePredictionsProfileClassification @@ -690,41 +571,14 @@ func (s *Stateful) GetAgentProfile() *AgentProfile { } } -// StatefulUpdate - Stateful profile meaning that the machines will be returned to the pool after running a job. -type StatefulUpdate struct { - // REQUIRED; Discriminator property for AgentProfile. - Kind *string - - // How long should the machine be kept around after it ran a workload when there are no stand-by agents. The maximum is one - // week. - GracePeriodTimeSpan *string - - // How long should stateful machines be kept around. The maximum is one week. - MaxAgentLifetime *string - - // Defines pool buffer/stand-by agents. - ResourcePredictions any - - // Defines how the pool buffer/stand-by agents is provided. - ResourcePredictionsProfile ResourcePredictionsProfileUpdateClassification -} - -// GetAgentProfileUpdate implements the AgentProfileUpdateClassification interface for type StatefulUpdate. -func (s *StatefulUpdate) GetAgentProfileUpdate() *AgentProfileUpdate { - return &AgentProfileUpdate{ - Kind: s.Kind, - ResourcePredictions: s.ResourcePredictions, - ResourcePredictionsProfile: s.ResourcePredictionsProfile, - } -} - // StatelessAgentProfile - Stateless profile meaning that the machines will be cleaned up after running a job. type StatelessAgentProfile struct { - // REQUIRED; Discriminator property for AgentProfile. + // CONSTANT; Stateless profile meaning that the machines will be cleaned up after running a job. + // Field has constant value "Stateless", any specified value is ignored. Kind *string // Defines pool buffer/stand-by agents. - ResourcePredictions any + ResourcePredictions *ResourcePredictions // Defines how the pool buffer/stand-by agents is provided. ResourcePredictionsProfile ResourcePredictionsProfileClassification @@ -739,27 +593,6 @@ func (s *StatelessAgentProfile) GetAgentProfile() *AgentProfile { } } -// StatelessAgentProfileUpdate - Stateless profile meaning that the machines will be cleaned up after running a job. -type StatelessAgentProfileUpdate struct { - // REQUIRED; Discriminator property for AgentProfile. - Kind *string - - // Defines pool buffer/stand-by agents. - ResourcePredictions any - - // Defines how the pool buffer/stand-by agents is provided. - ResourcePredictionsProfile ResourcePredictionsProfileUpdateClassification -} - -// GetAgentProfileUpdate implements the AgentProfileUpdateClassification interface for type StatelessAgentProfileUpdate. -func (s *StatelessAgentProfileUpdate) GetAgentProfileUpdate() *AgentProfileUpdate { - return &AgentProfileUpdate{ - Kind: s.Kind, - ResourcePredictions: s.ResourcePredictions, - ResourcePredictionsProfile: s.ResourcePredictionsProfile, - } -} - // StorageProfile - The storage profile of the VMSS. type StorageProfile struct { // A list of empty data disks to attach. @@ -804,7 +637,8 @@ type VmssFabricProfile struct { // REQUIRED; The VM images of the machines in the pool. Images []*PoolImage - // REQUIRED; Discriminator property for FabricProfile. + // CONSTANT; Virtual Machine Scale Sets + // Field has constant value "Vmss", any specified value is ignored. Kind *string // REQUIRED; The Azure SKU of the machines in the pool. @@ -826,3 +660,52 @@ func (v *VmssFabricProfile) GetFabricProfile() *FabricProfile { Kind: v.Kind, } } + +// operation - Details of a REST API operation, returned from the Resource Provider Operations API +type operation struct { + // Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + ActionType *actionType + + // READ-ONLY; Localized display information for this particular operation. + Display *operationDisplay + + // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure + // Resource Manager/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 and 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 { + // REQUIRED; The Operation items on this page + Value []*operation + + // The link to the next page of items + NextLink *string +} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models_serde.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models_serde.go index 30ddb194628f..c6524c45675c 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models_serde.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models_serde.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdevopsinfrastructure @@ -18,8 +14,8 @@ import ( // MarshalJSON implements the json.Marshaller interface for type AgentProfile. func (a AgentProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["kind"] = a.Kind - populateAny(objectMap, "resourcePredictions", a.ResourcePredictions) + populate(objectMap, "kind", a.Kind) + populate(objectMap, "resourcePredictions", a.ResourcePredictions) populate(objectMap, "resourcePredictionsProfile", a.ResourcePredictionsProfile) return json.Marshal(objectMap) } @@ -50,41 +46,6 @@ func (a *AgentProfile) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AgentProfileUpdate. -func (a AgentProfileUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["kind"] = a.Kind - populateAny(objectMap, "resourcePredictions", a.ResourcePredictions) - populate(objectMap, "resourcePredictionsProfile", a.ResourcePredictionsProfile) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AgentProfileUpdate. -func (a *AgentProfileUpdate) UnmarshalJSON(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) - } - for key, val := range rawMsg { - var err error - switch key { - case "kind": - err = unpopulate(val, "Kind", &a.Kind) - delete(rawMsg, key) - case "resourcePredictions": - err = unpopulate(val, "ResourcePredictions", &a.ResourcePredictions) - delete(rawMsg, key) - case "resourcePredictionsProfile": - a.ResourcePredictionsProfile, err = unmarshalResourcePredictionsProfileUpdateClassification(val) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type AutomaticResourcePredictionsProfile. func (a AutomaticResourcePredictionsProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -116,37 +77,6 @@ func (a *AutomaticResourcePredictionsProfile) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AutomaticResourcePredictionsProfileUpdate. -func (a AutomaticResourcePredictionsProfileUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["kind"] = ResourcePredictionsProfileTypeAutomatic - populate(objectMap, "predictionPreference", a.PredictionPreference) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AutomaticResourcePredictionsProfileUpdate. -func (a *AutomaticResourcePredictionsProfileUpdate) UnmarshalJSON(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) - } - for key, val := range rawMsg { - var err error - switch key { - case "kind": - err = unpopulate(val, "Kind", &a.Kind) - delete(rawMsg, key) - case "predictionPreference": - err = unpopulate(val, "PredictionPreference", &a.PredictionPreference) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type AzureDevOpsOrganizationProfile. func (a AzureDevOpsOrganizationProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -286,7 +216,7 @@ func (d *DevOpsAzureSKU) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type FabricProfile. func (f FabricProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["kind"] = f.Kind + populate(objectMap, "kind", f.Kind) return json.Marshal(objectMap) } @@ -539,33 +469,6 @@ func (m *ManualResourcePredictionsProfile) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ManualResourcePredictionsProfileUpdate. -func (m ManualResourcePredictionsProfileUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["kind"] = ResourcePredictionsProfileTypeManual - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ManualResourcePredictionsProfileUpdate. -func (m *ManualResourcePredictionsProfileUpdate) UnmarshalJSON(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 "kind": - err = unpopulate(val, "Kind", &m.Kind) - 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 NetworkProfile. func (n NetworkProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -593,119 +496,6 @@ func (n *NetworkProfile) UnmarshalJSON(data []byte) error { 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 Organization. func (o Organization) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -744,7 +534,7 @@ func (o *Organization) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type OrganizationProfile. func (o OrganizationProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["kind"] = o.Kind + populate(objectMap, "kind", o.Kind) return json.Marshal(objectMap) } @@ -799,6 +589,37 @@ func (o *OsProfile) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type PagedQuota. +func (p PagedQuota) 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 PagedQuota. +func (p *PagedQuota) UnmarshalJSON(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 Pool. func (p Pool) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1028,7 +849,7 @@ func (p *PoolUpdateProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "agentProfile": - p.AgentProfile, err = unmarshalAgentProfileUpdateClassification(val) + p.AgentProfile, err = unmarshalAgentProfileClassification(val) delete(rawMsg, key) case "devCenterProjectResourceId": err = unpopulate(val, "DevCenterProjectResourceID", &p.DevCenterProjectResourceID) @@ -1056,11 +877,11 @@ func (p *PoolUpdateProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Quota. func (q Quota) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "currentValue", q.CurrentValue) populate(objectMap, "id", q.ID) + populate(objectMap, "limit", q.Limit) populate(objectMap, "name", q.Name) - populate(objectMap, "properties", q.Properties) - populate(objectMap, "systemData", q.SystemData) - populate(objectMap, "type", q.Type) + populate(objectMap, "unit", q.Unit) return json.Marshal(objectMap) } @@ -1073,51 +894,20 @@ func (q *Quota) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "currentValue": + err = unpopulate(val, "CurrentValue", &q.CurrentValue) + delete(rawMsg, key) case "id": err = unpopulate(val, "ID", &q.ID) delete(rawMsg, key) + case "limit": + err = unpopulate(val, "Limit", &q.Limit) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &q.Name) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &q.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &q.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &q.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type QuotaListResult. -func (q QuotaListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", q.NextLink) - populate(objectMap, "value", q.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaListResult. -func (q *QuotaListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &q.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &q.Value) + case "unit": + err = unpopulate(val, "Unit", &q.Unit) delete(rawMsg, key) } if err != nil { @@ -1158,45 +948,6 @@ func (q *QuotaName) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type QuotaProperties. -func (q QuotaProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "currentValue", q.CurrentValue) - populate(objectMap, "limit", q.Limit) - populate(objectMap, "name", q.Name) - populate(objectMap, "unit", q.Unit) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaProperties. -func (q *QuotaProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "currentValue": - err = unpopulate(val, "CurrentValue", &q.CurrentValue) - delete(rawMsg, key) - case "limit": - err = unpopulate(val, "Limit", &q.Limit) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &q.Name) - delete(rawMsg, key) - case "unit": - err = unpopulate(val, "Unit", &q.Unit) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type ResourceDetailsObject. func (r ResourceDetailsObject) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1309,7 +1060,7 @@ func (r *ResourceDetailsObjectProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ResourcePredictionsProfile. func (r ResourcePredictionsProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["kind"] = r.Kind + populate(objectMap, "kind", r.Kind) return json.Marshal(objectMap) } @@ -1333,33 +1084,6 @@ func (r *ResourcePredictionsProfile) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourcePredictionsProfileUpdate. -func (r ResourcePredictionsProfileUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["kind"] = r.Kind - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourcePredictionsProfileUpdate. -func (r *ResourcePredictionsProfileUpdate) UnmarshalJSON(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 "kind": - err = unpopulate(val, "Kind", &r.Kind) - 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 ResourceSKU. func (r ResourceSKU) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1697,7 +1421,7 @@ func (s Stateful) MarshalJSON() ([]byte, error) { populate(objectMap, "gracePeriodTimeSpan", s.GracePeriodTimeSpan) objectMap["kind"] = "Stateful" populate(objectMap, "maxAgentLifetime", s.MaxAgentLifetime) - populateAny(objectMap, "resourcePredictions", s.ResourcePredictions) + populate(objectMap, "resourcePredictions", s.ResourcePredictions) populate(objectMap, "resourcePredictionsProfile", s.ResourcePredictionsProfile) return json.Marshal(objectMap) } @@ -1734,54 +1458,11 @@ func (s *Stateful) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type StatefulUpdate. -func (s StatefulUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "gracePeriodTimeSpan", s.GracePeriodTimeSpan) - objectMap["kind"] = "Stateful" - populate(objectMap, "maxAgentLifetime", s.MaxAgentLifetime) - populateAny(objectMap, "resourcePredictions", s.ResourcePredictions) - populate(objectMap, "resourcePredictionsProfile", s.ResourcePredictionsProfile) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type StatefulUpdate. -func (s *StatefulUpdate) UnmarshalJSON(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 "gracePeriodTimeSpan": - err = unpopulate(val, "GracePeriodTimeSpan", &s.GracePeriodTimeSpan) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &s.Kind) - delete(rawMsg, key) - case "maxAgentLifetime": - err = unpopulate(val, "MaxAgentLifetime", &s.MaxAgentLifetime) - delete(rawMsg, key) - case "resourcePredictions": - err = unpopulate(val, "ResourcePredictions", &s.ResourcePredictions) - delete(rawMsg, key) - case "resourcePredictionsProfile": - s.ResourcePredictionsProfile, err = unmarshalResourcePredictionsProfileUpdateClassification(val) - 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 StatelessAgentProfile. func (s StatelessAgentProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) objectMap["kind"] = "Stateless" - populateAny(objectMap, "resourcePredictions", s.ResourcePredictions) + populate(objectMap, "resourcePredictions", s.ResourcePredictions) populate(objectMap, "resourcePredictionsProfile", s.ResourcePredictionsProfile) return json.Marshal(objectMap) } @@ -1812,41 +1493,6 @@ func (s *StatelessAgentProfile) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type StatelessAgentProfileUpdate. -func (s StatelessAgentProfileUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["kind"] = "Stateless" - populateAny(objectMap, "resourcePredictions", s.ResourcePredictions) - populate(objectMap, "resourcePredictionsProfile", s.ResourcePredictionsProfile) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type StatelessAgentProfileUpdate. -func (s *StatelessAgentProfileUpdate) UnmarshalJSON(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 "kind": - err = unpopulate(val, "Kind", &s.Kind) - delete(rawMsg, key) - case "resourcePredictions": - err = unpopulate(val, "ResourcePredictions", &s.ResourcePredictions) - delete(rawMsg, key) - case "resourcePredictionsProfile": - s.ResourcePredictionsProfile, err = unmarshalResourcePredictionsProfileUpdateClassification(val) - 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 StorageProfile. func (s StorageProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2003,22 +1649,125 @@ func (v *VmssFabricProfile) UnmarshalJSON(data []byte) error { return nil } -func populate(m map[string]any, k string, v any) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v +// 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 } -func populateAny(m map[string]any, k string, v any) { +func populate(m map[string]any, k string, v any) { if v == nil { return } else if azcore.IsNullValue(v) { m[k] = nil - } else { + } else if !reflect.ValueOf(v).IsNil() { m[k] = v } } diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client.go index a5d075124522..73470df5c364 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdevopsinfrastructure @@ -37,17 +33,18 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO return client, nil } -// NewListPager - List the operations for the provider +// NewlistMethodPager - List the operations for the provider // -// Generated from API version 2024-04-04-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 { +// Generated from API version 2024-10-19 +// - options - operationsClientlistMethodOptions contains the optional parameters for the OperationsClient.NewlistMethodPager +// method. +func (client *OperationsClient) NewlistMethodPager(options *operationsClientlistMethodOptions) *runtime.Pager[operationsClientlistMethodResponse] { + return runtime.NewPager(runtime.PagingHandler[operationsClientlistMethodResponse]{ + More: func(page operationsClientlistMethodResponse) bool { 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") + Fetcher: func(ctx context.Context, page *operationsClientlistMethodResponse) (operationsClientlistMethodResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewlistMethodPager") nextLink := "" if page != nil { nextLink = *page.NextLink @@ -56,7 +53,7 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption return client.listCreateRequest(ctx, options) }, nil) if err != nil { - return OperationsClientListResponse{}, err + return operationsClientlistMethodResponse{}, err } return client.listHandleResponse(resp) }, @@ -64,25 +61,25 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption }) } -// listCreateRequest creates the List request. -func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { +// listCreateRequest creates the listMethod request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *operationsClientlistMethodOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.DevOpsInfrastructure/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", "2024-04-04-preview") + reqQP.Set("api-version", "2024-10-19") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// listHandleResponse handles the List response. -func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { - result := OperationsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { - return OperationsClientListResponse{}, err +// listHandleResponse handles the listMethod response. +func (client *OperationsClient) listHandleResponse(resp *http.Response) (operationsClientlistMethodResponse, error) { + result := operationsClientlistMethodResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.operationListResult); err != nil { + return operationsClientlistMethodResponse{}, err } return result, nil } diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client_example_test.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client_example_test.go index 6cae58002b52..d5351103a2da 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client_example_test.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client_example_test.go @@ -1,34 +1,28 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdevopsinfrastructure_test import ( "context" - "log" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/devopsinfrastructure/resource-manager/Microsoft.DevOpsInfrastructure/preview/2024-04-04-preview/examples/ListOperations.json -func ExampleOperationsClient_NewListPager() { +// Generated from example definition: 2024-10-19/ListOperations.json +func ExampleOperationsClient_NewlistMethodPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armdevopsinfrastructure.NewClientFactory("", cred, nil) + clientFactory, err := armdevopsinfrastructure.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewOperationsClient().NewListPager(nil) + pager := clientFactory.NewOperationsClient().NewlistMethodPager(nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -39,7 +33,9 @@ func ExampleOperationsClient_NewListPager() { _ = 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.OperationListResult = armdevopsinfrastructure.OperationListResult{ + // page = armdevopsinfrastructure.operationsClientlistMethodResponse{ + // operationListResult: armdevopsinfrastructure.operationListResult{ + // }, // } } } diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/options.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/options.go index f44bb303f492..49acca481a13 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/options.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/options.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdevopsinfrastructure @@ -14,26 +10,21 @@ type ImageVersionsClientListByImageOptions struct { // placeholder for future optional parameters } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -type OperationsClientListOptions struct { - // placeholder for future optional parameters -} - // PoolsClientBeginCreateOrUpdateOptions contains the optional parameters for the PoolsClient.BeginCreateOrUpdate method. type PoolsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // PoolsClientBeginDeleteOptions contains the optional parameters for the PoolsClient.BeginDelete method. type PoolsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // PoolsClientBeginUpdateOptions contains the optional parameters for the PoolsClient.BeginUpdate method. type PoolsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -64,8 +55,13 @@ type SKUClientListByLocationOptions struct { // placeholder for future optional parameters } -// SubscriptionUsagesClientListByLocationOptions contains the optional parameters for the SubscriptionUsagesClient.NewListByLocationPager +// SubscriptionUsagesClientUsagesOptions contains the optional parameters for the SubscriptionUsagesClient.NewUsagesPager // method. -type SubscriptionUsagesClientListByLocationOptions struct { +type SubscriptionUsagesClientUsagesOptions struct { + // placeholder for future optional parameters +} + +// operationsClientlistMethodOptions contains the optional parameters for the OperationsClient.NewlistMethodPager method. +type operationsClientlistMethodOptions struct { // placeholder for future optional parameters } diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/polymorphic_helpers.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/polymorphic_helpers.go index edcaa65c747c..d8630b660860 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/polymorphic_helpers.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/polymorphic_helpers.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdevopsinfrastructure @@ -33,29 +29,6 @@ func unmarshalAgentProfileClassification(rawMsg json.RawMessage) (AgentProfileCl return b, nil } -func unmarshalAgentProfileUpdateClassification(rawMsg json.RawMessage) (AgentProfileUpdateClassification, error) { - if rawMsg == nil || string(rawMsg) == "null" { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b AgentProfileUpdateClassification - switch m["kind"] { - case "Stateful": - b = &StatefulUpdate{} - case "Stateless": - b = &StatelessAgentProfileUpdate{} - default: - b = &AgentProfileUpdate{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - func unmarshalFabricProfileClassification(rawMsg json.RawMessage) (FabricProfileClassification, error) { if rawMsg == nil || string(rawMsg) == "null" { return nil, nil @@ -110,35 +83,12 @@ func unmarshalResourcePredictionsProfileClassification(rawMsg json.RawMessage) ( } var b ResourcePredictionsProfileClassification switch m["kind"] { - case string(ResourcePredictionsProfileTypeAutomatic): - b = &AutomaticResourcePredictionsProfile{} case string(ResourcePredictionsProfileTypeManual): b = &ManualResourcePredictionsProfile{} - default: - b = &ResourcePredictionsProfile{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalResourcePredictionsProfileUpdateClassification(rawMsg json.RawMessage) (ResourcePredictionsProfileUpdateClassification, error) { - if rawMsg == nil || string(rawMsg) == "null" { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b ResourcePredictionsProfileUpdateClassification - switch m["kind"] { case string(ResourcePredictionsProfileTypeAutomatic): - b = &AutomaticResourcePredictionsProfileUpdate{} - case string(ResourcePredictionsProfileTypeManual): - b = &ManualResourcePredictionsProfileUpdate{} + b = &AutomaticResourcePredictionsProfile{} default: - b = &ResourcePredictionsProfileUpdate{} + b = &ResourcePredictionsProfile{} } if err := json.Unmarshal(rawMsg, b); err != nil { return nil, err diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/pools_client.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/pools_client.go index 6d6b234c092a..94873e863f47 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/pools_client.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/pools_client.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdevopsinfrastructure @@ -46,7 +42,7 @@ func NewPoolsClient(subscriptionID string, credential azcore.TokenCredential, op // BeginCreateOrUpdate - Create a Pool // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-04-04-preview +// Generated from API version 2024-10-19 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - poolName - Name of the pool. It needs to be globally unique. // - resource - Resource create parameters. @@ -73,7 +69,7 @@ func (client *PoolsClient) BeginCreateOrUpdate(ctx context.Context, resourceGrou // CreateOrUpdate - Create a Pool // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-04-04-preview +// Generated from API version 2024-10-19 func (client *PoolsClient) createOrUpdate(ctx context.Context, resourceGroupName string, poolName string, resource Pool, options *PoolsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "PoolsClient.BeginCreateOrUpdate" @@ -96,7 +92,7 @@ func (client *PoolsClient) createOrUpdate(ctx context.Context, resourceGroupName } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *PoolsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, poolName string, resource Pool, options *PoolsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *PoolsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, poolName string, resource Pool, _ *PoolsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools/{poolName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -115,9 +111,10 @@ func (client *PoolsClient) createOrUpdateCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-04-preview") + reqQP.Set("api-version", "2024-10-19") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } @@ -127,7 +124,7 @@ func (client *PoolsClient) createOrUpdateCreateRequest(ctx context.Context, reso // BeginDelete - Delete a Pool // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-04-04-preview +// Generated from API version 2024-10-19 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - poolName - Name of the pool. It needs to be globally unique. // - options - PoolsClientBeginDeleteOptions contains the optional parameters for the PoolsClient.BeginDelete method. @@ -138,8 +135,7 @@ func (client *PoolsClient) BeginDelete(ctx context.Context, resourceGroupName st return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PoolsClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -152,7 +148,7 @@ func (client *PoolsClient) BeginDelete(ctx context.Context, resourceGroupName st // Delete - Delete a Pool // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-04-04-preview +// Generated from API version 2024-10-19 func (client *PoolsClient) deleteOperation(ctx context.Context, resourceGroupName string, poolName string, options *PoolsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "PoolsClient.BeginDelete" @@ -175,7 +171,7 @@ func (client *PoolsClient) deleteOperation(ctx context.Context, resourceGroupNam } // deleteCreateRequest creates the Delete request. -func (client *PoolsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, poolName string, options *PoolsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *PoolsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, poolName string, _ *PoolsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools/{poolName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -194,7 +190,7 @@ func (client *PoolsClient) deleteCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-04-preview") + reqQP.Set("api-version", "2024-10-19") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -203,7 +199,7 @@ func (client *PoolsClient) deleteCreateRequest(ctx context.Context, resourceGrou // Get - Get a Pool // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-04-04-preview +// Generated from API version 2024-10-19 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - poolName - Name of the pool. It needs to be globally unique. // - options - PoolsClientGetOptions contains the optional parameters for the PoolsClient.Get method. @@ -230,7 +226,7 @@ func (client *PoolsClient) Get(ctx context.Context, resourceGroupName string, po } // getCreateRequest creates the Get request. -func (client *PoolsClient) getCreateRequest(ctx context.Context, resourceGroupName string, poolName string, options *PoolsClientGetOptions) (*policy.Request, error) { +func (client *PoolsClient) getCreateRequest(ctx context.Context, resourceGroupName string, poolName string, _ *PoolsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools/{poolName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -249,7 +245,7 @@ func (client *PoolsClient) getCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-04-preview") + reqQP.Set("api-version", "2024-10-19") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -266,7 +262,7 @@ func (client *PoolsClient) getHandleResponse(resp *http.Response) (PoolsClientGe // NewListByResourceGroupPager - List Pool resources by resource group // -// Generated from API version 2024-04-04-preview +// Generated from API version 2024-10-19 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - PoolsClientListByResourceGroupOptions contains the optional parameters for the PoolsClient.NewListByResourceGroupPager // method. @@ -294,7 +290,7 @@ func (client *PoolsClient) NewListByResourceGroupPager(resourceGroupName string, } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *PoolsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *PoolsClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *PoolsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *PoolsClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -309,7 +305,7 @@ func (client *PoolsClient) listByResourceGroupCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-04-preview") + reqQP.Set("api-version", "2024-10-19") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -326,7 +322,7 @@ func (client *PoolsClient) listByResourceGroupHandleResponse(resp *http.Response // NewListBySubscriptionPager - List Pool resources by subscription ID // -// Generated from API version 2024-04-04-preview +// Generated from API version 2024-10-19 // - options - PoolsClientListBySubscriptionOptions contains the optional parameters for the PoolsClient.NewListBySubscriptionPager // method. func (client *PoolsClient) NewListBySubscriptionPager(options *PoolsClientListBySubscriptionOptions) *runtime.Pager[PoolsClientListBySubscriptionResponse] { @@ -353,7 +349,7 @@ func (client *PoolsClient) NewListBySubscriptionPager(options *PoolsClientListBy } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *PoolsClient) listBySubscriptionCreateRequest(ctx context.Context, options *PoolsClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *PoolsClient) listBySubscriptionCreateRequest(ctx context.Context, _ *PoolsClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DevOpsInfrastructure/pools" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -364,7 +360,7 @@ func (client *PoolsClient) listBySubscriptionCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-04-preview") + reqQP.Set("api-version", "2024-10-19") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -382,7 +378,7 @@ func (client *PoolsClient) listBySubscriptionHandleResponse(resp *http.Response) // BeginUpdate - Update a Pool // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-04-04-preview +// Generated from API version 2024-10-19 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - poolName - Name of the pool. It needs to be globally unique. // - properties - The resource properties to be updated. @@ -394,8 +390,7 @@ func (client *PoolsClient) BeginUpdate(ctx context.Context, resourceGroupName st return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PoolsClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -408,7 +403,7 @@ func (client *PoolsClient) BeginUpdate(ctx context.Context, resourceGroupName st // Update - Update a Pool // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-04-04-preview +// Generated from API version 2024-10-19 func (client *PoolsClient) update(ctx context.Context, resourceGroupName string, poolName string, properties PoolUpdate, options *PoolsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "PoolsClient.BeginUpdate" @@ -431,7 +426,7 @@ func (client *PoolsClient) update(ctx context.Context, resourceGroupName string, } // updateCreateRequest creates the Update request. -func (client *PoolsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, poolName string, properties PoolUpdate, options *PoolsClientBeginUpdateOptions) (*policy.Request, error) { +func (client *PoolsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, poolName string, properties PoolUpdate, _ *PoolsClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools/{poolName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -450,9 +445,10 @@ func (client *PoolsClient) updateCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-04-preview") + reqQP.Set("api-version", "2024-10-19") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, properties); err != nil { return nil, err } diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/pools_client_example_test.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/pools_client_example_test.go index 3f84839167f5..7212fff354d0 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/pools_client_example_test.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/pools_client_example_test.go @@ -1,95 +1,132 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdevopsinfrastructure_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/devopsinfrastructure/armdevopsinfrastructure" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/devopsinfrastructure/resource-manager/Microsoft.DevOpsInfrastructure/preview/2024-04-04-preview/examples/ListPoolsBySubscription.json -func ExamplePoolsClient_NewListBySubscriptionPager() { +// Generated from example definition: 2024-10-19/CreateOrUpdatePool.json +func ExamplePoolsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armdevopsinfrastructure.NewClientFactory("", cred, nil) + clientFactory, err := armdevopsinfrastructure.NewClientFactory("a2e95d27-c161-4b61-bda4-11512c14c2c2", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewPoolsClient().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.PoolListResult = armdevopsinfrastructure.PoolListResult{ - // Value: []*armdevopsinfrastructure.Pool{ - // { - // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/aoiresourceGroupName/providers/Microsoft.DevOpsInfrastructure/Pools/pool"), - // Location: to.Ptr("eastus"), - // }}, - // } + poller, err := clientFactory.NewPoolsClient().BeginCreateOrUpdate(ctx, "rg", "pool", armdevopsinfrastructure.Pool{ + Location: to.Ptr("eastus"), + Properties: &armdevopsinfrastructure.PoolProperties{ + ProvisioningState: to.Ptr(armdevopsinfrastructure.ProvisioningStateSucceeded), + MaximumConcurrency: to.Ptr[int32](10), + DevCenterProjectResourceID: to.Ptr("/subscriptions/222e81d0-cf38-4dab-baa5-289bf16baaa4/resourceGroups/rg-1es-devcenter/providers/Microsoft.DevCenter/projects/1ES"), + OrganizationProfile: &armdevopsinfrastructure.AzureDevOpsOrganizationProfile{ + Kind: to.Ptr("AzureDevOps"), + Organizations: []*armdevopsinfrastructure.Organization{ + { + URL: to.Ptr("https://mseng.visualstudio.com"), + }, + }, + }, + AgentProfile: &armdevopsinfrastructure.StatelessAgentProfile{ + Kind: to.Ptr("Stateless"), + }, + FabricProfile: &armdevopsinfrastructure.VmssFabricProfile{ + Kind: to.Ptr("Vmss"), + SKU: &armdevopsinfrastructure.DevOpsAzureSKU{ + Name: to.Ptr("Standard_D4ads_v5"), + }, + Images: []*armdevopsinfrastructure.PoolImage{ + { + ResourceID: to.Ptr("/MicrosoftWindowsServer/WindowsServer/2019-Datacenter/latest"), + }, + }, + }, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %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 = armdevopsinfrastructure.PoolsClientCreateOrUpdateResponse{ + // Pool: &armdevopsinfrastructure.Pool{ + // Properties: &armdevopsinfrastructure.PoolProperties{ + // ProvisioningState: to.Ptr(armdevopsinfrastructure.ProvisioningStateSucceeded), + // MaximumConcurrency: to.Ptr[int32](10), + // DevCenterProjectResourceID: to.Ptr("/subscriptions/222e81d0-cf38-4dab-baa5-289bf16baaa4/resourceGroups/rg-1es-devcenter/providers/Microsoft.DevCenter/projects/1ES"), + // OrganizationProfile: &armdevopsinfrastructure.AzureDevOpsOrganizationProfile{ + // Kind: to.Ptr("AzureDevOps"), + // Organizations: []*armdevopsinfrastructure.Organization{ + // { + // URL: to.Ptr("https://mseng.visualstudio.com"), + // }, + // }, + // }, + // AgentProfile: &armdevopsinfrastructure.StatelessAgentProfile{ + // Kind: to.Ptr("Stateless"), + // }, + // FabricProfile: &armdevopsinfrastructure.VmssFabricProfile{ + // Kind: to.Ptr("Vmss"), + // SKU: &armdevopsinfrastructure.DevOpsAzureSKU{ + // Name: to.Ptr("Standard_D4ads_v5"), + // }, + // Images: []*armdevopsinfrastructure.PoolImage{ + // { + // ResourceID: to.Ptr("/MicrosoftWindowsServer/WindowsServer/2019-Datacenter/latest"), + // }, + // }, + // }, + // }, + // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/rg/providers/Microsoft.DevOpsInfrastructure/Pools/pool"), + // Location: to.Ptr("eastus"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/devopsinfrastructure/resource-manager/Microsoft.DevOpsInfrastructure/preview/2024-04-04-preview/examples/ListPoolsBySubscriptionAndResourceGroup.json -func ExamplePoolsClient_NewListByResourceGroupPager() { +// Generated from example definition: 2024-10-19/DeletePool.json +func ExamplePoolsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armdevopsinfrastructure.NewClientFactory("", cred, nil) + clientFactory, err := armdevopsinfrastructure.NewClientFactory("a2e95d27-c161-4b61-bda4-11512c14c2c2", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewPoolsClient().NewListByResourceGroupPager("rg", 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.PoolListResult = armdevopsinfrastructure.PoolListResult{ - // Value: []*armdevopsinfrastructure.Pool{ - // { - // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/rg/providers/Microsoft.DevOpsInfrastructure/Pools/pool"), - // Location: to.Ptr("eastus"), - // }}, - // } + poller, err := clientFactory.NewPoolsClient().BeginDelete(ctx, "rg", "pool", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/devopsinfrastructure/resource-manager/Microsoft.DevOpsInfrastructure/preview/2024-04-04-preview/examples/GetPool.json +// Generated from example definition: 2024-10-19/GetPool.json func ExamplePoolsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armdevopsinfrastructure.NewClientFactory("", cred, nil) + clientFactory, err := armdevopsinfrastructure.NewClientFactory("a2e95d27-c161-4b61-bda4-11512c14c2c2", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -100,161 +137,136 @@ func ExamplePoolsClient_Get() { // 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.Pool = armdevopsinfrastructure.Pool{ - // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/rg/providers/Microsoft.DevOpsInfrastructure/Pools/pool"), - // Location: to.Ptr("eastus"), - // Properties: &armdevopsinfrastructure.PoolProperties{ - // AgentProfile: &armdevopsinfrastructure.StatelessAgentProfile{ - // Kind: to.Ptr("Stateless"), - // }, - // DevCenterProjectResourceID: to.Ptr("/subscriptions/222e81d0-cf38-4dab-baa5-289bf16baaa4/resourceGroups/rg-1es-devcenter/providers/Microsoft.DevCenter/projects/1ES"), - // FabricProfile: &armdevopsinfrastructure.VmssFabricProfile{ - // Kind: to.Ptr("Vmss"), - // Images: []*armdevopsinfrastructure.PoolImage{ - // { - // ResourceID: to.Ptr("/MicrosoftWindowsServer/WindowsServer/2019-Datacenter/latest"), - // }}, - // SKU: &armdevopsinfrastructure.DevOpsAzureSKU{ - // Name: to.Ptr("Standard_D4ads_v5"), + // res = armdevopsinfrastructure.PoolsClientGetResponse{ + // Pool: &armdevopsinfrastructure.Pool{ + // Properties: &armdevopsinfrastructure.PoolProperties{ + // ProvisioningState: to.Ptr(armdevopsinfrastructure.ProvisioningStateSucceeded), + // MaximumConcurrency: to.Ptr[int32](10), + // DevCenterProjectResourceID: to.Ptr("/subscriptions/222e81d0-cf38-4dab-baa5-289bf16baaa4/resourceGroups/rg-1es-devcenter/providers/Microsoft.DevCenter/projects/1ES"), + // OrganizationProfile: &armdevopsinfrastructure.AzureDevOpsOrganizationProfile{ + // Kind: to.Ptr("AzureDevOps"), + // Organizations: []*armdevopsinfrastructure.Organization{ + // { + // URL: to.Ptr("https://mseng.visualstudio.com"), + // }, + // }, + // }, + // AgentProfile: &armdevopsinfrastructure.StatelessAgentProfile{ + // Kind: to.Ptr("Stateless"), + // }, + // FabricProfile: &armdevopsinfrastructure.VmssFabricProfile{ + // Kind: to.Ptr("Vmss"), + // SKU: &armdevopsinfrastructure.DevOpsAzureSKU{ + // Name: to.Ptr("Standard_D4ads_v5"), + // }, + // Images: []*armdevopsinfrastructure.PoolImage{ + // { + // ResourceID: to.Ptr("/MicrosoftWindowsServer/WindowsServer/2019-Datacenter/latest"), + // }, + // }, // }, // }, - // MaximumConcurrency: to.Ptr[int32](10), - // OrganizationProfile: &armdevopsinfrastructure.AzureDevOpsOrganizationProfile{ - // Kind: to.Ptr("AzureDevOps"), - // Organizations: []*armdevopsinfrastructure.Organization{ - // { - // URL: to.Ptr("https://mseng.visualstudio.com"), - // }}, - // }, - // ProvisioningState: to.Ptr(armdevopsinfrastructure.ProvisioningStateSucceeded), + // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/rg/providers/Microsoft.DevOpsInfrastructure/Pools/pool"), + // Location: to.Ptr("eastus"), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/devopsinfrastructure/resource-manager/Microsoft.DevOpsInfrastructure/preview/2024-04-04-preview/examples/CreateOrUpdatePool.json -func ExamplePoolsClient_BeginCreateOrUpdate() { +// Generated from example definition: 2024-10-19/ListPoolsBySubscriptionAndResourceGroup.json +func ExamplePoolsClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armdevopsinfrastructure.NewClientFactory("", cred, nil) + clientFactory, err := armdevopsinfrastructure.NewClientFactory("a2e95d27-c161-4b61-bda4-11512c14c2c2", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewPoolsClient().BeginCreateOrUpdate(ctx, "rg", "pool", armdevopsinfrastructure.Pool{ - Location: to.Ptr("eastus"), - Properties: &armdevopsinfrastructure.PoolProperties{ - AgentProfile: &armdevopsinfrastructure.StatelessAgentProfile{ - Kind: to.Ptr("Stateless"), - }, - DevCenterProjectResourceID: to.Ptr("/subscriptions/222e81d0-cf38-4dab-baa5-289bf16baaa4/resourceGroups/rg-1es-devcenter/providers/Microsoft.DevCenter/projects/1ES"), - FabricProfile: &armdevopsinfrastructure.VmssFabricProfile{ - Kind: to.Ptr("Vmss"), - Images: []*armdevopsinfrastructure.PoolImage{ - { - ResourceID: to.Ptr("/MicrosoftWindowsServer/WindowsServer/2019-Datacenter/latest"), - }}, - SKU: &armdevopsinfrastructure.DevOpsAzureSKU{ - Name: to.Ptr("Standard_D4ads_v5"), - }, - }, - MaximumConcurrency: to.Ptr[int32](10), - OrganizationProfile: &armdevopsinfrastructure.AzureDevOpsOrganizationProfile{ - Kind: to.Ptr("AzureDevOps"), - Organizations: []*armdevopsinfrastructure.Organization{ - { - URL: to.Ptr("https://mseng.visualstudio.com"), - }}, - }, - ProvisioningState: to.Ptr(armdevopsinfrastructure.ProvisioningStateSucceeded), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) + pager := clientFactory.NewPoolsClient().NewListByResourceGroupPager("rg", 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 = armdevopsinfrastructure.PoolsClientListByResourceGroupResponse{ + // PoolListResult: armdevopsinfrastructure.PoolListResult{ + // Value: []*armdevopsinfrastructure.Pool{ + // { + // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/rg/providers/Microsoft.DevOpsInfrastructure/Pools/pool"), + // Location: to.Ptr("eastus"), + // }, + // }, + // }, + // } } - // 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.Pool = armdevopsinfrastructure.Pool{ - // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/rg/providers/Microsoft.DevOpsInfrastructure/Pools/pool"), - // Location: to.Ptr("eastus"), - // Properties: &armdevopsinfrastructure.PoolProperties{ - // AgentProfile: &armdevopsinfrastructure.StatelessAgentProfile{ - // Kind: to.Ptr("Stateless"), - // }, - // DevCenterProjectResourceID: to.Ptr("/subscriptions/222e81d0-cf38-4dab-baa5-289bf16baaa4/resourceGroups/rg-1es-devcenter/providers/Microsoft.DevCenter/projects/1ES"), - // FabricProfile: &armdevopsinfrastructure.VmssFabricProfile{ - // Kind: to.Ptr("Vmss"), - // Images: []*armdevopsinfrastructure.PoolImage{ - // { - // ResourceID: to.Ptr("/MicrosoftWindowsServer/WindowsServer/2019-Datacenter/latest"), - // }}, - // SKU: &armdevopsinfrastructure.DevOpsAzureSKU{ - // Name: to.Ptr("Standard_D4ads_v5"), - // }, - // }, - // MaximumConcurrency: to.Ptr[int32](10), - // OrganizationProfile: &armdevopsinfrastructure.AzureDevOpsOrganizationProfile{ - // Kind: to.Ptr("AzureDevOps"), - // Organizations: []*armdevopsinfrastructure.Organization{ - // { - // URL: to.Ptr("https://mseng.visualstudio.com"), - // }}, - // }, - // ProvisioningState: to.Ptr(armdevopsinfrastructure.ProvisioningStateSucceeded), - // }, - // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/devopsinfrastructure/resource-manager/Microsoft.DevOpsInfrastructure/preview/2024-04-04-preview/examples/UpdatePool.json -func ExamplePoolsClient_BeginUpdate() { +// Generated from example definition: 2024-10-19/ListPoolsBySubscription.json +func ExamplePoolsClient_NewListBySubscriptionPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armdevopsinfrastructure.NewClientFactory("", cred, nil) + clientFactory, err := armdevopsinfrastructure.NewClientFactory("a2e95d27-c161-4b61-bda4-11512c14c2c2", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewPoolsClient().BeginUpdate(ctx, "rg", "pool", armdevopsinfrastructure.PoolUpdate{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) + pager := clientFactory.NewPoolsClient().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 = armdevopsinfrastructure.PoolsClientListBySubscriptionResponse{ + // PoolListResult: armdevopsinfrastructure.PoolListResult{ + // Value: []*armdevopsinfrastructure.Pool{ + // { + // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/aoiresourceGroupName/providers/Microsoft.DevOpsInfrastructure/Pools/pool"), + // Location: to.Ptr("eastus"), + // }, + // }, + // }, + // } } - // 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.Pool = armdevopsinfrastructure.Pool{ - // Location: to.Ptr("eastus"), - // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/devopsinfrastructure/resource-manager/Microsoft.DevOpsInfrastructure/preview/2024-04-04-preview/examples/DeletePool.json -func ExamplePoolsClient_BeginDelete() { +// Generated from example definition: 2024-10-19/UpdatePool.json +func ExamplePoolsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armdevopsinfrastructure.NewClientFactory("", cred, nil) + clientFactory, err := armdevopsinfrastructure.NewClientFactory("a2e95d27-c161-4b61-bda4-11512c14c2c2", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewPoolsClient().BeginDelete(ctx, "rg", "pool", nil) + poller, err := clientFactory.NewPoolsClient().BeginUpdate(ctx, "rg", "pool", armdevopsinfrastructure.PoolUpdate{}, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - _, err = poller.PollUntilDone(ctx, nil) + res, err := poller.PollUntilDone(ctx, nil) if err != nil { log.Fatalf("failed to pull the result: %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 = armdevopsinfrastructure.PoolsClientUpdateResponse{ + // Pool: &armdevopsinfrastructure.Pool{ + // Location: to.Ptr("eastus"), + // }, + // } } diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/resourcedetails_client.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/resourcedetails_client.go index 4d6fa8f44d16..a6f45ca24b4d 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/resourcedetails_client.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/resourcedetails_client.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdevopsinfrastructure @@ -45,7 +41,7 @@ func NewResourceDetailsClient(subscriptionID string, credential azcore.TokenCred // NewListByPoolPager - List ResourceDetailsObject resources by Pool // -// Generated from API version 2024-04-04-preview +// Generated from API version 2024-10-19 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - poolName - Name of the pool. It needs to be globally unique. // - options - ResourceDetailsClientListByPoolOptions contains the optional parameters for the ResourceDetailsClient.NewListByPoolPager @@ -74,7 +70,7 @@ func (client *ResourceDetailsClient) NewListByPoolPager(resourceGroupName string } // listByPoolCreateRequest creates the ListByPool request. -func (client *ResourceDetailsClient) listByPoolCreateRequest(ctx context.Context, resourceGroupName string, poolName string, options *ResourceDetailsClientListByPoolOptions) (*policy.Request, error) { +func (client *ResourceDetailsClient) listByPoolCreateRequest(ctx context.Context, resourceGroupName string, poolName string, _ *ResourceDetailsClientListByPoolOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools/{poolName}/resources" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -93,7 +89,7 @@ func (client *ResourceDetailsClient) listByPoolCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-04-preview") + reqQP.Set("api-version", "2024-10-19") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/resourcedetails_client_example_test.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/resourcedetails_client_example_test.go index 2c320ed1d805..958a8be7c85a 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/resourcedetails_client_example_test.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/resourcedetails_client_example_test.go @@ -1,30 +1,24 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdevopsinfrastructure_test import ( "context" - "log" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/devopsinfrastructure/resource-manager/Microsoft.DevOpsInfrastructure/preview/2024-04-04-preview/examples/ResourceDetails_ListByPool.json +// Generated from example definition: 2024-10-19/ResourceDetails_ListByPool.json func ExampleResourceDetailsClient_NewListByPoolPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armdevopsinfrastructure.NewClientFactory("", cred, nil) + clientFactory, err := armdevopsinfrastructure.NewClientFactory("a2e95d27-c161-4b61-bda4-11512c14c2c2", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -39,26 +33,29 @@ func ExampleResourceDetailsClient_NewListByPoolPager() { _ = 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.ResourceDetailsObjectListResult = armdevopsinfrastructure.ResourceDetailsObjectListResult{ - // Value: []*armdevopsinfrastructure.ResourceDetailsObject{ - // { - // Name: to.Ptr("dd8cc705c000000"), - // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/my-resource-group/providers/Microsoft.DevOpsInfrastructure/pools/my-devops-pool/resources/my-dev-ops-pool:04dcde21-626e-5a7e-8659-ce12f9284b29:dd8cc705c_0"), - // Properties: &armdevopsinfrastructure.ResourceDetailsObjectProperties{ - // Image: to.Ptr("my-image"), - // ImageVersion: to.Ptr("4.0.0"), - // Status: to.Ptr(armdevopsinfrastructure.ResourceStatusReady), + // page = armdevopsinfrastructure.ResourceDetailsClientListByPoolResponse{ + // ResourceDetailsObjectListResult: armdevopsinfrastructure.ResourceDetailsObjectListResult{ + // Value: []*armdevopsinfrastructure.ResourceDetailsObject{ + // { + // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/my-resource-group/providers/Microsoft.DevOpsInfrastructure/pools/my-devops-pool/resources/my-dev-ops-pool:04dcde21-626e-5a7e-8659-ce12f9284b29:dd8cc705c_0"), + // Name: to.Ptr("dd8cc705c000000"), + // Properties: &armdevopsinfrastructure.ResourceDetailsObjectProperties{ + // Image: to.Ptr("my-image"), + // ImageVersion: to.Ptr("4.0.0"), + // Status: to.Ptr(armdevopsinfrastructure.ResourceStatusReady), + // }, // }, - // }, - // { - // Name: to.Ptr("dd8cc705c000001"), - // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/my-resource-group/providers/Microsoft.DevOpsInfrastructure/pools/my-devops-pool/resources/my-dev-ops-pool:04dcde21-626e-5a7e-8659-ce12f9284b29:dd8cc705c_1"), - // Properties: &armdevopsinfrastructure.ResourceDetailsObjectProperties{ - // Image: to.Ptr("my-image"), - // ImageVersion: to.Ptr("4.0.0"), - // Status: to.Ptr(armdevopsinfrastructure.ResourceStatusAllocated), + // { + // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/my-resource-group/providers/Microsoft.DevOpsInfrastructure/pools/my-devops-pool/resources/my-dev-ops-pool:04dcde21-626e-5a7e-8659-ce12f9284b29:dd8cc705c_1"), + // Name: to.Ptr("dd8cc705c000001"), + // Properties: &armdevopsinfrastructure.ResourceDetailsObjectProperties{ + // Image: to.Ptr("my-image"), + // ImageVersion: to.Ptr("4.0.0"), + // Status: to.Ptr(armdevopsinfrastructure.ResourceStatusAllocated), + // }, // }, - // }}, + // }, + // }, // } } } diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/responses.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/responses.go index a536b94a7c60..98c03270abff 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/responses.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/responses.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdevopsinfrastructure @@ -14,12 +10,6 @@ type ImageVersionsClientListByImageResponse struct { ImageVersionListResult } -// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. -type OperationsClientListResponse struct { - // 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 -} - // PoolsClientCreateOrUpdateResponse contains the response from method PoolsClient.BeginCreateOrUpdate. type PoolsClientCreateOrUpdateResponse struct { // Concrete tracked resource types can be created by aliasing this type using a specific property type. @@ -67,8 +57,14 @@ type SKUClientListByLocationResponse struct { ResourceSKUListResult } -// SubscriptionUsagesClientListByLocationResponse contains the response from method SubscriptionUsagesClient.NewListByLocationPager. -type SubscriptionUsagesClientListByLocationResponse struct { - // The response of a Quota list operation. - QuotaListResult +// SubscriptionUsagesClientUsagesResponse contains the response from method SubscriptionUsagesClient.NewUsagesPager. +type SubscriptionUsagesClientUsagesResponse struct { + // Paged collection of Quota items + PagedQuota +} + +// operationsClientlistMethodResponse contains the response from method OperationsClient.NewlistMethodPager. +type operationsClientlistMethodResponse struct { + // 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 } diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/sku_client.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/sku_client.go index 1f0bb1a197c0..1b3a6762c841 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/sku_client.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/sku_client.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdevopsinfrastructure @@ -45,7 +41,7 @@ func NewSKUClient(subscriptionID string, credential azcore.TokenCredential, opti // NewListByLocationPager - List ResourceSku resources by subscription ID // -// Generated from API version 2024-04-04-preview +// Generated from API version 2024-10-19 // - locationName - Name of the location. // - options - SKUClientListByLocationOptions contains the optional parameters for the SKUClient.NewListByLocationPager method. func (client *SKUClient) NewListByLocationPager(locationName string, options *SKUClientListByLocationOptions) *runtime.Pager[SKUClientListByLocationResponse] { @@ -72,7 +68,7 @@ func (client *SKUClient) NewListByLocationPager(locationName string, options *SK } // listByLocationCreateRequest creates the ListByLocation request. -func (client *SKUClient) listByLocationCreateRequest(ctx context.Context, locationName string, options *SKUClientListByLocationOptions) (*policy.Request, error) { +func (client *SKUClient) listByLocationCreateRequest(ctx context.Context, locationName string, _ *SKUClientListByLocationOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DevOpsInfrastructure/locations/{locationName}/skus" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -87,7 +83,7 @@ func (client *SKUClient) listByLocationCreateRequest(ctx context.Context, locati return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-04-preview") + reqQP.Set("api-version", "2024-10-19") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/sku_client_example_test.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/sku_client_example_test.go index 3ccfd416f8b2..13f94b53335b 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/sku_client_example_test.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/sku_client_example_test.go @@ -1,30 +1,24 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdevopsinfrastructure_test import ( "context" - "log" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/devopsinfrastructure/resource-manager/Microsoft.DevOpsInfrastructure/preview/2024-04-04-preview/examples/Sku_ListByLocation.json +// Generated from example definition: 2024-10-19/Sku_ListByLocation.json func ExampleSKUClient_NewListByLocationPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armdevopsinfrastructure.NewClientFactory("", cred, nil) + clientFactory, err := armdevopsinfrastructure.NewClientFactory("a2e95d27-c161-4b61-bda4-11512c14c2c2", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -39,259 +33,275 @@ func ExampleSKUClient_NewListByLocationPager() { _ = 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.ResourceSKUListResult = armdevopsinfrastructure.ResourceSKUListResult{ - // Value: []*armdevopsinfrastructure.ResourceSKU{ - // { - // Name: to.Ptr("Basic_A0"), - // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/providers/Microsoft.DevOpsInfrastructure/locations/eastus/skus/Basic_A0"), - // Properties: &armdevopsinfrastructure.ResourceSKUProperties{ - // Capabilities: []*armdevopsinfrastructure.ResourceSKUCapabilities{ - // { - // Name: to.Ptr("MaxResourceVolumeMB"), - // Value: to.Ptr("20480"), - // }, - // { - // Name: to.Ptr("OSVhdSizeMB"), - // Value: to.Ptr("1047552"), - // }, - // { - // Name: to.Ptr("vCPUs"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("MemoryPreservingMaintenanceSupported"), - // Value: to.Ptr("True"), - // }, - // { - // Name: to.Ptr("HyperVGenerations"), - // Value: to.Ptr("V1"), - // }, - // { - // Name: to.Ptr("MemoryGB"), - // Value: to.Ptr("0.75"), - // }, - // { - // Name: to.Ptr("MaxDataDiskCount"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("CpuArchitectureType"), - // Value: to.Ptr("x64"), - // }, - // { - // Name: to.Ptr("LowPriorityCapable"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("PremiumIO"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("VMDeploymentTypes"), - // Value: to.Ptr("IaaS"), - // }, - // { - // Name: to.Ptr("vCPUsAvailable"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("ACUs"), - // Value: to.Ptr("50"), - // }, - // { - // Name: to.Ptr("vCPUsPerCore"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("EphemeralOSDiskSupported"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("EncryptionAtHostSupported"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("CapacityReservationSupported"), - // Value: to.Ptr("False"), + // page = armdevopsinfrastructure.SKUClientListByLocationResponse{ + // ResourceSKUListResult: armdevopsinfrastructure.ResourceSKUListResult{ + // Value: []*armdevopsinfrastructure.ResourceSKU{ + // { + // Properties: &armdevopsinfrastructure.ResourceSKUProperties{ + // ResourceType: to.Ptr("virtualMachines"), + // Tier: to.Ptr("Basic"), + // Size: to.Ptr("A0"), + // Family: to.Ptr("basicAFamily"), + // Locations: []*string{ + // to.Ptr("eastus"), // }, - // { - // Name: to.Ptr("AcceleratedNetworkingEnabled"), - // Value: to.Ptr("False"), + // LocationInfo: []*armdevopsinfrastructure.ResourceSKULocationInfo{ + // { + // Location: to.Ptr("eastus"), + // Zones: []*string{ + // }, + // ZoneDetails: []*armdevopsinfrastructure.ResourceSKUZoneDetails{ + // }, + // }, // }, - // { - // Name: to.Ptr("RdmaEnabled"), - // Value: to.Ptr("False"), + // Capabilities: []*armdevopsinfrastructure.ResourceSKUCapabilities{ + // { + // Name: to.Ptr("MaxResourceVolumeMB"), + // Value: to.Ptr("20480"), + // }, + // { + // Name: to.Ptr("OSVhdSizeMB"), + // Value: to.Ptr("1047552"), + // }, + // { + // Name: to.Ptr("vCPUs"), + // Value: to.Ptr("1"), + // }, + // { + // Name: to.Ptr("MemoryPreservingMaintenanceSupported"), + // Value: to.Ptr("True"), + // }, + // { + // Name: to.Ptr("HyperVGenerations"), + // Value: to.Ptr("V1"), + // }, + // { + // Name: to.Ptr("MemoryGB"), + // Value: to.Ptr("0.75"), + // }, + // { + // Name: to.Ptr("MaxDataDiskCount"), + // Value: to.Ptr("1"), + // }, + // { + // Name: to.Ptr("CpuArchitectureType"), + // Value: to.Ptr("x64"), + // }, + // { + // Name: to.Ptr("LowPriorityCapable"), + // Value: to.Ptr("False"), + // }, + // { + // Name: to.Ptr("PremiumIO"), + // Value: to.Ptr("False"), + // }, + // { + // Name: to.Ptr("VMDeploymentTypes"), + // Value: to.Ptr("IaaS"), + // }, + // { + // Name: to.Ptr("vCPUsAvailable"), + // Value: to.Ptr("1"), + // }, + // { + // Name: to.Ptr("ACUs"), + // Value: to.Ptr("50"), + // }, + // { + // Name: to.Ptr("vCPUsPerCore"), + // Value: to.Ptr("1"), + // }, + // { + // Name: to.Ptr("EphemeralOSDiskSupported"), + // Value: to.Ptr("False"), + // }, + // { + // Name: to.Ptr("EncryptionAtHostSupported"), + // Value: to.Ptr("False"), + // }, + // { + // Name: to.Ptr("CapacityReservationSupported"), + // Value: to.Ptr("False"), + // }, + // { + // Name: to.Ptr("AcceleratedNetworkingEnabled"), + // Value: to.Ptr("False"), + // }, + // { + // Name: to.Ptr("RdmaEnabled"), + // Value: to.Ptr("False"), + // }, + // { + // Name: to.Ptr("MaxNetworkInterfaces"), + // Value: to.Ptr("2"), + // }, // }, - // { - // Name: to.Ptr("MaxNetworkInterfaces"), - // Value: to.Ptr("2"), - // }}, - // Family: to.Ptr("basicAFamily"), - // LocationInfo: []*armdevopsinfrastructure.ResourceSKULocationInfo{ - // { - // Location: to.Ptr("eastus"), - // ZoneDetails: []*armdevopsinfrastructure.ResourceSKUZoneDetails{ - // }, - // Zones: []*string{ - // }, - // }}, - // Locations: []*string{ - // to.Ptr("eastus")}, - // ResourceType: to.Ptr("virtualMachines"), // Restrictions: []*armdevopsinfrastructure.ResourceSKURestrictions{ // { // Type: to.Ptr(armdevopsinfrastructure.ResourceSKURestrictionsTypeLocation), - // ReasonCode: to.Ptr(armdevopsinfrastructure.ResourceSKURestrictionsReasonCodeNotAvailableForSubscription), + // Values: []*string{ + // to.Ptr("eastus"), + // }, // RestrictionInfo: &armdevopsinfrastructure.ResourceSKURestrictionInfo{ // Locations: []*string{ - // to.Ptr("eastus")}, + // to.Ptr("eastus"), // }, - // Values: []*string{ - // to.Ptr("eastus")}, + // }, + // ReasonCode: to.Ptr(armdevopsinfrastructure.ResourceSKURestrictionsReasonCodeNotAvailableForSubscription), + // }, + // { + // Type: to.Ptr(armdevopsinfrastructure.ResourceSKURestrictionsTypeZone), + // Values: []*string{ + // to.Ptr("eastus"), + // }, + // RestrictionInfo: &armdevopsinfrastructure.ResourceSKURestrictionInfo{ + // Locations: []*string{ + // to.Ptr("eastus"), // }, - // { - // Type: to.Ptr(armdevopsinfrastructure.ResourceSKURestrictionsTypeZone), - // ReasonCode: to.Ptr(armdevopsinfrastructure.ResourceSKURestrictionsReasonCodeNotAvailableForSubscription), - // RestrictionInfo: &armdevopsinfrastructure.ResourceSKURestrictionInfo{ - // Locations: []*string{ - // to.Ptr("eastus")}, - // Zones: []*string{ - // to.Ptr("1"), - // to.Ptr("2"), - // to.Ptr("3")}, - // }, - // Values: []*string{ - // to.Ptr("eastus")}, - // }}, - // Size: to.Ptr("A0"), - // Tier: to.Ptr("Basic"), - // }, + // Zones: []*string{ + // to.Ptr("1"), + // to.Ptr("2"), + // to.Ptr("3"), // }, - // { - // Name: to.Ptr("Standard_A2_v2"), - // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/providers/Microsoft.DevOpsInfrastructure/locations/eastus/skus/Standard_A2_v2"), - // Properties: &armdevopsinfrastructure.ResourceSKUProperties{ - // Capabilities: []*armdevopsinfrastructure.ResourceSKUCapabilities{ - // { - // Name: to.Ptr("MaxResourceVolumeMB"), - // Value: to.Ptr("20480"), - // }, - // { - // Name: to.Ptr("OSVhdSizeMB"), - // Value: to.Ptr("1047552"), - // }, - // { - // Name: to.Ptr("vCPUs"), - // Value: to.Ptr("2"), - // }, - // { - // Name: to.Ptr("MemoryPreservingMaintenanceSupported"), - // Value: to.Ptr("True"), - // }, - // { - // Name: to.Ptr("HyperVGenerations"), - // Value: to.Ptr("V1"), - // }, - // { - // Name: to.Ptr("MemoryGB"), - // Value: to.Ptr("4"), - // }, - // { - // Name: to.Ptr("MaxDataDiskCount"), - // Value: to.Ptr("4"), - // }, - // { - // Name: to.Ptr("CpuArchitectureType"), - // Value: to.Ptr("x64"), - // }, - // { - // Name: to.Ptr("LowPriorityCapable"), - // Value: to.Ptr("True"), - // }, - // { - // Name: to.Ptr("PremiumIO"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("VMDeploymentTypes"), - // Value: to.Ptr("PaaS,IaaS"), - // }, - // { - // Name: to.Ptr("vCPUsAvailable"), - // Value: to.Ptr("2"), - // }, - // { - // Name: to.Ptr("ACUs"), - // Value: to.Ptr("100"), - // }, - // { - // Name: to.Ptr("vCPUsPerCore"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("CombinedTempDiskAndCachedIOPS"), - // Value: to.Ptr("2000"), - // }, - // { - // Name: to.Ptr("CombinedTempDiskAndCachedReadBytesPerSecond"), - // Value: to.Ptr("41943040"), - // }, - // { - // Name: to.Ptr("CombinedTempDiskAndCachedWriteBytesPerSecond"), - // Value: to.Ptr("20971520"), - // }, - // { - // Name: to.Ptr("UncachedDiskIOPS"), - // Value: to.Ptr("3200"), - // }, - // { - // Name: to.Ptr("UncachedDiskBytesPerSecond"), - // Value: to.Ptr("48000000"), - // }, - // { - // Name: to.Ptr("EphemeralOSDiskSupported"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("EncryptionAtHostSupported"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("CapacityReservationSupported"), - // Value: to.Ptr("True"), - // }, - // { - // Name: to.Ptr("AcceleratedNetworkingEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("RdmaEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("MaxNetworkInterfaces"), - // Value: to.Ptr("2"), - // }}, - // Family: to.Ptr("standardAv2Family"), - // LocationInfo: []*armdevopsinfrastructure.ResourceSKULocationInfo{ - // { - // Location: to.Ptr("eastus"), - // ZoneDetails: []*armdevopsinfrastructure.ResourceSKUZoneDetails{ - // }, - // Zones: []*string{ - // to.Ptr("1"), - // to.Ptr("2"), - // to.Ptr("3")}, - // }}, - // Locations: []*string{ - // to.Ptr("eastus")}, - // ResourceType: to.Ptr("virtualMachines"), - // Restrictions: []*armdevopsinfrastructure.ResourceSKURestrictions{ - // }, - // Size: to.Ptr("A2_v2"), - // Tier: to.Ptr("Standard"), - // }, - // }}, - // } + // }, + // ReasonCode: to.Ptr(armdevopsinfrastructure.ResourceSKURestrictionsReasonCodeNotAvailableForSubscription), + // }, + // }, + // }, + // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/providers/Microsoft.DevOpsInfrastructure/locations/eastus/skus/Basic_A0"), + // Name: to.Ptr("Basic_A0"), + // }, + // { + // Properties: &armdevopsinfrastructure.ResourceSKUProperties{ + // ResourceType: to.Ptr("virtualMachines"), + // Tier: to.Ptr("Standard"), + // Size: to.Ptr("A2_v2"), + // Family: to.Ptr("standardAv2Family"), + // Locations: []*string{ + // to.Ptr("eastus"), + // }, + // LocationInfo: []*armdevopsinfrastructure.ResourceSKULocationInfo{ + // { + // Location: to.Ptr("eastus"), + // Zones: []*string{ + // to.Ptr("1"), + // to.Ptr("2"), + // to.Ptr("3"), + // }, + // ZoneDetails: []*armdevopsinfrastructure.ResourceSKUZoneDetails{ + // }, + // }, + // }, + // Capabilities: []*armdevopsinfrastructure.ResourceSKUCapabilities{ + // { + // Name: to.Ptr("MaxResourceVolumeMB"), + // Value: to.Ptr("20480"), + // }, + // { + // Name: to.Ptr("OSVhdSizeMB"), + // Value: to.Ptr("1047552"), + // }, + // { + // Name: to.Ptr("vCPUs"), + // Value: to.Ptr("2"), + // }, + // { + // Name: to.Ptr("MemoryPreservingMaintenanceSupported"), + // Value: to.Ptr("True"), + // }, + // { + // Name: to.Ptr("HyperVGenerations"), + // Value: to.Ptr("V1"), + // }, + // { + // Name: to.Ptr("MemoryGB"), + // Value: to.Ptr("4"), + // }, + // { + // Name: to.Ptr("MaxDataDiskCount"), + // Value: to.Ptr("4"), + // }, + // { + // Name: to.Ptr("CpuArchitectureType"), + // Value: to.Ptr("x64"), + // }, + // { + // Name: to.Ptr("LowPriorityCapable"), + // Value: to.Ptr("True"), + // }, + // { + // Name: to.Ptr("PremiumIO"), + // Value: to.Ptr("False"), + // }, + // { + // Name: to.Ptr("VMDeploymentTypes"), + // Value: to.Ptr("PaaS,IaaS"), + // }, + // { + // Name: to.Ptr("vCPUsAvailable"), + // Value: to.Ptr("2"), + // }, + // { + // Name: to.Ptr("ACUs"), + // Value: to.Ptr("100"), + // }, + // { + // Name: to.Ptr("vCPUsPerCore"), + // Value: to.Ptr("1"), + // }, + // { + // Name: to.Ptr("CombinedTempDiskAndCachedIOPS"), + // Value: to.Ptr("2000"), + // }, + // { + // Name: to.Ptr("CombinedTempDiskAndCachedReadBytesPerSecond"), + // Value: to.Ptr("41943040"), + // }, + // { + // Name: to.Ptr("CombinedTempDiskAndCachedWriteBytesPerSecond"), + // Value: to.Ptr("20971520"), + // }, + // { + // Name: to.Ptr("UncachedDiskIOPS"), + // Value: to.Ptr("3200"), + // }, + // { + // Name: to.Ptr("UncachedDiskBytesPerSecond"), + // Value: to.Ptr("48000000"), + // }, + // { + // Name: to.Ptr("EphemeralOSDiskSupported"), + // Value: to.Ptr("False"), + // }, + // { + // Name: to.Ptr("EncryptionAtHostSupported"), + // Value: to.Ptr("False"), + // }, + // { + // Name: to.Ptr("CapacityReservationSupported"), + // Value: to.Ptr("True"), + // }, + // { + // Name: to.Ptr("AcceleratedNetworkingEnabled"), + // Value: to.Ptr("False"), + // }, + // { + // Name: to.Ptr("RdmaEnabled"), + // Value: to.Ptr("False"), + // }, + // { + // Name: to.Ptr("MaxNetworkInterfaces"), + // Value: to.Ptr("2"), + // }, + // }, + // Restrictions: []*armdevopsinfrastructure.ResourceSKURestrictions{ + // }, + // }, + // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/providers/Microsoft.DevOpsInfrastructure/locations/eastus/skus/Standard_A2_v2"), + // Name: to.Ptr("Standard_A2_v2"), + // }, + // }, + // }, + // } } } diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client.go index 52c4e21bf58b..f65ab469bb3e 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdevopsinfrastructure @@ -43,62 +39,62 @@ func NewSubscriptionUsagesClient(subscriptionID string, credential azcore.TokenC return client, nil } -// NewListByLocationPager - List Quota resources by subscription ID +// NewUsagesPager - List Quota resources by subscription ID // -// Generated from API version 2024-04-04-preview -// - locationName - Name of the location. -// - options - SubscriptionUsagesClientListByLocationOptions contains the optional parameters for the SubscriptionUsagesClient.NewListByLocationPager +// Generated from API version 2024-10-19 +// - location - The name of the Azure region. +// - options - SubscriptionUsagesClientUsagesOptions contains the optional parameters for the SubscriptionUsagesClient.NewUsagesPager // method. -func (client *SubscriptionUsagesClient) NewListByLocationPager(locationName string, options *SubscriptionUsagesClientListByLocationOptions) *runtime.Pager[SubscriptionUsagesClientListByLocationResponse] { - return runtime.NewPager(runtime.PagingHandler[SubscriptionUsagesClientListByLocationResponse]{ - More: func(page SubscriptionUsagesClientListByLocationResponse) bool { +func (client *SubscriptionUsagesClient) NewUsagesPager(location string, options *SubscriptionUsagesClientUsagesOptions) *runtime.Pager[SubscriptionUsagesClientUsagesResponse] { + return runtime.NewPager(runtime.PagingHandler[SubscriptionUsagesClientUsagesResponse]{ + More: func(page SubscriptionUsagesClientUsagesResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, - Fetcher: func(ctx context.Context, page *SubscriptionUsagesClientListByLocationResponse) (SubscriptionUsagesClientListByLocationResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SubscriptionUsagesClient.NewListByLocationPager") + Fetcher: func(ctx context.Context, page *SubscriptionUsagesClientUsagesResponse) (SubscriptionUsagesClientUsagesResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SubscriptionUsagesClient.NewUsagesPager") 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.listByLocationCreateRequest(ctx, locationName, options) + return client.usagesCreateRequest(ctx, location, options) }, nil) if err != nil { - return SubscriptionUsagesClientListByLocationResponse{}, err + return SubscriptionUsagesClientUsagesResponse{}, err } - return client.listByLocationHandleResponse(resp) + return client.usagesHandleResponse(resp) }, Tracer: client.internal.Tracer(), }) } -// listByLocationCreateRequest creates the ListByLocation request. -func (client *SubscriptionUsagesClient) listByLocationCreateRequest(ctx context.Context, locationName string, options *SubscriptionUsagesClientListByLocationOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DevOpsInfrastructure/locations/{locationName}/usages" +// usagesCreateRequest creates the Usages request. +func (client *SubscriptionUsagesClient) usagesCreateRequest(ctx context.Context, location string, _ *SubscriptionUsagesClientUsagesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DevOpsInfrastructure/locations/{location}/usages" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if locationName == "" { - return nil, errors.New("parameter locationName cannot be empty") + if location == "" { + return nil, errors.New("parameter location cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{locationName}", url.PathEscape(locationName)) + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) 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", "2024-04-04-preview") + reqQP.Set("api-version", "2024-10-19") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// listByLocationHandleResponse handles the ListByLocation response. -func (client *SubscriptionUsagesClient) listByLocationHandleResponse(resp *http.Response) (SubscriptionUsagesClientListByLocationResponse, error) { - result := SubscriptionUsagesClientListByLocationResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.QuotaListResult); err != nil { - return SubscriptionUsagesClientListByLocationResponse{}, err +// usagesHandleResponse handles the Usages response. +func (client *SubscriptionUsagesClient) usagesHandleResponse(resp *http.Response) (SubscriptionUsagesClientUsagesResponse, error) { + result := SubscriptionUsagesClientUsagesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PagedQuota); err != nil { + return SubscriptionUsagesClientUsagesResponse{}, err } return result, nil } diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client_example_test.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client_example_test.go index 46b092141c1a..89ea9b79654c 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client_example_test.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client_example_test.go @@ -1,34 +1,28 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdevopsinfrastructure_test import ( "context" - "log" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/devopsinfrastructure/resource-manager/Microsoft.DevOpsInfrastructure/preview/2024-04-04-preview/examples/SubscriptionUsages_ListByLocation.json -func ExampleSubscriptionUsagesClient_NewListByLocationPager() { +// Generated from example definition: 2024-10-19/SubscriptionUsages_Usages.json +func ExampleSubscriptionUsagesClient_NewUsagesPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armdevopsinfrastructure.NewClientFactory("", cred, nil) + clientFactory, err := armdevopsinfrastructure.NewClientFactory("a2e95d27-c161-4b61-bda4-11512c14c2c2", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewSubscriptionUsagesClient().NewListByLocationPager("eastus", nil) + pager := clientFactory.NewSubscriptionUsagesClient().NewUsagesPager("eastus", nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -39,34 +33,31 @@ func ExampleSubscriptionUsagesClient_NewListByLocationPager() { _ = 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.QuotaListResult = armdevopsinfrastructure.QuotaListResult{ - // Value: []*armdevopsinfrastructure.Quota{ - // { - // Name: to.Ptr("standardDADSv5Family"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.DevOpsInfrastructure/Usages/standardDADSv5Family"), - // Properties: &armdevopsinfrastructure.QuotaProperties{ + // page = armdevopsinfrastructure.SubscriptionUsagesClientUsagesResponse{ + // PagedQuota: armdevopsinfrastructure.PagedQuota{ + // Value: []*armdevopsinfrastructure.Quota{ + // { + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.DevOpsInfrastructure/Usages/standardDADSv5Family"), + // Unit: to.Ptr("Count"), + // CurrentValue: to.Ptr[int64](0), + // Limit: to.Ptr[int64](212), // Name: &armdevopsinfrastructure.QuotaName{ - // LocalizedValue: to.Ptr("Standard DADSv5 Family vCPUs (PME VMSS)"), // Value: to.Ptr("standardDADSv5Family"), + // LocalizedValue: to.Ptr("Standard DADSv5 Family vCPUs (PME VMSS)"), // }, - // CurrentValue: to.Ptr[int64](0), - // Limit: to.Ptr[int64](212), - // Unit: to.Ptr("Count"), // }, - // }, - // { - // Name: to.Ptr("standardDPLDSv5Family"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.DevOpsInfrastructure/Usages/standardDPLDSv5Family"), - // Properties: &armdevopsinfrastructure.QuotaProperties{ + // { + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.DevOpsInfrastructure/Usages/standardDPLDSv5Family"), + // Unit: to.Ptr("Count"), + // CurrentValue: to.Ptr[int64](0), + // Limit: to.Ptr[int64](100), // Name: &armdevopsinfrastructure.QuotaName{ - // LocalizedValue: to.Ptr("Standard DPLDSv5 Family vCPUs (PME VMSS)"), // Value: to.Ptr("standardDPLDSv5Family"), + // LocalizedValue: to.Ptr("Standard DPLDSv5 Family vCPUs (PME VMSS)"), // }, - // CurrentValue: to.Ptr[int64](0), - // Limit: to.Ptr[int64](100), - // Unit: to.Ptr("Count"), // }, - // }}, + // }, + // }, // } } } diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/time_rfc3339.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/time_rfc3339.go index 4f8725b55a52..eb4674ef84aa 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/time_rfc3339.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/time_rfc3339.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdevopsinfrastructure @@ -60,6 +56,9 @@ func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } tzOffset := tzOffsetRegex.Match(data) hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") var layout string diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/tsp-location.yaml b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/tsp-location.yaml new file mode 100644 index 000000000000..3d90b31eae4c --- /dev/null +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/devopsinfrastructure/Microsoft.DevOpsInfrastructure.Management +commit: df55cd8178ddd870dbd0c3b1e25c80e3ff48826c +repo: Azure/azure-rest-api-specs +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/durabletask/armdurabletask/CHANGELOG.md b/sdk/resourcemanager/durabletask/armdurabletask/CHANGELOG.md new file mode 100644 index 000000000000..5688ce2060da --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 0.1.0 (2024-11-19) +### Other Changes + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/durabletask/armdurabletask` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt). \ No newline at end of file diff --git a/sdk/resourcemanager/durabletask/armdurabletask/LICENSE.txt b/sdk/resourcemanager/durabletask/armdurabletask/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/resourcemanager/durabletask/armdurabletask/README.md b/sdk/resourcemanager/durabletask/armdurabletask/README.md new file mode 100644 index 000000000000..7896d696bc3e --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/README.md @@ -0,0 +1,92 @@ +# Azure Durabletask Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/durabletask/armdurabletask)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/durabletask/armdurabletask) + +The `armdurabletask` module provides operations for working with Azure Durabletask. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/durabletask/armdurabletask) + +# Getting started + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.18 or above (You could download and install the latest version of Go from [here](https://go.dev/doc/install). It will replace the existing Go on your machine. If you want to install multiple Go versions on the same machine, you could refer this [doc](https://go.dev/doc/manage-install).) + +## Install the package + +This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management. + +Install the Azure Durabletask module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/durabletask/armdurabletask +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Durabletask. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more. + +```go +cred, err := azidentity.NewDefaultAzureCredential(nil) +``` + +For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). + +## Client Factory + +Azure Durabletask module consists of one or more clients. We provide a client factory which could be used to create any client in this module. + +```go +clientFactory, err := armdurabletask.NewClientFactory(, cred, nil) +``` + +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). + +```go +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, +} +clientFactory, err := armdurabletask.NewClientFactory(, cred, &options) +``` + +## Clients + +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.NewSchedulersClient() +``` + +## Fakes + +The fake package contains types used for constructing in-memory fake servers used in unit tests. +This allows writing tests to cover various success/error conditions without the need for connecting to a live service. + +Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes. + +## Provide Feedback + +If you encounter bugs or have suggestions, please +[open an issue](https://github.com/Azure/azure-sdk-for-go/issues) and assign the `Durabletask` label. + +# Contributing + +This project welcomes contributions and suggestions. Most contributions require +you to agree to a Contributor License Agreement (CLA) declaring that you have +the right to, and actually do, grant us the rights to use your contribution. +For details, visit [https://cla.microsoft.com](https://cla.microsoft.com). + +When you submit a pull request, a CLA-bot will automatically determine whether +you need to provide a CLA and decorate the PR appropriately (e.g., label, +comment). Simply follow the instructions provided by the bot. You will only +need to do this once across all repos using our CLA. + +This project has adopted the +[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information, see the +[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any +additional questions or comments. \ No newline at end of file diff --git a/sdk/resourcemanager/durabletask/armdurabletask/ci.yml b/sdk/resourcemanager/durabletask/armdurabletask/ci.yml new file mode 100644 index 000000000000..10ccccb34798 --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/ci.yml @@ -0,0 +1,28 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/durabletask/armdurabletask/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/durabletask/armdurabletask/ + +extends: + template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/durabletask/armdurabletask' diff --git a/sdk/resourcemanager/durabletask/armdurabletask/client_factory.go b/sdk/resourcemanager/durabletask/armdurabletask/client_factory.go new file mode 100644 index 000000000000..033693e3a42f --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/client_factory.go @@ -0,0 +1,56 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armdurabletask + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" +) + +// ClientFactory is a client factory used to create any client in this module. +// Don't use this type directly, use NewClientFactory instead. +type ClientFactory struct { + subscriptionID string + internal *arm.Client +} + +// 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 - The ID of the target subscription. The value must be an UUID. +// - 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) { + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, + internal: internal, + }, nil +} + +// NewOperationsClient creates a new instance of OperationsClient. +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + return &OperationsClient{ + internal: c.internal, + } +} + +// NewSchedulersClient creates a new instance of SchedulersClient. +func (c *ClientFactory) NewSchedulersClient() *SchedulersClient { + return &SchedulersClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewTaskHubsClient creates a new instance of TaskHubsClient. +func (c *ClientFactory) NewTaskHubsClient() *TaskHubsClient { + return &TaskHubsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} diff --git a/sdk/resourcemanager/durabletask/armdurabletask/constants.go b/sdk/resourcemanager/durabletask/armdurabletask/constants.go new file mode 100644 index 000000000000..768812617398 --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/constants.go @@ -0,0 +1,122 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armdurabletask + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/durabletask/armdurabletask" + moduleVersion = "v0.1.0" +) + +// ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +type ActionType string + +const ( + // ActionTypeInternal - Actions are for internal-only APIs. + ActionTypeInternal ActionType = "Internal" +) + +// PossibleActionTypeValues returns the possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ + ActionTypeInternal, + } +} + +// CreatedByType - The kind of entity that created the resource. +type CreatedByType string + +const ( + // CreatedByTypeApplication - The entity was created by an application. + CreatedByTypeApplication CreatedByType = "Application" + // CreatedByTypeKey - The entity was created by a key. + CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeManagedIdentity - The entity was created by a managed identity. + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + // CreatedByTypeUser - The entity was created by a user. + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + +// 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 ( + // OriginSystem - Indicates the operation is initiated by a system. + OriginSystem Origin = "system" + // OriginUser - Indicates the operation is initiated by a user. + OriginUser Origin = "user" + // OriginUserSystem - Indicates the operation is initiated by a user or system. + OriginUserSystem Origin = "user,system" +) + +// PossibleOriginValues returns the possible values for the Origin const type. +func PossibleOriginValues() []Origin { + return []Origin{ + OriginSystem, + OriginUser, + OriginUserSystem, + } +} + +// ProvisioningState - The status of the current operation +type ProvisioningState string + +const ( + // ProvisioningStateAccepted - The resource create request has been accepted + ProvisioningStateAccepted ProvisioningState = "Accepted" + // ProvisioningStateCanceled - Resource creation was canceled. + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateDeleting - The resource is being deleted + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed - Resource creation failed. + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateProvisioning - The resource is being provisioned + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + // ProvisioningStateSucceeded - Resource has been created. + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating - The resource is updating + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateAccepted, + ProvisioningStateCanceled, + ProvisioningStateDeleting, + ProvisioningStateFailed, + ProvisioningStateProvisioning, + ProvisioningStateSucceeded, + ProvisioningStateUpdating, + } +} + +// RedundancyState - The state of the resource redundancy +type RedundancyState string + +const ( + // RedundancyStateNone - The resource is not redundant + RedundancyStateNone RedundancyState = "None" + // RedundancyStateZone - The resource is zone redundant + RedundancyStateZone RedundancyState = "Zone" +) + +// PossibleRedundancyStateValues returns the possible values for the RedundancyState const type. +func PossibleRedundancyStateValues() []RedundancyState { + return []RedundancyState{ + RedundancyStateNone, + RedundancyStateZone, + } +} diff --git a/sdk/resourcemanager/durabletask/armdurabletask/fake/internal.go b/sdk/resourcemanager/durabletask/armdurabletask/fake/internal.go new file mode 100644 index 000000000000..7425b6a669e2 --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/fake/internal.go @@ -0,0 +1,65 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "net/http" + "sync" +) + +type result struct { + resp *http.Response + err error +} + +type nonRetriableError struct { + error +} + +func (nonRetriableError) NonRetriable() { + // marker method +} + +func contains[T comparable](s []T, v T) bool { + for _, vv := range s { + if vv == v { + return true + } + } + return false +} + +func newTracker[T any]() *tracker[T] { + return &tracker[T]{ + items: map[string]*T{}, + } +} + +type tracker[T any] struct { + items map[string]*T + mu sync.Mutex +} + +func (p *tracker[T]) get(req *http.Request) *T { + p.mu.Lock() + defer p.mu.Unlock() + if item, ok := p.items[server.SanitizePagerPollerPath(req.URL.Path)]; ok { + return item + } + return nil +} + +func (p *tracker[T]) add(req *http.Request, item *T) { + p.mu.Lock() + defer p.mu.Unlock() + p.items[server.SanitizePagerPollerPath(req.URL.Path)] = item +} + +func (p *tracker[T]) remove(req *http.Request) { + p.mu.Lock() + defer p.mu.Unlock() + delete(p.items, server.SanitizePagerPollerPath(req.URL.Path)) +} diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/operations_server.go b/sdk/resourcemanager/durabletask/armdurabletask/fake/operations_server.go similarity index 56% rename from sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/operations_server.go rename to sdk/resourcemanager/durabletask/armdurabletask/fake/operations_server.go index 1848d7f7e300..d147c87663ca 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/operations_server.go +++ b/sdk/resourcemanager/durabletask/armdurabletask/fake/operations_server.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -15,32 +11,32 @@ import ( "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/workloadssapvirtualinstance/armworkloadssapvirtualinstance" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/durabletask/armdurabletask" "net/http" ) -// OperationsServer is a fake server for instances of the armworkloadssapvirtualinstance.OperationsClient type. +// OperationsServer is a fake server for instances of the armdurabletask.OperationsClient type. type OperationsServer struct { // NewListPager is the fake for method OperationsClient.NewListPager // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armworkloadssapvirtualinstance.OperationsClientListOptions) (resp azfake.PagerResponder[armworkloadssapvirtualinstance.OperationsClientListResponse]) + NewListPager func(options *armdurabletask.OperationsClientListOptions) (resp azfake.PagerResponder[armdurabletask.OperationsClientListResponse]) } // NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. -// The returned OperationsServerTransport instance is connected to an instance of armworkloadssapvirtualinstance.OperationsClient via the +// The returned OperationsServerTransport instance is connected to an instance of armdurabletask.OperationsClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewOperationsServerTransport(srv *OperationsServer) *OperationsServerTransport { return &OperationsServerTransport{ srv: srv, - newListPager: newTracker[azfake.PagerResponder[armworkloadssapvirtualinstance.OperationsClientListResponse]](), + newListPager: newTracker[azfake.PagerResponder[armdurabletask.OperationsClientListResponse]](), } } -// OperationsServerTransport connects instances of armworkloadssapvirtualinstance.OperationsClient to instances of OperationsServer. +// OperationsServerTransport connects instances of armdurabletask.OperationsClient to instances of OperationsServer. // Don't use this type directly, use NewOperationsServerTransport instead. type OperationsServerTransport struct { srv *OperationsServer - newListPager *tracker[azfake.PagerResponder[armworkloadssapvirtualinstance.OperationsClientListResponse]] + newListPager *tracker[azfake.PagerResponder[armdurabletask.OperationsClientListResponse]] } // Do implements the policy.Transporter interface for OperationsServerTransport. @@ -51,21 +47,40 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return o.dispatchToMethodFake(req, method) +} - switch method { - case "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -77,7 +92,7 @@ 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 *armworkloadssapvirtualinstance.OperationsClientListResponse, createLink func() string) { + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armdurabletask.OperationsClientListResponse, createLink func() string) { page.NextLink = to.Ptr(createLink()) }) } @@ -94,3 +109,9 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/durabletask/armdurabletask/fake/schedulers_server.go b/sdk/resourcemanager/durabletask/armdurabletask/fake/schedulers_server.go new file mode 100644 index 000000000000..98c282491c57 --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/fake/schedulers_server.go @@ -0,0 +1,374 @@ +// 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) Go Code Generator. DO NOT EDIT. + +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/durabletask/armdurabletask" + "net/http" + "net/url" + "regexp" +) + +// SchedulersServer is a fake server for instances of the armdurabletask.SchedulersClient type. +type SchedulersServer struct { + // BeginCreateOrUpdate is the fake for method SchedulersClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, schedulerName string, resource armdurabletask.Scheduler, options *armdurabletask.SchedulersClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armdurabletask.SchedulersClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method SchedulersClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, schedulerName string, options *armdurabletask.SchedulersClientBeginDeleteOptions) (resp azfake.PollerResponder[armdurabletask.SchedulersClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method SchedulersClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, schedulerName string, options *armdurabletask.SchedulersClientGetOptions) (resp azfake.Responder[armdurabletask.SchedulersClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method SchedulersClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armdurabletask.SchedulersClientListByResourceGroupOptions) (resp azfake.PagerResponder[armdurabletask.SchedulersClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method SchedulersClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armdurabletask.SchedulersClientListBySubscriptionOptions) (resp azfake.PagerResponder[armdurabletask.SchedulersClientListBySubscriptionResponse]) + + // BeginUpdate is the fake for method SchedulersClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, schedulerName string, properties armdurabletask.Scheduler, options *armdurabletask.SchedulersClientBeginUpdateOptions) (resp azfake.PollerResponder[armdurabletask.SchedulersClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewSchedulersServerTransport creates a new instance of SchedulersServerTransport with the provided implementation. +// The returned SchedulersServerTransport instance is connected to an instance of armdurabletask.SchedulersClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSchedulersServerTransport(srv *SchedulersServer) *SchedulersServerTransport { + return &SchedulersServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armdurabletask.SchedulersClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armdurabletask.SchedulersClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armdurabletask.SchedulersClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armdurabletask.SchedulersClientListBySubscriptionResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armdurabletask.SchedulersClientUpdateResponse]](), + } +} + +// SchedulersServerTransport connects instances of armdurabletask.SchedulersClient to instances of SchedulersServer. +// Don't use this type directly, use NewSchedulersServerTransport instead. +type SchedulersServerTransport struct { + srv *SchedulersServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armdurabletask.SchedulersClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armdurabletask.SchedulersClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armdurabletask.SchedulersClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armdurabletask.SchedulersClientListBySubscriptionResponse]] + beginUpdate *tracker[azfake.PollerResponder[armdurabletask.SchedulersClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for SchedulersServerTransport. +func (s *SchedulersServerTransport) 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")} + } + + return s.dispatchToMethodFake(req, method) +} + +func (s *SchedulersServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if schedulersServerTransportInterceptor != nil { + res.resp, res.err, intercepted = schedulersServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SchedulersClient.BeginCreateOrUpdate": + res.resp, res.err = s.dispatchBeginCreateOrUpdate(req) + case "SchedulersClient.BeginDelete": + res.resp, res.err = s.dispatchBeginDelete(req) + case "SchedulersClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "SchedulersClient.NewListByResourceGroupPager": + res.resp, res.err = s.dispatchNewListByResourceGroupPager(req) + case "SchedulersClient.NewListBySubscriptionPager": + res.resp, res.err = s.dispatchNewListBySubscriptionPager(req) + case "SchedulersClient.BeginUpdate": + res.resp, res.err = s.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (s *SchedulersServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if s.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := s.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DurableTask/schedulers/(?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[armdurabletask.Scheduler](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + schedulerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("schedulerName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, schedulerNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + s.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + s.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + s.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (s *SchedulersServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if s.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := s.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DurableTask/schedulers/(?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 + } + schedulerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("schedulerName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginDelete(req.Context(), resourceGroupNameParam, schedulerNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + s.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) { + s.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) { + s.beginDelete.remove(req) + } + + return resp, nil +} + +func (s *SchedulersServerTransport) 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\.DurableTask/schedulers/(?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 + } + schedulerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("schedulerName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, schedulerNameParam, 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).Scheduler, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SchedulersServerTransport) 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\.DurableTask/schedulers` + 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 *armdurabletask.SchedulersClientListByResourceGroupResponse, 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 *SchedulersServerTransport) 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\.DurableTask/schedulers` + 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 *armdurabletask.SchedulersClientListBySubscriptionResponse, 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 *SchedulersServerTransport) 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\.DurableTask/schedulers/(?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[armdurabletask.Scheduler](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + schedulerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("schedulerName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginUpdate(req.Context(), resourceGroupNameParam, schedulerNameParam, 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 +} + +// set this to conditionally intercept incoming requests to SchedulersServerTransport +var schedulersServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/durabletask/armdurabletask/fake/server_factory.go b/sdk/resourcemanager/durabletask/armdurabletask/fake/server_factory.go new file mode 100644 index 000000000000..c848fe8a7065 --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/fake/server_factory.go @@ -0,0 +1,86 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" + "sync" +) + +// ServerFactory is a fake server for instances of the armdurabletask.ClientFactory type. +type ServerFactory struct { + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer + + // SchedulersServer contains the fakes for client SchedulersClient + SchedulersServer SchedulersServer + + // TaskHubsServer contains the fakes for client TaskHubsClient + TaskHubsServer TaskHubsServer +} + +// NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. +// The returned ServerFactoryTransport instance is connected to an instance of armdurabletask.ClientFactory via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { + return &ServerFactoryTransport{ + srv: srv, + } +} + +// ServerFactoryTransport connects instances of armdurabletask.ClientFactory to instances of ServerFactory. +// Don't use this type directly, use NewServerFactoryTransport instead. +type ServerFactoryTransport struct { + srv *ServerFactory + trMu sync.Mutex + trOperationsServer *OperationsServerTransport + trSchedulersServer *SchedulersServerTransport + trTaskHubsServer *TaskHubsServerTransport +} + +// Do implements the policy.Transporter interface for ServerFactoryTransport. +func (s *ServerFactoryTransport) 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")} + } + + client := method[:strings.Index(method, ".")] + var resp *http.Response + var err error + + switch client { + case "OperationsClient": + initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) + resp, err = s.trOperationsServer.Do(req) + case "SchedulersClient": + initServer(s, &s.trSchedulersServer, func() *SchedulersServerTransport { return NewSchedulersServerTransport(&s.srv.SchedulersServer) }) + resp, err = s.trSchedulersServer.Do(req) + case "TaskHubsClient": + initServer(s, &s.trTaskHubsServer, func() *TaskHubsServerTransport { return NewTaskHubsServerTransport(&s.srv.TaskHubsServer) }) + resp, err = s.trTaskHubsServer.Do(req) + default: + err = fmt.Errorf("unhandled client %s", client) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func initServer[T any](s *ServerFactoryTransport, dst **T, src func() *T) { + s.trMu.Lock() + if *dst == nil { + *dst = src() + } + s.trMu.Unlock() +} diff --git a/sdk/resourcemanager/durabletask/armdurabletask/fake/taskhubs_server.go b/sdk/resourcemanager/durabletask/armdurabletask/fake/taskhubs_server.go new file mode 100644 index 000000000000..07438a60184c --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/fake/taskhubs_server.go @@ -0,0 +1,293 @@ +// 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) Go Code Generator. DO NOT EDIT. + +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/durabletask/armdurabletask" + "net/http" + "net/url" + "regexp" +) + +// TaskHubsServer is a fake server for instances of the armdurabletask.TaskHubsClient type. +type TaskHubsServer struct { + // BeginCreateOrUpdate is the fake for method TaskHubsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, schedulerName string, taskHubName string, resource armdurabletask.TaskHub, options *armdurabletask.TaskHubsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armdurabletask.TaskHubsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method TaskHubsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, schedulerName string, taskHubName string, options *armdurabletask.TaskHubsClientBeginDeleteOptions) (resp azfake.PollerResponder[armdurabletask.TaskHubsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method TaskHubsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, schedulerName string, taskHubName string, options *armdurabletask.TaskHubsClientGetOptions) (resp azfake.Responder[armdurabletask.TaskHubsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListBySchedulerPager is the fake for method TaskHubsClient.NewListBySchedulerPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySchedulerPager func(resourceGroupName string, schedulerName string, options *armdurabletask.TaskHubsClientListBySchedulerOptions) (resp azfake.PagerResponder[armdurabletask.TaskHubsClientListBySchedulerResponse]) +} + +// NewTaskHubsServerTransport creates a new instance of TaskHubsServerTransport with the provided implementation. +// The returned TaskHubsServerTransport instance is connected to an instance of armdurabletask.TaskHubsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewTaskHubsServerTransport(srv *TaskHubsServer) *TaskHubsServerTransport { + return &TaskHubsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armdurabletask.TaskHubsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armdurabletask.TaskHubsClientDeleteResponse]](), + newListBySchedulerPager: newTracker[azfake.PagerResponder[armdurabletask.TaskHubsClientListBySchedulerResponse]](), + } +} + +// TaskHubsServerTransport connects instances of armdurabletask.TaskHubsClient to instances of TaskHubsServer. +// Don't use this type directly, use NewTaskHubsServerTransport instead. +type TaskHubsServerTransport struct { + srv *TaskHubsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armdurabletask.TaskHubsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armdurabletask.TaskHubsClientDeleteResponse]] + newListBySchedulerPager *tracker[azfake.PagerResponder[armdurabletask.TaskHubsClientListBySchedulerResponse]] +} + +// Do implements the policy.Transporter interface for TaskHubsServerTransport. +func (t *TaskHubsServerTransport) 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")} + } + + return t.dispatchToMethodFake(req, method) +} + +func (t *TaskHubsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if taskHubsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = taskHubsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "TaskHubsClient.BeginCreateOrUpdate": + res.resp, res.err = t.dispatchBeginCreateOrUpdate(req) + case "TaskHubsClient.BeginDelete": + res.resp, res.err = t.dispatchBeginDelete(req) + case "TaskHubsClient.Get": + res.resp, res.err = t.dispatchGet(req) + case "TaskHubsClient.NewListBySchedulerPager": + res.resp, res.err = t.dispatchNewListBySchedulerPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (t *TaskHubsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if t.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := t.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DurableTask/schedulers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/taskHubs/(?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[armdurabletask.TaskHub](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + schedulerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("schedulerName")]) + if err != nil { + return nil, err + } + taskHubNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("taskHubName")]) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, schedulerNameParam, taskHubNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + t.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + t.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + t.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (t *TaskHubsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if t.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := t.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DurableTask/schedulers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/taskHubs/(?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 + } + schedulerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("schedulerName")]) + if err != nil { + return nil, err + } + taskHubNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("taskHubName")]) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.BeginDelete(req.Context(), resourceGroupNameParam, schedulerNameParam, taskHubNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + t.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) { + t.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) { + t.beginDelete.remove(req) + } + + return resp, nil +} + +func (t *TaskHubsServerTransport) 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\.DurableTask/schedulers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/taskHubs/(?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 + } + schedulerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("schedulerName")]) + if err != nil { + return nil, err + } + taskHubNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("taskHubName")]) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.Get(req.Context(), resourceGroupNameParam, schedulerNameParam, taskHubNameParam, 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).TaskHub, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (t *TaskHubsServerTransport) dispatchNewListBySchedulerPager(req *http.Request) (*http.Response, error) { + if t.srv.NewListBySchedulerPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySchedulerPager not implemented")} + } + newListBySchedulerPager := t.newListBySchedulerPager.get(req) + if newListBySchedulerPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DurableTask/schedulers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/taskHubs` + 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 + } + schedulerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("schedulerName")]) + if err != nil { + return nil, err + } + resp := t.srv.NewListBySchedulerPager(resourceGroupNameParam, schedulerNameParam, nil) + newListBySchedulerPager = &resp + t.newListBySchedulerPager.add(req, newListBySchedulerPager) + server.PagerResponderInjectNextLinks(newListBySchedulerPager, req, func(page *armdurabletask.TaskHubsClientListBySchedulerResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySchedulerPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + t.newListBySchedulerPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySchedulerPager) { + t.newListBySchedulerPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to TaskHubsServerTransport +var taskHubsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/durabletask/armdurabletask/fake/time_rfc3339.go b/sdk/resourcemanager/durabletask/armdurabletask/fake/time_rfc3339.go new file mode 100644 index 000000000000..87ee11e83b32 --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/fake/time_rfc3339.go @@ -0,0 +1,109 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) + +const ( + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` +) + +type dateTimeRFC3339 time.Time + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + return err +} + +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + +func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { + return nil + } + var aux dateTimeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/durabletask/armdurabletask/go.mod b/sdk/resourcemanager/durabletask/armdurabletask/go.mod new file mode 100644 index 000000000000..f77beed24400 --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/go.mod @@ -0,0 +1,21 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/durabletask/armdurabletask + +go 1.18 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 +) + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect + github.com/golang-jwt/jwt/v5 v5.2.1 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect + github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect + golang.org/x/crypto v0.27.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/text v0.18.0 // indirect +) diff --git a/sdk/resourcemanager/durabletask/armdurabletask/go.sum b/sdk/resourcemanager/durabletask/armdurabletask/go.sum new file mode 100644 index 000000000000..cbddbbd9ecec --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/go.sum @@ -0,0 +1,29 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 h1:JZg6HRh6W6U4OLl6lk7BZ7BLisIzM9dG1R50zUk9C/M= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0/go.mod h1:YL1xnZ6QejvQHWJrX/AvhFl4WW4rqHVoKspWNVwFk0M= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= +github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/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-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/durabletask/armdurabletask/models.go b/sdk/resourcemanager/durabletask/armdurabletask/models.go new file mode 100644 index 000000000000..214506bc8410 --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/models.go @@ -0,0 +1,173 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armdurabletask + +import "time" + +// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +type Operation struct { + // Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + ActionType *ActionType + + // READ-ONLY; Localized display information for this particular operation. + Display *OperationDisplay + + // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure + // Resource Manager/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 and 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 { + // REQUIRED; The Operation items on this page + Value []*Operation + + // The link to the next page of items + NextLink *string +} + +// Scheduler - A Durable Task Scheduler resource +type Scheduler struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *SchedulerProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; The name of the Scheduler + Name *string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *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 +} + +// SchedulerListResult - The response of a Scheduler list operation. +type SchedulerListResult struct { + // REQUIRED; The Scheduler items on this page + Value []*Scheduler + + // The link to the next page of items + NextLink *string +} + +// SchedulerProperties - Details of the Scheduler +type SchedulerProperties struct { + // REQUIRED; IP allow list for durable task scheduler. Values can be IPv4, IPv6 or CIDR + IPAllowlist []*string + + // REQUIRED; SKU of the durable task scheduler + SKU *SchedulerSKU + + // READ-ONLY; URL of the durable task scheduler + Endpoint *string + + // READ-ONLY; The status of the last operation + ProvisioningState *ProvisioningState +} + +// SchedulerSKU - The SKU (Stock Keeping Unit) assigned to this durable task scheduler +type SchedulerSKU struct { + // REQUIRED; The name of the SKU + Name *string + + // The SKU capacity. This allows scale out/in for the resource and impacts zone redundancy + Capacity *int32 + + // READ-ONLY; Indicates whether the current SKU configuration is zone redundant + RedundancyState *RedundancyState +} + +// 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 +} + +// TaskHub - A Task Hub resource belonging to the scheduler +type TaskHub struct { + // The resource-specific properties for this resource. + Properties *TaskHubProperties + + // READ-ONLY; The name of the TaskHub + Name *string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *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 +} + +// TaskHubListResult - The response of a TaskHub list operation. +type TaskHubListResult struct { + // REQUIRED; The TaskHub items on this page + Value []*TaskHub + + // The link to the next page of items + NextLink *string +} + +// TaskHubProperties - The properties of Task Hub +type TaskHubProperties struct { + // READ-ONLY; URL of the durable task scheduler dashboard + DashboardURL *string + + // READ-ONLY; The status of the last operation + ProvisioningState *ProvisioningState +} diff --git a/sdk/resourcemanager/durabletask/armdurabletask/models_serde.go b/sdk/resourcemanager/durabletask/armdurabletask/models_serde.go new file mode 100644 index 000000000000..26f2e2d7d9fb --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/models_serde.go @@ -0,0 +1,453 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armdurabletask + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// 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 Scheduler. +func (s Scheduler) 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 Scheduler. +func (s *Scheduler) UnmarshalJSON(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 SchedulerListResult. +func (s SchedulerListResult) 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 SchedulerListResult. +func (s *SchedulerListResult) UnmarshalJSON(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 SchedulerProperties. +func (s SchedulerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "endpoint", s.Endpoint) + populate(objectMap, "ipAllowlist", s.IPAllowlist) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "sku", s.SKU) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SchedulerProperties. +func (s *SchedulerProperties) UnmarshalJSON(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 "endpoint": + err = unpopulate(val, "Endpoint", &s.Endpoint) + delete(rawMsg, key) + case "ipAllowlist": + err = unpopulate(val, "IPAllowlist", &s.IPAllowlist) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &s.SKU) + 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 SchedulerSKU. +func (s SchedulerSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "capacity", s.Capacity) + populate(objectMap, "name", s.Name) + populate(objectMap, "redundancyState", s.RedundancyState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SchedulerSKU. +func (s *SchedulerSKU) UnmarshalJSON(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 "capacity": + err = unpopulate(val, "Capacity", &s.Capacity) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "redundancyState": + err = unpopulate(val, "RedundancyState", &s.RedundancyState) + 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 TaskHub. +func (t TaskHub) 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 TaskHub. +func (t *TaskHub) UnmarshalJSON(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 TaskHubListResult. +func (t TaskHubListResult) 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 TaskHubListResult. +func (t *TaskHubListResult) UnmarshalJSON(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 TaskHubProperties. +func (t TaskHubProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dashboardUrl", t.DashboardURL) + populate(objectMap, "provisioningState", t.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TaskHubProperties. +func (t *TaskHubProperties) UnmarshalJSON(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 "dashboardUrl": + err = unpopulate(val, "DashboardURL", &t.DashboardURL) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &t.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v any) error { + if data == nil || string(data) == "null" { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/durabletask/armdurabletask/operations_client.go b/sdk/resourcemanager/durabletask/armdurabletask/operations_client.go new file mode 100644 index 000000000000..e04bf17dd55d --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/operations_client.go @@ -0,0 +1,84 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armdurabletask + +import ( + "context" + "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" +) + +// OperationsClient contains the methods for the Operations group. +// Don't use this type directly, use NewOperationsClient() instead. +type OperationsClient struct { + internal *arm.Client +} + +// NewOperationsClient creates a new instance of OperationsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &OperationsClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - List the operations for the provider +// +// Generated from API version 2024-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 page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.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, options) + }, nil) + if err != nil { + return OperationsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.DurableTask/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", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { + result := OperationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { + return OperationsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/durabletask/armdurabletask/operations_client_example_test.go b/sdk/resourcemanager/durabletask/armdurabletask/operations_client_example_test.go new file mode 100644 index 000000000000..b6a09b3c04bf --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/operations_client_example_test.go @@ -0,0 +1,56 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armdurabletask_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/durabletask/armdurabletask" + "log" +) + +// Generated from example definition: 2024-10-01-preview/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 := armdurabletask.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 = armdurabletask.OperationsClientListResponse{ + // OperationListResult: armdurabletask.OperationListResult{ + // Value: []*armdurabletask.Operation{ + // { + // Name: to.Ptr("jqsgzvpbtspnikfz"), + // IsDataAction: to.Ptr(true), + // Display: &armdurabletask.OperationDisplay{ + // Provider: to.Ptr("bosyazksbxugcbsdipxwmdc"), + // Resource: to.Ptr("texxqckghuv"), + // Operation: to.Ptr("cwgwrxyusyqdrcbxrlmnjzpwxatuk"), + // Description: to.Ptr("mqzopqigvcyggcvezqgvyufbd"), + // }, + // Origin: to.Ptr(armdurabletask.OriginUser), + // ActionType: to.Ptr(armdurabletask.ActionTypeInternal), + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/akpblld"), + // }, + // } + } +} diff --git a/sdk/resourcemanager/durabletask/armdurabletask/options.go b/sdk/resourcemanager/durabletask/armdurabletask/options.go new file mode 100644 index 000000000000..0b89a2fa1e01 --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/options.go @@ -0,0 +1,68 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armdurabletask + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// SchedulersClientBeginCreateOrUpdateOptions contains the optional parameters for the SchedulersClient.BeginCreateOrUpdate +// method. +type SchedulersClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// SchedulersClientBeginDeleteOptions contains the optional parameters for the SchedulersClient.BeginDelete method. +type SchedulersClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// SchedulersClientBeginUpdateOptions contains the optional parameters for the SchedulersClient.BeginUpdate method. +type SchedulersClientBeginUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// SchedulersClientGetOptions contains the optional parameters for the SchedulersClient.Get method. +type SchedulersClientGetOptions struct { + // placeholder for future optional parameters +} + +// SchedulersClientListByResourceGroupOptions contains the optional parameters for the SchedulersClient.NewListByResourceGroupPager +// method. +type SchedulersClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// SchedulersClientListBySubscriptionOptions contains the optional parameters for the SchedulersClient.NewListBySubscriptionPager +// method. +type SchedulersClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// TaskHubsClientBeginCreateOrUpdateOptions contains the optional parameters for the TaskHubsClient.BeginCreateOrUpdate method. +type TaskHubsClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// TaskHubsClientBeginDeleteOptions contains the optional parameters for the TaskHubsClient.BeginDelete method. +type TaskHubsClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// TaskHubsClientGetOptions contains the optional parameters for the TaskHubsClient.Get method. +type TaskHubsClientGetOptions struct { + // placeholder for future optional parameters +} + +// TaskHubsClientListBySchedulerOptions contains the optional parameters for the TaskHubsClient.NewListBySchedulerPager method. +type TaskHubsClientListBySchedulerOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/durabletask/armdurabletask/responses.go b/sdk/resourcemanager/durabletask/armdurabletask/responses.go new file mode 100644 index 000000000000..98a93ab5ca8b --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/responses.go @@ -0,0 +1,69 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armdurabletask + +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. +type OperationsClientListResponse struct { + // 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 +} + +// SchedulersClientCreateOrUpdateResponse contains the response from method SchedulersClient.BeginCreateOrUpdate. +type SchedulersClientCreateOrUpdateResponse struct { + // A Durable Task Scheduler resource + Scheduler +} + +// SchedulersClientDeleteResponse contains the response from method SchedulersClient.BeginDelete. +type SchedulersClientDeleteResponse struct { + // placeholder for future response values +} + +// SchedulersClientGetResponse contains the response from method SchedulersClient.Get. +type SchedulersClientGetResponse struct { + // A Durable Task Scheduler resource + Scheduler +} + +// SchedulersClientListByResourceGroupResponse contains the response from method SchedulersClient.NewListByResourceGroupPager. +type SchedulersClientListByResourceGroupResponse struct { + // The response of a Scheduler list operation. + SchedulerListResult +} + +// SchedulersClientListBySubscriptionResponse contains the response from method SchedulersClient.NewListBySubscriptionPager. +type SchedulersClientListBySubscriptionResponse struct { + // The response of a Scheduler list operation. + SchedulerListResult +} + +// SchedulersClientUpdateResponse contains the response from method SchedulersClient.BeginUpdate. +type SchedulersClientUpdateResponse struct { + // A Durable Task Scheduler resource + Scheduler +} + +// TaskHubsClientCreateOrUpdateResponse contains the response from method TaskHubsClient.BeginCreateOrUpdate. +type TaskHubsClientCreateOrUpdateResponse struct { + // A Task Hub resource belonging to the scheduler + TaskHub +} + +// TaskHubsClientDeleteResponse contains the response from method TaskHubsClient.BeginDelete. +type TaskHubsClientDeleteResponse struct { + // placeholder for future response values +} + +// TaskHubsClientGetResponse contains the response from method TaskHubsClient.Get. +type TaskHubsClientGetResponse struct { + // A Task Hub resource belonging to the scheduler + TaskHub +} + +// TaskHubsClientListBySchedulerResponse contains the response from method TaskHubsClient.NewListBySchedulerPager. +type TaskHubsClientListBySchedulerResponse struct { + // The response of a TaskHub list operation. + TaskHubListResult +} diff --git a/sdk/resourcemanager/durabletask/armdurabletask/schedulers_client.go b/sdk/resourcemanager/durabletask/armdurabletask/schedulers_client.go new file mode 100644 index 000000000000..73494324aaf6 --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/schedulers_client.go @@ -0,0 +1,455 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armdurabletask + +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" +) + +// SchedulersClient contains the methods for the Schedulers group. +// Don't use this type directly, use NewSchedulersClient() instead. +type SchedulersClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSchedulersClient creates a new instance of SchedulersClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewSchedulersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SchedulersClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SchedulersClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create or update a Scheduler +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - schedulerName - The name of the Scheduler +// - resource - Resource create parameters. +// - options - SchedulersClientBeginCreateOrUpdateOptions contains the optional parameters for the SchedulersClient.BeginCreateOrUpdate +// method. +func (client *SchedulersClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, schedulerName string, resource Scheduler, options *SchedulersClientBeginCreateOrUpdateOptions) (*runtime.Poller[SchedulersClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, schedulerName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SchedulersClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SchedulersClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create or update a Scheduler +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +func (client *SchedulersClient) createOrUpdate(ctx context.Context, resourceGroupName string, schedulerName string, resource Scheduler, options *SchedulersClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "SchedulersClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, schedulerName, resource, 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 +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *SchedulersClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, schedulerName string, resource Scheduler, _ *SchedulersClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}" + 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 schedulerName == "" { + return nil, errors.New("parameter schedulerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{schedulerName}", url.PathEscape(schedulerName)) + 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", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Delete a Scheduler +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - schedulerName - The name of the Scheduler +// - options - SchedulersClientBeginDeleteOptions contains the optional parameters for the SchedulersClient.BeginDelete method. +func (client *SchedulersClient) BeginDelete(ctx context.Context, resourceGroupName string, schedulerName string, options *SchedulersClientBeginDeleteOptions) (*runtime.Poller[SchedulersClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, schedulerName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SchedulersClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SchedulersClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a Scheduler +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +func (client *SchedulersClient) deleteOperation(ctx context.Context, resourceGroupName string, schedulerName string, options *SchedulersClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "SchedulersClient.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, schedulerName, 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.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *SchedulersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, schedulerName string, _ *SchedulersClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}" + 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 schedulerName == "" { + return nil, errors.New("parameter schedulerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{schedulerName}", url.PathEscape(schedulerName)) + 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", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a Scheduler +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - schedulerName - The name of the Scheduler +// - options - SchedulersClientGetOptions contains the optional parameters for the SchedulersClient.Get method. +func (client *SchedulersClient) Get(ctx context.Context, resourceGroupName string, schedulerName string, options *SchedulersClientGetOptions) (SchedulersClientGetResponse, error) { + var err error + const operationName = "SchedulersClient.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, schedulerName, options) + if err != nil { + return SchedulersClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SchedulersClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SchedulersClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *SchedulersClient) getCreateRequest(ctx context.Context, resourceGroupName string, schedulerName string, _ *SchedulersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}" + 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 schedulerName == "" { + return nil, errors.New("parameter schedulerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{schedulerName}", url.PathEscape(schedulerName)) + 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", "2024-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 *SchedulersClient) getHandleResponse(resp *http.Response) (SchedulersClientGetResponse, error) { + result := SchedulersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Scheduler); err != nil { + return SchedulersClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List Schedulers by resource group +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - SchedulersClientListByResourceGroupOptions contains the optional parameters for the SchedulersClient.NewListByResourceGroupPager +// method. +func (client *SchedulersClient) NewListByResourceGroupPager(resourceGroupName string, options *SchedulersClientListByResourceGroupOptions) *runtime.Pager[SchedulersClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[SchedulersClientListByResourceGroupResponse]{ + More: func(page SchedulersClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SchedulersClientListByResourceGroupResponse) (SchedulersClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SchedulersClient.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 SchedulersClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *SchedulersClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *SchedulersClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers" + 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", "2024-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 *SchedulersClient) listByResourceGroupHandleResponse(resp *http.Response) (SchedulersClientListByResourceGroupResponse, error) { + result := SchedulersClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SchedulerListResult); err != nil { + return SchedulersClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List Schedulers by subscription +// +// Generated from API version 2024-10-01-preview +// - options - SchedulersClientListBySubscriptionOptions contains the optional parameters for the SchedulersClient.NewListBySubscriptionPager +// method. +func (client *SchedulersClient) NewListBySubscriptionPager(options *SchedulersClientListBySubscriptionOptions) *runtime.Pager[SchedulersClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[SchedulersClientListBySubscriptionResponse]{ + More: func(page SchedulersClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SchedulersClientListBySubscriptionResponse) (SchedulersClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SchedulersClient.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 SchedulersClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *SchedulersClient) listBySubscriptionCreateRequest(ctx context.Context, _ *SchedulersClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DurableTask/schedulers" + 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", "2024-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 *SchedulersClient) listBySubscriptionHandleResponse(resp *http.Response) (SchedulersClientListBySubscriptionResponse, error) { + result := SchedulersClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SchedulerListResult); err != nil { + return SchedulersClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// BeginUpdate - Update a Scheduler +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - schedulerName - The name of the Scheduler +// - properties - The resource properties to be updated. +// - options - SchedulersClientBeginUpdateOptions contains the optional parameters for the SchedulersClient.BeginUpdate method. +func (client *SchedulersClient) BeginUpdate(ctx context.Context, resourceGroupName string, schedulerName string, properties Scheduler, options *SchedulersClientBeginUpdateOptions) (*runtime.Poller[SchedulersClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, schedulerName, properties, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SchedulersClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SchedulersClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Update a Scheduler +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +func (client *SchedulersClient) update(ctx context.Context, resourceGroupName string, schedulerName string, properties Scheduler, options *SchedulersClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "SchedulersClient.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, schedulerName, 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 *SchedulersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, schedulerName string, properties Scheduler, _ *SchedulersClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}" + 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 schedulerName == "" { + return nil, errors.New("parameter schedulerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{schedulerName}", url.PathEscape(schedulerName)) + 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", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/durabletask/armdurabletask/schedulers_client_example_test.go b/sdk/resourcemanager/durabletask/armdurabletask/schedulers_client_example_test.go new file mode 100644 index 000000000000..72474d070a4b --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/schedulers_client_example_test.go @@ -0,0 +1,347 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armdurabletask_test + +import ( + "context" + "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/durabletask/armdurabletask" + "log" +) + +// Generated from example definition: 2024-10-01-preview/Schedulers_CreateOrUpdate.json +func ExampleSchedulersClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdurabletask.NewClientFactory("EE9BD735-67CE-4A90-89C4-439D3F6A4C93", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSchedulersClient().BeginCreateOrUpdate(ctx, "rgopenapi", "testscheduler", armdurabletask.Scheduler{ + Location: to.Ptr("northcentralus"), + Properties: &armdurabletask.SchedulerProperties{ + IPAllowlist: []*string{ + to.Ptr("10.0.0.0/8"), + }, + SKU: &armdurabletask.SchedulerSKU{ + Name: to.Ptr("Dedicated"), + }, + }, + Tags: map[string]*string{ + "key7131": to.Ptr("ryohwcoiccwsnewjigfmijz"), + "key2138": to.Ptr("fjaeecgnvqd"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %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 = armdurabletask.SchedulersClientCreateOrUpdateResponse{ + // Scheduler: &armdurabletask.Scheduler{ + // Location: to.Ptr("northcentralus"), + // Properties: &armdurabletask.SchedulerProperties{ + // ProvisioningState: to.Ptr(armdurabletask.ProvisioningStateSucceeded), + // Endpoint: to.Ptr("https://test.northcentralus.1.durabletask.io"), + // IPAllowlist: []*string{ + // to.Ptr("10.0.0.0/8"), + // }, + // SKU: &armdurabletask.SchedulerSKU{ + // Name: to.Ptr("Dedicated"), + // Capacity: to.Ptr[int32](3), + // RedundancyState: to.Ptr(armdurabletask.RedundancyStateZone), + // }, + // }, + // Tags: map[string]*string{ + // "key7131": to.Ptr("ryohwcoiccwsnewjigfmijz"), + // "key2138": to.Ptr("fjaeecgnvqd"), + // }, + // ID: to.Ptr("/subscriptions/EE9BD735-67CE-4A90-89C4-439D3F6A4C93/resourceGroups/rgopenapi/providers/Microsoft.DurableTask/schedulers/testscheduler"), + // Name: to.Ptr("fwxpolhofploqzwdooyg"), + // Type: to.Ptr("vwqdbpynxwfhiopdypuabwvfohnr"), + // SystemData: &armdurabletask.SystemData{ + // CreatedBy: to.Ptr("tenmbevaunjzikxowqexrsx"), + // CreatedByType: to.Ptr(armdurabletask.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-17T15:34:17.365Z"); return t}()), + // LastModifiedBy: to.Ptr("xfvdcegtj"), + // LastModifiedByType: to.Ptr(armdurabletask.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-17T15:34:17.366Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2024-10-01-preview/Schedulers_Delete.json +func ExampleSchedulersClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdurabletask.NewClientFactory("EE9BD735-67CE-4A90-89C4-439D3F6A4C93", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSchedulersClient().BeginDelete(ctx, "rgopenapi", "testscheduler", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: 2024-10-01-preview/Schedulers_Get.json +func ExampleSchedulersClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdurabletask.NewClientFactory("EE9BD735-67CE-4A90-89C4-439D3F6A4C93", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSchedulersClient().Get(ctx, "rgopenapi", "testscheduler", 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 = armdurabletask.SchedulersClientGetResponse{ + // Scheduler: &armdurabletask.Scheduler{ + // Location: to.Ptr("northcentralus"), + // Properties: &armdurabletask.SchedulerProperties{ + // ProvisioningState: to.Ptr(armdurabletask.ProvisioningStateSucceeded), + // Endpoint: to.Ptr("https://test.northcentralus.1.durabletask.io"), + // IPAllowlist: []*string{ + // to.Ptr("10.0.0.0/8"), + // }, + // SKU: &armdurabletask.SchedulerSKU{ + // Name: to.Ptr("Dedicated"), + // Capacity: to.Ptr[int32](3), + // RedundancyState: to.Ptr(armdurabletask.RedundancyStateZone), + // }, + // }, + // Tags: map[string]*string{ + // "key7131": to.Ptr("ryohwcoiccwsnewjigfmijz"), + // "key2138": to.Ptr("fjaeecgnvqd"), + // }, + // ID: to.Ptr("/subscriptions/EE9BD735-67CE-4A90-89C4-439D3F6A4C93/resourceGroups/rgopenapi/providers/Microsoft.DurableTask/schedulers/testscheduler"), + // Name: to.Ptr("testscheduler"), + // Type: to.Ptr("vwqdbpynxwfhiopdypuabwvfohnr"), + // SystemData: &armdurabletask.SystemData{ + // CreatedBy: to.Ptr("tenmbevaunjzikxowqexrsx"), + // CreatedByType: to.Ptr(armdurabletask.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-17T15:34:17.365Z"); return t}()), + // LastModifiedBy: to.Ptr("xfvdcegtj"), + // LastModifiedByType: to.Ptr(armdurabletask.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-17T15:34:17.366Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2024-10-01-preview/Schedulers_ListByResourceGroup.json +func ExampleSchedulersClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdurabletask.NewClientFactory("EE9BD735-67CE-4A90-89C4-439D3F6A4C93", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewSchedulersClient().NewListByResourceGroupPager("rgopenapi", 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 = armdurabletask.SchedulersClientListByResourceGroupResponse{ + // SchedulerListResult: armdurabletask.SchedulerListResult{ + // Value: []*armdurabletask.Scheduler{ + // { + // ID: to.Ptr("/subscriptions/EE9BD735-67CE-4A90-89C4-439D3F6A4C93/resourceGroups/rgopenapi/providers/Microsoft.DurableTask/schedulers/testscheduler"), + // Location: to.Ptr("northcentralus"), + // Properties: &armdurabletask.SchedulerProperties{ + // ProvisioningState: to.Ptr(armdurabletask.ProvisioningStateSucceeded), + // Endpoint: to.Ptr("https://test.northcentralus.1.durabletask.io"), + // IPAllowlist: []*string{ + // to.Ptr("10.0.0.0/8"), + // }, + // SKU: &armdurabletask.SchedulerSKU{ + // Name: to.Ptr("Dedicated"), + // Capacity: to.Ptr[int32](3), + // RedundancyState: to.Ptr(armdurabletask.RedundancyStateZone), + // }, + // }, + // Tags: map[string]*string{ + // "key2138": to.Ptr("fjaeecgnvqd"), + // }, + // Name: to.Ptr("testscheduler"), + // Type: to.Ptr("tglszobjxdhauglzxuqozeg"), + // SystemData: &armdurabletask.SystemData{ + // CreatedBy: to.Ptr("tenmbevaunjzikxowqexrsx"), + // CreatedByType: to.Ptr(armdurabletask.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-17T15:34:17.365Z"); return t}()), + // LastModifiedBy: to.Ptr("xfvdcegtj"), + // LastModifiedByType: to.Ptr(armdurabletask.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-17T15:34:17.366Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2024-10-01-preview/Schedulers_ListBySubscription.json +func ExampleSchedulersClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdurabletask.NewClientFactory("EE9BD735-67CE-4A90-89C4-439D3F6A4C93", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewSchedulersClient().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 = armdurabletask.SchedulersClientListBySubscriptionResponse{ + // SchedulerListResult: armdurabletask.SchedulerListResult{ + // Value: []*armdurabletask.Scheduler{ + // { + // ID: to.Ptr("/subscriptions/EE9BD735-67CE-4A90-89C4-439D3F6A4C93/resourceGroups/rgopenapi/providers/Microsoft.DurableTask/schedulers/testscheduler"), + // Location: to.Ptr("northcentralus"), + // Properties: &armdurabletask.SchedulerProperties{ + // ProvisioningState: to.Ptr(armdurabletask.ProvisioningStateSucceeded), + // Endpoint: to.Ptr("https://test.northcentralus.1.durabletask.io"), + // IPAllowlist: []*string{ + // to.Ptr("10.0.0.0/8"), + // }, + // SKU: &armdurabletask.SchedulerSKU{ + // Name: to.Ptr("Dedicated"), + // Capacity: to.Ptr[int32](3), + // RedundancyState: to.Ptr(armdurabletask.RedundancyStateZone), + // }, + // }, + // Tags: map[string]*string{ + // "key2138": to.Ptr("fjaeecgnvqd"), + // }, + // Name: to.Ptr("testscheduler"), + // Type: to.Ptr("tglszobjxdhauglzxuqozeg"), + // SystemData: &armdurabletask.SystemData{ + // CreatedBy: to.Ptr("tenmbevaunjzikxowqexrsx"), + // CreatedByType: to.Ptr(armdurabletask.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-17T15:34:17.365Z"); return t}()), + // LastModifiedBy: to.Ptr("xfvdcegtj"), + // LastModifiedByType: to.Ptr(armdurabletask.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-17T15:34:17.366Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2024-10-01-preview/Schedulers_Update.json +func ExampleSchedulersClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdurabletask.NewClientFactory("EE9BD735-67CE-4A90-89C4-439D3F6A4C93", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSchedulersClient().BeginUpdate(ctx, "rgopenapi", "testscheduler", armdurabletask.Scheduler{ + Tags: map[string]*string{ + "key8653": to.Ptr("lr"), + }, + Properties: &armdurabletask.SchedulerProperties{ + IPAllowlist: []*string{ + to.Ptr("10.0.0.0/8"), + }, + SKU: &armdurabletask.SchedulerSKU{ + Name: to.Ptr("Dedicated"), + Capacity: to.Ptr[int32](10), + }, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %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 = armdurabletask.SchedulersClientUpdateResponse{ + // Scheduler: &armdurabletask.Scheduler{ + // Location: to.Ptr("northcentralus"), + // Properties: &armdurabletask.SchedulerProperties{ + // ProvisioningState: to.Ptr(armdurabletask.ProvisioningStateSucceeded), + // Endpoint: to.Ptr("https://test.northcentralus.1.durabletask.io"), + // IPAllowlist: []*string{ + // to.Ptr("10.0.0.0/8"), + // }, + // SKU: &armdurabletask.SchedulerSKU{ + // Name: to.Ptr("Dedicated"), + // Capacity: to.Ptr[int32](3), + // RedundancyState: to.Ptr(armdurabletask.RedundancyStateZone), + // }, + // }, + // Tags: map[string]*string{ + // "key7131": to.Ptr("ryohwcoiccwsnewjigfmijz"), + // "key2138": to.Ptr("fjaeecgnvqd"), + // }, + // ID: to.Ptr("/subscriptions/EE9BD735-67CE-4A90-89C4-439D3F6A4C93/resourceGroups/rgopenapi/providers/Microsoft.DurableTask/schedulers/testscheduler"), + // Name: to.Ptr("testscheduler"), + // Type: to.Ptr("vwqdbpynxwfhiopdypuabwvfohnr"), + // SystemData: &armdurabletask.SystemData{ + // CreatedBy: to.Ptr("tenmbevaunjzikxowqexrsx"), + // CreatedByType: to.Ptr(armdurabletask.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-17T15:34:17.365Z"); return t}()), + // LastModifiedBy: to.Ptr("xfvdcegtj"), + // LastModifiedByType: to.Ptr(armdurabletask.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-17T15:34:17.366Z"); return t}()), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/durabletask/armdurabletask/taskhubs_client.go b/sdk/resourcemanager/durabletask/armdurabletask/taskhubs_client.go new file mode 100644 index 000000000000..f03e53eb2ca6 --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/taskhubs_client.go @@ -0,0 +1,340 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armdurabletask + +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" +) + +// TaskHubsClient contains the methods for the TaskHubs group. +// Don't use this type directly, use NewTaskHubsClient() instead. +type TaskHubsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewTaskHubsClient creates a new instance of TaskHubsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewTaskHubsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TaskHubsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &TaskHubsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create or Update a Task Hub +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - schedulerName - The name of the Scheduler +// - taskHubName - The name of the TaskHub +// - resource - Resource create parameters. +// - options - TaskHubsClientBeginCreateOrUpdateOptions contains the optional parameters for the TaskHubsClient.BeginCreateOrUpdate +// method. +func (client *TaskHubsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, schedulerName string, taskHubName string, resource TaskHub, options *TaskHubsClientBeginCreateOrUpdateOptions) (*runtime.Poller[TaskHubsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, schedulerName, taskHubName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[TaskHubsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[TaskHubsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create or Update a Task Hub +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +func (client *TaskHubsClient) createOrUpdate(ctx context.Context, resourceGroupName string, schedulerName string, taskHubName string, resource TaskHub, options *TaskHubsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "TaskHubsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, schedulerName, taskHubName, resource, 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 +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *TaskHubsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, schedulerName string, taskHubName string, resource TaskHub, _ *TaskHubsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName}" + 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 schedulerName == "" { + return nil, errors.New("parameter schedulerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{schedulerName}", url.PathEscape(schedulerName)) + if taskHubName == "" { + return nil, errors.New("parameter taskHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{taskHubName}", url.PathEscape(taskHubName)) + 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", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Delete a Task Hub +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - schedulerName - The name of the Scheduler +// - taskHubName - The name of the TaskHub +// - options - TaskHubsClientBeginDeleteOptions contains the optional parameters for the TaskHubsClient.BeginDelete method. +func (client *TaskHubsClient) BeginDelete(ctx context.Context, resourceGroupName string, schedulerName string, taskHubName string, options *TaskHubsClientBeginDeleteOptions) (*runtime.Poller[TaskHubsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, schedulerName, taskHubName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[TaskHubsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[TaskHubsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a Task Hub +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +func (client *TaskHubsClient) deleteOperation(ctx context.Context, resourceGroupName string, schedulerName string, taskHubName string, options *TaskHubsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "TaskHubsClient.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, schedulerName, taskHubName, 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.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *TaskHubsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, schedulerName string, taskHubName string, _ *TaskHubsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName}" + 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 schedulerName == "" { + return nil, errors.New("parameter schedulerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{schedulerName}", url.PathEscape(schedulerName)) + if taskHubName == "" { + return nil, errors.New("parameter taskHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{taskHubName}", url.PathEscape(taskHubName)) + 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", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a Task Hub +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - schedulerName - The name of the Scheduler +// - taskHubName - The name of the TaskHub +// - options - TaskHubsClientGetOptions contains the optional parameters for the TaskHubsClient.Get method. +func (client *TaskHubsClient) Get(ctx context.Context, resourceGroupName string, schedulerName string, taskHubName string, options *TaskHubsClientGetOptions) (TaskHubsClientGetResponse, error) { + var err error + const operationName = "TaskHubsClient.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, schedulerName, taskHubName, options) + if err != nil { + return TaskHubsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TaskHubsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TaskHubsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *TaskHubsClient) getCreateRequest(ctx context.Context, resourceGroupName string, schedulerName string, taskHubName string, _ *TaskHubsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName}" + 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 schedulerName == "" { + return nil, errors.New("parameter schedulerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{schedulerName}", url.PathEscape(schedulerName)) + if taskHubName == "" { + return nil, errors.New("parameter taskHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{taskHubName}", url.PathEscape(taskHubName)) + 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", "2024-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 *TaskHubsClient) getHandleResponse(resp *http.Response) (TaskHubsClientGetResponse, error) { + result := TaskHubsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TaskHub); err != nil { + return TaskHubsClientGetResponse{}, err + } + return result, nil +} + +// NewListBySchedulerPager - List Task Hubs +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - schedulerName - The name of the Scheduler +// - options - TaskHubsClientListBySchedulerOptions contains the optional parameters for the TaskHubsClient.NewListBySchedulerPager +// method. +func (client *TaskHubsClient) NewListBySchedulerPager(resourceGroupName string, schedulerName string, options *TaskHubsClientListBySchedulerOptions) *runtime.Pager[TaskHubsClientListBySchedulerResponse] { + return runtime.NewPager(runtime.PagingHandler[TaskHubsClientListBySchedulerResponse]{ + More: func(page TaskHubsClientListBySchedulerResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *TaskHubsClientListBySchedulerResponse) (TaskHubsClientListBySchedulerResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "TaskHubsClient.NewListBySchedulerPager") + 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.listBySchedulerCreateRequest(ctx, resourceGroupName, schedulerName, options) + }, nil) + if err != nil { + return TaskHubsClientListBySchedulerResponse{}, err + } + return client.listBySchedulerHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySchedulerCreateRequest creates the ListByScheduler request. +func (client *TaskHubsClient) listBySchedulerCreateRequest(ctx context.Context, resourceGroupName string, schedulerName string, _ *TaskHubsClientListBySchedulerOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs" + 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 schedulerName == "" { + return nil, errors.New("parameter schedulerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{schedulerName}", url.PathEscape(schedulerName)) + 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", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySchedulerHandleResponse handles the ListByScheduler response. +func (client *TaskHubsClient) listBySchedulerHandleResponse(resp *http.Response) (TaskHubsClientListBySchedulerResponse, error) { + result := TaskHubsClientListBySchedulerResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TaskHubListResult); err != nil { + return TaskHubsClientListBySchedulerResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/durabletask/armdurabletask/taskhubs_client_example_test.go b/sdk/resourcemanager/durabletask/armdurabletask/taskhubs_client_example_test.go new file mode 100644 index 000000000000..08af105cf7ba --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/taskhubs_client_example_test.go @@ -0,0 +1,166 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armdurabletask_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/durabletask/armdurabletask" + "log" +) + +// Generated from example definition: 2024-10-01-preview/TaskHubs_CreateOrUpdate.json +func ExampleTaskHubsClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdurabletask.NewClientFactory("EE9BD735-67CE-4A90-89C4-439D3F6A4C93", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewTaskHubsClient().BeginCreateOrUpdate(ctx, "rgopenapi", "testscheduler", "testtaskhub", armdurabletask.TaskHub{ + Properties: &armdurabletask.TaskHubProperties{}, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %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 = armdurabletask.TaskHubsClientCreateOrUpdateResponse{ + // TaskHub: &armdurabletask.TaskHub{ + // Properties: &armdurabletask.TaskHubProperties{ + // ProvisioningState: to.Ptr(armdurabletask.ProvisioningStateSucceeded), + // DashboardURL: to.Ptr("https://test-db.northcentralus.1.durabletask.io/taskhubs/testtaskhub"), + // }, + // ID: to.Ptr("/subscriptions/EE9BD735-67CE-4A90-89C4-439D3F6A4C93/resourceGroups/rgopenapi/providers/Microsoft.DurableTask/schedulers/testscheduler/taskHubs/testtaskhub"), + // Name: to.Ptr("testtaskhub"), + // Type: to.Ptr("afoounwhp"), + // SystemData: &armdurabletask.SystemData{ + // CreatedBy: to.Ptr("tenmbevaunjzikxowqexrsx"), + // CreatedByType: to.Ptr(armdurabletask.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-17T15:34:17.365Z"); return t}()), + // LastModifiedBy: to.Ptr("xfvdcegtj"), + // LastModifiedByType: to.Ptr(armdurabletask.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-17T15:34:17.366Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2024-10-01-preview/TaskHubs_Delete.json +func ExampleTaskHubsClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdurabletask.NewClientFactory("EE9BD735-67CE-4A90-89C4-439D3F6A4C93", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewTaskHubsClient().BeginDelete(ctx, "rgopenapi", "testscheduler", "testtuskhub", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: 2024-10-01-preview/TaskHubs_Get.json +func ExampleTaskHubsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdurabletask.NewClientFactory("EE9BD735-67CE-4A90-89C4-439D3F6A4C93", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewTaskHubsClient().Get(ctx, "rgopenapi", "testscheduler", "testtuskhub", 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 = armdurabletask.TaskHubsClientGetResponse{ + // TaskHub: &armdurabletask.TaskHub{ + // Properties: &armdurabletask.TaskHubProperties{ + // ProvisioningState: to.Ptr(armdurabletask.ProvisioningStateSucceeded), + // DashboardURL: to.Ptr("https://test-db.northcentralus.1.durabletask.io/taskhubs/testtaskhub"), + // }, + // ID: to.Ptr("/subscriptions/EE9BD735-67CE-4A90-89C4-439D3F6A4C93/resourceGroups/rgopenapi/providers/Microsoft.DurableTask/schedulers/testscheduler/taskHubs/testtaskhub"), + // Name: to.Ptr("testtaskhub"), + // Type: to.Ptr("afoounwhp"), + // SystemData: &armdurabletask.SystemData{ + // CreatedBy: to.Ptr("tenmbevaunjzikxowqexrsx"), + // CreatedByType: to.Ptr(armdurabletask.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-17T15:34:17.365Z"); return t}()), + // LastModifiedBy: to.Ptr("xfvdcegtj"), + // LastModifiedByType: to.Ptr(armdurabletask.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-17T15:34:17.366Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2024-10-01-preview/TaskHubs_ListByScheduler.json +func ExampleTaskHubsClient_NewListBySchedulerPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdurabletask.NewClientFactory("EE9BD735-67CE-4A90-89C4-439D3F6A4C93", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewTaskHubsClient().NewListBySchedulerPager("rgopenapi", "testtaskhub", 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 = armdurabletask.TaskHubsClientListBySchedulerResponse{ + // TaskHubListResult: armdurabletask.TaskHubListResult{ + // Value: []*armdurabletask.TaskHub{ + // { + // ID: to.Ptr("/subscriptions/EE9BD735-67CE-4A90-89C4-439D3F6A4C93/resourceGroups/rgopenapi/providers/Microsoft.DurableTask/schedulers/testscheduler/taskHubs/testtaskhub"), + // Properties: &armdurabletask.TaskHubProperties{ + // ProvisioningState: to.Ptr(armdurabletask.ProvisioningStateSucceeded), + // DashboardURL: to.Ptr("https://test-db.northcentralus.1.durabletask.io/taskhubs/testtaskhub"), + // }, + // Name: to.Ptr("testtaskhub"), + // Type: to.Ptr("enkfjxsqktqyeiibofppkxruyb"), + // SystemData: &armdurabletask.SystemData{ + // CreatedBy: to.Ptr("tenmbevaunjzikxowqexrsx"), + // CreatedByType: to.Ptr(armdurabletask.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-17T15:34:17.365Z"); return t}()), + // LastModifiedBy: to.Ptr("xfvdcegtj"), + // LastModifiedByType: to.Ptr(armdurabletask.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-17T15:34:17.366Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} diff --git a/sdk/resourcemanager/durabletask/armdurabletask/time_rfc3339.go b/sdk/resourcemanager/durabletask/armdurabletask/time_rfc3339.go new file mode 100644 index 000000000000..3324a2c277ad --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/time_rfc3339.go @@ -0,0 +1,109 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armdurabletask + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) + +const ( + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` +) + +type dateTimeRFC3339 time.Time + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + return err +} + +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + +func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { + return nil + } + var aux dateTimeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/durabletask/armdurabletask/tsp-location.yaml b/sdk/resourcemanager/durabletask/armdurabletask/tsp-location.yaml new file mode 100644 index 000000000000..695900b01220 --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/durabletask/DurableTask.Management +commit: df55cd8178ddd870dbd0c3b1e25c80e3ff48826c +repo: Azure/azure-rest-api-specs +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/edgezones/armedgezones/CHANGELOG.md b/sdk/resourcemanager/edgezones/armedgezones/CHANGELOG.md index ca1869b2b5e7..bf63595f8ee0 100644 --- a/sdk/resourcemanager/edgezones/armedgezones/CHANGELOG.md +++ b/sdk/resourcemanager/edgezones/armedgezones/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 0.1.1 (2024-11-19) +### Other Changes + + ## 0.1.0 (2024-07-08) ### Other Changes diff --git a/sdk/resourcemanager/edgezones/armedgezones/constants.go b/sdk/resourcemanager/edgezones/armedgezones/constants.go index 63895bc68229..252cf1ee0675 100644 --- a/sdk/resourcemanager/edgezones/armedgezones/constants.go +++ b/sdk/resourcemanager/edgezones/armedgezones/constants.go @@ -6,7 +6,7 @@ package armedgezones const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/edgezones/armedgezones" - moduleVersion = "v0.1.0" + moduleVersion = "v0.1.1" ) // ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/edgezones/armedgezones/extendedzones_client_example_test.go b/sdk/resourcemanager/edgezones/armedgezones/extendedzones_client_example_test.go new file mode 100644 index 000000000000..fd5ddbe17eca --- /dev/null +++ b/sdk/resourcemanager/edgezones/armedgezones/extendedzones_client_example_test.go @@ -0,0 +1,199 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armedgezones_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/edgezones/armedgezones" + "log" +) + +// Generated from example definition: 2024-04-01-preview/ExtendedZones_Get.json +func ExampleExtendedZonesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armedgezones.NewClientFactory("a1ffc958-d2c7-493e-9f1e-125a0477f536", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewExtendedZonesClient().Get(ctx, "losangeles", 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 = armedgezones.ExtendedZonesClientGetResponse{ + // ExtendedZone: &armedgezones.ExtendedZone{ + // ID: to.Ptr("/subscriptions/a1ffc958-d2c7-493e-9f1e-125a0477f536/providers/Microsoft.EdgeZones/extendedZones/losangeles"), + // Name: to.Ptr("losangeles"), + // Type: to.Ptr("Microsoft.EdgeZones/extendedZones"), + // Properties: &armedgezones.ExtendedZoneProperties{ + // ProvisioningState: to.Ptr(armedgezones.ProvisioningStateSucceeded), + // RegistrationState: to.Ptr(armedgezones.RegistrationStateNotRegistered), + // DisplayName: to.Ptr("Los Angeles"), + // RegionalDisplayName: to.Ptr("(US) Los Angeles"), + // RegionType: to.Ptr("Physical"), + // RegionCategory: to.Ptr("Other"), + // Geography: to.Ptr("usa"), + // GeographyGroup: to.Ptr("US"), + // Longitude: to.Ptr("-118.23537"), + // Latitude: to.Ptr("34.058414"), + // HomeLocation: to.Ptr("westus"), + // }, + // }, + // } +} + +// Generated from example definition: 2024-04-01-preview/ExtendedZones_ListBySubscription.json +func ExampleExtendedZonesClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armedgezones.NewClientFactory("a1ffc958-d2c7-493e-9f1e-125a0477f536", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewExtendedZonesClient().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 = armedgezones.ExtendedZonesClientListBySubscriptionResponse{ + // ExtendedZoneListResult: armedgezones.ExtendedZoneListResult{ + // Value: []*armedgezones.ExtendedZone{ + // { + // ID: to.Ptr("/subscriptions/a1ffc958-d2c7-493e-9f1e-125a0477f536/providers/Microsoft.EdgeZones/extendedZones/redmond"), + // Name: to.Ptr("redmond"), + // Type: to.Ptr("Microsoft.EdgeZones/extendedZones"), + // Properties: &armedgezones.ExtendedZoneProperties{ + // ProvisioningState: to.Ptr(armedgezones.ProvisioningStateSucceeded), + // RegistrationState: to.Ptr(armedgezones.RegistrationStateNotRegistered), + // DisplayName: to.Ptr("Redmond"), + // RegionalDisplayName: to.Ptr("(US) Redmond"), + // RegionType: to.Ptr("Physical"), + // RegionCategory: to.Ptr("Other"), + // Geography: to.Ptr("usa"), + // GeographyGroup: to.Ptr("US"), + // Longitude: to.Ptr("-122.03197"), + // Latitude: to.Ptr("47.69106"), + // HomeLocation: to.Ptr("westus"), + // }, + // }, + // { + // ID: to.Ptr("/subscriptions/a1ffc958-d2c7-493e-9f1e-125a0477f536/providers/Microsoft.EdgeZones/extendedZones/losangeles"), + // Name: to.Ptr("losangeles"), + // Type: to.Ptr("Microsoft.EdgeZones/extendedZones"), + // Properties: &armedgezones.ExtendedZoneProperties{ + // ProvisioningState: to.Ptr(armedgezones.ProvisioningStateSucceeded), + // RegistrationState: to.Ptr(armedgezones.RegistrationStateNotRegistered), + // DisplayName: to.Ptr("Los Angeles"), + // RegionalDisplayName: to.Ptr("(US) Los Angeles"), + // RegionType: to.Ptr("Physical"), + // RegionCategory: to.Ptr("Other"), + // Geography: to.Ptr("usa"), + // GeographyGroup: to.Ptr("US"), + // Longitude: to.Ptr("-118.23537"), + // Latitude: to.Ptr("34.058414"), + // HomeLocation: to.Ptr("westus"), + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2024-04-01-preview/ExtendedZones_Register.json +func ExampleExtendedZonesClient_Register() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armedgezones.NewClientFactory("a1ffc958-d2c7-493e-9f1e-125a0477f536", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewExtendedZonesClient().Register(ctx, "losangeles", 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 = armedgezones.ExtendedZonesClientRegisterResponse{ + // ExtendedZone: &armedgezones.ExtendedZone{ + // ID: to.Ptr("/subscriptions/a1ffc958-d2c7-493e-9f1e-125a0477f536/providers/Microsoft.EdgeZones/extendedZones/losangeles"), + // Name: to.Ptr("losangeles"), + // Type: to.Ptr("Microsoft.EdgeZones/extendedZones"), + // Properties: &armedgezones.ExtendedZoneProperties{ + // ProvisioningState: to.Ptr(armedgezones.ProvisioningStateSucceeded), + // RegistrationState: to.Ptr(armedgezones.RegistrationStatePendingRegister), + // DisplayName: to.Ptr("Los Angeles"), + // RegionalDisplayName: to.Ptr("(US) Los Angeles"), + // RegionType: to.Ptr("Physical"), + // RegionCategory: to.Ptr("Other"), + // Geography: to.Ptr("usa"), + // GeographyGroup: to.Ptr("US"), + // Longitude: to.Ptr("-118.23537"), + // Latitude: to.Ptr("34.058414"), + // HomeLocation: to.Ptr("westus"), + // }, + // }, + // } +} + +// Generated from example definition: 2024-04-01-preview/ExtendedZones_Unregister.json +func ExampleExtendedZonesClient_Unregister() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armedgezones.NewClientFactory("a1ffc958-d2c7-493e-9f1e-125a0477f536", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewExtendedZonesClient().Unregister(ctx, "losangeles", 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 = armedgezones.ExtendedZonesClientUnregisterResponse{ + // ExtendedZone: &armedgezones.ExtendedZone{ + // ID: to.Ptr("/subscriptions/a1ffc958-d2c7-493e-9f1e-125a0477f536/providers/Microsoft.EdgeZones/extendedZones/losangeles"), + // Name: to.Ptr("losangeles"), + // Type: to.Ptr("Microsoft.EdgeZones/extendedZones"), + // Properties: &armedgezones.ExtendedZoneProperties{ + // ProvisioningState: to.Ptr(armedgezones.ProvisioningStateSucceeded), + // RegistrationState: to.Ptr(armedgezones.RegistrationStatePendingUnregister), + // DisplayName: to.Ptr("Los Angeles"), + // RegionalDisplayName: to.Ptr("(US) Los Angeles"), + // RegionType: to.Ptr("Physical"), + // RegionCategory: to.Ptr("Other"), + // Geography: to.Ptr("usa"), + // GeographyGroup: to.Ptr("US"), + // Longitude: to.Ptr("-118.23537"), + // Latitude: to.Ptr("34.058414"), + // HomeLocation: to.Ptr("westus"), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/edgezones/armedgezones/fake/extendedzones_server.go b/sdk/resourcemanager/edgezones/armedgezones/fake/extendedzones_server.go index a7afa6c3916b..d11517be93d7 100644 --- a/sdk/resourcemanager/edgezones/armedgezones/fake/extendedzones_server.go +++ b/sdk/resourcemanager/edgezones/armedgezones/fake/extendedzones_server.go @@ -66,23 +66,42 @@ func (e *ExtendedZonesServerTransport) Do(req *http.Request) (*http.Response, er } func (e *ExtendedZonesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error - - switch method { - case "ExtendedZonesClient.Get": - resp, err = e.dispatchGet(req) - case "ExtendedZonesClient.NewListBySubscriptionPager": - resp, err = e.dispatchNewListBySubscriptionPager(req) - case "ExtendedZonesClient.Register": - resp, err = e.dispatchRegister(req) - case "ExtendedZonesClient.Unregister": - resp, err = e.dispatchUnregister(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - return resp, err + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if extendedZonesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = extendedZonesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ExtendedZonesClient.Get": + res.resp, res.err = e.dispatchGet(req) + case "ExtendedZonesClient.NewListBySubscriptionPager": + res.resp, res.err = e.dispatchNewListBySubscriptionPager(req) + case "ExtendedZonesClient.Register": + res.resp, res.err = e.dispatchRegister(req) + case "ExtendedZonesClient.Unregister": + res.resp, res.err = e.dispatchUnregister(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (e *ExtendedZonesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -204,3 +223,9 @@ func (e *ExtendedZonesServerTransport) dispatchUnregister(req *http.Request) (*h } return resp, nil } + +// set this to conditionally intercept incoming requests to ExtendedZonesServerTransport +var extendedZonesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/edgezones/armedgezones/fake/internal.go b/sdk/resourcemanager/edgezones/armedgezones/fake/internal.go index 56a8f624f5f3..7425b6a669e2 100644 --- a/sdk/resourcemanager/edgezones/armedgezones/fake/internal.go +++ b/sdk/resourcemanager/edgezones/armedgezones/fake/internal.go @@ -10,6 +10,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } diff --git a/sdk/resourcemanager/edgezones/armedgezones/fake/operations_server.go b/sdk/resourcemanager/edgezones/armedgezones/fake/operations_server.go index ce9c5fa14931..63dddb8e075e 100644 --- a/sdk/resourcemanager/edgezones/armedgezones/fake/operations_server.go +++ b/sdk/resourcemanager/edgezones/armedgezones/fake/operations_server.go @@ -51,17 +51,36 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error } func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -90,3 +109,9 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/edgezones/armedgezones/go.mod b/sdk/resourcemanager/edgezones/armedgezones/go.mod index 44e2bc978470..8dccee942ca0 100644 --- a/sdk/resourcemanager/edgezones/armedgezones/go.mod +++ b/sdk/resourcemanager/edgezones/armedgezones/go.mod @@ -3,14 +3,14 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/edgezones/armedgezo go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3 v3.0.0 github.com/stretchr/testify v1.9.0 ) require ( - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect @@ -19,9 +19,9 @@ require ( github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/crypto v0.25.0 // indirect - golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect - golang.org/x/text v0.16.0 // indirect + golang.org/x/crypto v0.27.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/text v0.18.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/resourcemanager/edgezones/armedgezones/go.sum b/sdk/resourcemanager/edgezones/armedgezones/go.sum index 62db0b470914..768880efbd66 100644 --- a/sdk/resourcemanager/edgezones/armedgezones/go.sum +++ b/sdk/resourcemanager/edgezones/armedgezones/go.sum @@ -1,5 +1,5 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 h1:JZg6HRh6W6U4OLl6lk7BZ7BLisIzM9dG1R50zUk9C/M= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0/go.mod h1:YL1xnZ6QejvQHWJrX/AvhFl4WW4rqHVoKspWNVwFk0M= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= @@ -29,15 +29,15 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= -golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= -golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/edgezones/armedgezones/models.go b/sdk/resourcemanager/edgezones/armedgezones/models.go index 8545bdd4066e..90dfe1bb9687 100644 --- a/sdk/resourcemanager/edgezones/armedgezones/models.go +++ b/sdk/resourcemanager/edgezones/armedgezones/models.go @@ -74,7 +74,7 @@ type Operation struct { // Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. ActionType *ActionType - // Localized display information for this particular operation. + // READ-ONLY; Localized display information for this particular operation. Display *OperationDisplay // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure @@ -92,17 +92,19 @@ type Operation struct { // OperationDisplay - Localized display information for and operation. type OperationDisplay struct { - // The short, localized friendly description of the operation; suitable for tool tips and detailed views. + // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. Description *string - // The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", - // "Restart Virtual Machine". + // 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 - // The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". + // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + // Compute". Provider *string - // The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". + // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + // Schedule Collections". Resource *string } diff --git a/sdk/resourcemanager/edgezones/armedgezones/operations_client_example_test.go b/sdk/resourcemanager/edgezones/armedgezones/operations_client_example_test.go new file mode 100644 index 000000000000..bee1cac63758 --- /dev/null +++ b/sdk/resourcemanager/edgezones/armedgezones/operations_client_example_test.go @@ -0,0 +1,51 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armedgezones_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/edgezones/armedgezones" + "log" +) + +// Generated from example definition: 2024-04-01-preview/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 := armedgezones.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 = armedgezones.OperationsClientListResponse{ + // OperationListResult: armedgezones.OperationListResult{ + // Value: []*armedgezones.Operation{ + // { + // Name: to.Ptr("Microsoft.EdgeZones/extendedZones/read"), + // Display: &armedgezones.OperationDisplay{ + // Provider: to.Ptr("Microsoft.EdgeZones"), + // Resource: to.Ptr("extendedZones"), + // Operation: to.Ptr("read"), + // }, + // }, + // }, + // }, + // } + } +} diff --git a/sdk/resourcemanager/edgezones/armedgezones/tsp-location.yaml b/sdk/resourcemanager/edgezones/armedgezones/tsp-location.yaml index 5f0bfa9f57a2..ec0b08772538 100644 --- a/sdk/resourcemanager/edgezones/armedgezones/tsp-location.yaml +++ b/sdk/resourcemanager/edgezones/armedgezones/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/edgezones/EdgeZones.Management -commit: ab064e0047ec560a700d6b501097d99471ad817b -repo: https://github.com/Azure/azure-rest-api-specs -additionalDirectories: +commit: df55cd8178ddd870dbd0c3b1e25c80e3ff48826c +repo: Azure/azure-rest-api-specs +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/fabric/armfabric/CHANGELOG.md b/sdk/resourcemanager/fabric/armfabric/CHANGELOG.md index ca9847d062ac..41bf73a20301 100644 --- a/sdk/resourcemanager/fabric/armfabric/CHANGELOG.md +++ b/sdk/resourcemanager/fabric/armfabric/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 1.0.1 (2024-11-19) +### Other Changes + + ## 1.0.0 (2024-10-22) ### Other Changes diff --git a/sdk/resourcemanager/fabric/armfabric/capacities_client.go b/sdk/resourcemanager/fabric/armfabric/capacities_client.go index 53232ffbf5ad..6cd856168d2b 100644 --- a/sdk/resourcemanager/fabric/armfabric/capacities_client.go +++ b/sdk/resourcemanager/fabric/armfabric/capacities_client.go @@ -43,7 +43,7 @@ func NewCapacitiesClient(subscriptionID string, credential azcore.TokenCredentia // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2023-11-01 -// - location - The location name. +// - location - The name of the Azure region. // - body - The CheckAvailability request // - options - CapacitiesClientCheckNameAvailabilityOptions contains the optional parameters for the CapacitiesClient.CheckNameAvailability // method. diff --git a/sdk/resourcemanager/fabric/armfabric/constants.go b/sdk/resourcemanager/fabric/armfabric/constants.go index c6bf0e2ecc4f..8309196d2560 100644 --- a/sdk/resourcemanager/fabric/armfabric/constants.go +++ b/sdk/resourcemanager/fabric/armfabric/constants.go @@ -6,7 +6,7 @@ package armfabric const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/fabric/armfabric" - moduleVersion = "v1.0.0" + moduleVersion = "v1.0.1" ) // ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/fabric/armfabric/fake/capacities_server.go b/sdk/resourcemanager/fabric/armfabric/fake/capacities_server.go index e9598083e361..ba8e867decd9 100644 --- a/sdk/resourcemanager/fabric/armfabric/fake/capacities_server.go +++ b/sdk/resourcemanager/fabric/armfabric/fake/capacities_server.go @@ -29,7 +29,7 @@ type CapacitiesServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, capacityName string, resource armfabric.Capacity, options *armfabric.CapacitiesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armfabric.CapacitiesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method CapacitiesClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, capacityName string, options *armfabric.CapacitiesClientBeginDeleteOptions) (resp azfake.PollerResponder[armfabric.CapacitiesClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method CapacitiesClient.Get @@ -53,11 +53,11 @@ type CapacitiesServer struct { NewListSKUsForCapacityPager func(resourceGroupName string, capacityName string, options *armfabric.CapacitiesClientListSKUsForCapacityOptions) (resp azfake.PagerResponder[armfabric.CapacitiesClientListSKUsForCapacityResponse]) // BeginResume is the fake for method CapacitiesClient.BeginResume - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginResume func(ctx context.Context, resourceGroupName string, capacityName string, options *armfabric.CapacitiesClientBeginResumeOptions) (resp azfake.PollerResponder[armfabric.CapacitiesClientResumeResponse], errResp azfake.ErrorResponder) // BeginSuspend is the fake for method CapacitiesClient.BeginSuspend - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginSuspend func(ctx context.Context, resourceGroupName string, capacityName string, options *armfabric.CapacitiesClientBeginSuspendOptions) (resp azfake.PollerResponder[armfabric.CapacitiesClientSuspendResponse], errResp azfake.ErrorResponder) // BeginUpdate is the fake for method CapacitiesClient.BeginUpdate @@ -110,37 +110,56 @@ func (c *CapacitiesServerTransport) Do(req *http.Request) (*http.Response, error } func (c *CapacitiesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error - - switch method { - case "CapacitiesClient.CheckNameAvailability": - resp, err = c.dispatchCheckNameAvailability(req) - case "CapacitiesClient.BeginCreateOrUpdate": - resp, err = c.dispatchBeginCreateOrUpdate(req) - case "CapacitiesClient.BeginDelete": - resp, err = c.dispatchBeginDelete(req) - case "CapacitiesClient.Get": - resp, err = c.dispatchGet(req) - case "CapacitiesClient.NewListByResourceGroupPager": - resp, err = c.dispatchNewListByResourceGroupPager(req) - case "CapacitiesClient.NewListBySubscriptionPager": - resp, err = c.dispatchNewListBySubscriptionPager(req) - case "CapacitiesClient.NewListSKUsPager": - resp, err = c.dispatchNewListSKUsPager(req) - case "CapacitiesClient.NewListSKUsForCapacityPager": - resp, err = c.dispatchNewListSKUsForCapacityPager(req) - case "CapacitiesClient.BeginResume": - resp, err = c.dispatchBeginResume(req) - case "CapacitiesClient.BeginSuspend": - resp, err = c.dispatchBeginSuspend(req) - case "CapacitiesClient.BeginUpdate": - resp, err = c.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - return resp, err + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if capacitiesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = capacitiesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "CapacitiesClient.CheckNameAvailability": + res.resp, res.err = c.dispatchCheckNameAvailability(req) + case "CapacitiesClient.BeginCreateOrUpdate": + res.resp, res.err = c.dispatchBeginCreateOrUpdate(req) + case "CapacitiesClient.BeginDelete": + res.resp, res.err = c.dispatchBeginDelete(req) + case "CapacitiesClient.Get": + res.resp, res.err = c.dispatchGet(req) + case "CapacitiesClient.NewListByResourceGroupPager": + res.resp, res.err = c.dispatchNewListByResourceGroupPager(req) + case "CapacitiesClient.NewListBySubscriptionPager": + res.resp, res.err = c.dispatchNewListBySubscriptionPager(req) + case "CapacitiesClient.NewListSKUsPager": + res.resp, res.err = c.dispatchNewListSKUsPager(req) + case "CapacitiesClient.NewListSKUsForCapacityPager": + res.resp, res.err = c.dispatchNewListSKUsForCapacityPager(req) + case "CapacitiesClient.BeginResume": + res.resp, res.err = c.dispatchBeginResume(req) + case "CapacitiesClient.BeginSuspend": + res.resp, res.err = c.dispatchBeginSuspend(req) + case "CapacitiesClient.BeginUpdate": + res.resp, res.err = c.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (c *CapacitiesServerTransport) dispatchCheckNameAvailability(req *http.Request) (*http.Response, error) { @@ -257,9 +276,9 @@ func (c *CapacitiesServerTransport) dispatchBeginDelete(req *http.Request) (*htt return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { c.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { c.beginDelete.remove(req) @@ -478,9 +497,9 @@ func (c *CapacitiesServerTransport) dispatchBeginResume(req *http.Request) (*htt return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { c.beginResume.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginResume) { c.beginResume.remove(req) @@ -522,9 +541,9 @@ func (c *CapacitiesServerTransport) dispatchBeginSuspend(req *http.Request) (*ht return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { c.beginSuspend.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginSuspend) { c.beginSuspend.remove(req) @@ -580,3 +599,9 @@ func (c *CapacitiesServerTransport) dispatchBeginUpdate(req *http.Request) (*htt return resp, nil } + +// set this to conditionally intercept incoming requests to CapacitiesServerTransport +var capacitiesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/fabric/armfabric/fake/internal.go b/sdk/resourcemanager/fabric/armfabric/fake/internal.go index 56a8f624f5f3..7425b6a669e2 100644 --- a/sdk/resourcemanager/fabric/armfabric/fake/internal.go +++ b/sdk/resourcemanager/fabric/armfabric/fake/internal.go @@ -10,6 +10,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } diff --git a/sdk/resourcemanager/fabric/armfabric/fake/operations_server.go b/sdk/resourcemanager/fabric/armfabric/fake/operations_server.go index aef0b331c388..b37b6f368961 100644 --- a/sdk/resourcemanager/fabric/armfabric/fake/operations_server.go +++ b/sdk/resourcemanager/fabric/armfabric/fake/operations_server.go @@ -51,17 +51,36 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error } func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -90,3 +109,9 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/fabric/armfabric/go.mod b/sdk/resourcemanager/fabric/armfabric/go.mod index 1e24f5ceafeb..509f96a997b1 100644 --- a/sdk/resourcemanager/fabric/armfabric/go.mod +++ b/sdk/resourcemanager/fabric/armfabric/go.mod @@ -3,7 +3,7 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/fabric/armfabric go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 ) @@ -14,8 +14,8 @@ require ( github.com/google/uuid v1.6.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.25.0 // indirect - golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect - golang.org/x/text v0.16.0 // indirect + golang.org/x/crypto v0.27.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/text v0.18.0 // indirect ) diff --git a/sdk/resourcemanager/fabric/armfabric/go.sum b/sdk/resourcemanager/fabric/armfabric/go.sum index 09d275cb9a37..cbddbbd9ecec 100644 --- a/sdk/resourcemanager/fabric/armfabric/go.sum +++ b/sdk/resourcemanager/fabric/armfabric/go.sum @@ -1,5 +1,5 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 h1:JZg6HRh6W6U4OLl6lk7BZ7BLisIzM9dG1R50zUk9C/M= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0/go.mod h1:YL1xnZ6QejvQHWJrX/AvhFl4WW4rqHVoKspWNVwFk0M= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= @@ -17,13 +17,13 @@ github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmd github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= -golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= -golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/fabric/armfabric/tsp-location.yaml b/sdk/resourcemanager/fabric/armfabric/tsp-location.yaml index 9c366cac6466..ff57b3c2a47d 100644 --- a/sdk/resourcemanager/fabric/armfabric/tsp-location.yaml +++ b/sdk/resourcemanager/fabric/armfabric/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/fabric/Microsoft.Fabric.Management -commit: 366aaa13cdd218b9adac716680e49473673410c8 +commit: df55cd8178ddd870dbd0c3b1e25c80e3ff48826c repo: Azure/azure-rest-api-specs -additionalDirectories: +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/CHANGELOG.md b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/CHANGELOG.md index 0d08fb441c13..0baaf82fe2af 100644 --- a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/CHANGELOG.md +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 1.0.0 (2024-11-19) +### Breaking Changes + +- `ManagedServiceIdentityTypeSystemAndUserAssigned` from enum `ManagedServiceIdentityType` has been removed + +### Features Added + +- New value `ManagedServiceIdentityTypeSystemAssignedUserAssigned` added to enum type `ManagedServiceIdentityType` + + ## 0.1.0 (2024-08-15) ### Other Changes diff --git a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/constants.go b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/constants.go index 770fa68ff00f..d400bac39794 100644 --- a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/constants.go +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/constants.go @@ -6,7 +6,7 @@ package armhealthdataaiservices const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices" - moduleVersion = "v0.1.0" + moduleVersion = "v1.0.0" ) // ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. @@ -54,10 +54,10 @@ type ManagedServiceIdentityType string const ( // ManagedServiceIdentityTypeNone - No managed identity. ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" - // ManagedServiceIdentityTypeSystemAndUserAssigned - System and user assigned managed identity. - ManagedServiceIdentityTypeSystemAndUserAssigned ManagedServiceIdentityType = "SystemAssigned,UserAssigned" // ManagedServiceIdentityTypeSystemAssigned - System assigned managed identity. ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned" + // ManagedServiceIdentityTypeSystemAssignedUserAssigned - System and user assigned managed identity. + ManagedServiceIdentityTypeSystemAssignedUserAssigned ManagedServiceIdentityType = "SystemAssigned,UserAssigned" // ManagedServiceIdentityTypeUserAssigned - User assigned managed identity. ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" ) @@ -66,8 +66,8 @@ const ( func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { return []ManagedServiceIdentityType{ ManagedServiceIdentityTypeNone, - ManagedServiceIdentityTypeSystemAndUserAssigned, ManagedServiceIdentityTypeSystemAssigned, + ManagedServiceIdentityTypeSystemAssignedUserAssigned, ManagedServiceIdentityTypeUserAssigned, } } diff --git a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/deidservices_client.go b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/deidservices_client.go index 20b7b8a47a9c..325f2c6567d5 100644 --- a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/deidservices_client.go +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/deidservices_client.go @@ -42,7 +42,7 @@ func NewDeidServicesClient(subscriptionID string, credential azcore.TokenCredent // BeginCreate - Create a DeidService // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-28-preview +// Generated from API version 2024-09-20 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - deidServiceName - The name of the deid service // - resource - Resource create parameters. @@ -68,7 +68,7 @@ func (client *DeidServicesClient) BeginCreate(ctx context.Context, resourceGroup // Create - Create a DeidService // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-28-preview +// Generated from API version 2024-09-20 func (client *DeidServicesClient) create(ctx context.Context, resourceGroupName string, deidServiceName string, resource DeidService, options *DeidServicesClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "DeidServicesClient.BeginCreate" @@ -110,7 +110,7 @@ func (client *DeidServicesClient) createCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-28-preview") + reqQP.Set("api-version", "2024-09-20") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} @@ -123,7 +123,7 @@ func (client *DeidServicesClient) createCreateRequest(ctx context.Context, resou // BeginDelete - Delete a DeidService // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-28-preview +// Generated from API version 2024-09-20 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - deidServiceName - The name of the deid service // - options - DeidServicesClientBeginDeleteOptions contains the optional parameters for the DeidServicesClient.BeginDelete @@ -148,7 +148,7 @@ func (client *DeidServicesClient) BeginDelete(ctx context.Context, resourceGroup // Delete - Delete a DeidService // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-28-preview +// Generated from API version 2024-09-20 func (client *DeidServicesClient) deleteOperation(ctx context.Context, resourceGroupName string, deidServiceName string, options *DeidServicesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "DeidServicesClient.BeginDelete" @@ -190,7 +190,7 @@ func (client *DeidServicesClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-28-preview") + reqQP.Set("api-version", "2024-09-20") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -199,7 +199,7 @@ func (client *DeidServicesClient) deleteCreateRequest(ctx context.Context, resou // Get - Get a DeidService // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-28-preview +// Generated from API version 2024-09-20 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - deidServiceName - The name of the deid service // - options - DeidServicesClientGetOptions contains the optional parameters for the DeidServicesClient.Get method. @@ -245,7 +245,7 @@ func (client *DeidServicesClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-28-preview") + reqQP.Set("api-version", "2024-09-20") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -262,7 +262,7 @@ func (client *DeidServicesClient) getHandleResponse(resp *http.Response) (DeidSe // NewListByResourceGroupPager - List DeidService resources by resource group // -// Generated from API version 2024-02-28-preview +// Generated from API version 2024-09-20 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - DeidServicesClientListByResourceGroupOptions contains the optional parameters for the DeidServicesClient.NewListByResourceGroupPager // method. @@ -305,7 +305,7 @@ func (client *DeidServicesClient) listByResourceGroupCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-28-preview") + reqQP.Set("api-version", "2024-09-20") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -322,7 +322,7 @@ func (client *DeidServicesClient) listByResourceGroupHandleResponse(resp *http.R // NewListBySubscriptionPager - List DeidService resources by subscription ID // -// Generated from API version 2024-02-28-preview +// Generated from API version 2024-09-20 // - options - DeidServicesClientListBySubscriptionOptions contains the optional parameters for the DeidServicesClient.NewListBySubscriptionPager // method. func (client *DeidServicesClient) NewListBySubscriptionPager(options *DeidServicesClientListBySubscriptionOptions) *runtime.Pager[DeidServicesClientListBySubscriptionResponse] { @@ -360,7 +360,7 @@ func (client *DeidServicesClient) listBySubscriptionCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-28-preview") + reqQP.Set("api-version", "2024-09-20") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -378,7 +378,7 @@ func (client *DeidServicesClient) listBySubscriptionHandleResponse(resp *http.Re // BeginUpdate - Update a DeidService // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-28-preview +// Generated from API version 2024-09-20 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - deidServiceName - The name of the deid service // - properties - The resource properties to be updated. @@ -404,7 +404,7 @@ func (client *DeidServicesClient) BeginUpdate(ctx context.Context, resourceGroup // Update - Update a DeidService // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-28-preview +// Generated from API version 2024-09-20 func (client *DeidServicesClient) update(ctx context.Context, resourceGroupName string, deidServiceName string, properties DeidUpdate, options *DeidServicesClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "DeidServicesClient.BeginUpdate" @@ -446,7 +446,7 @@ func (client *DeidServicesClient) updateCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-28-preview") + reqQP.Set("api-version", "2024-09-20") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} diff --git a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/deidservices_client_example_test.go b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/deidservices_client_example_test.go index e8296e31bd38..b8e95f31532d 100644 --- a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/deidservices_client_example_test.go +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/deidservices_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/925b1febaaebc3e1d602c765168e8ddabc7153a5/specification/healthdataaiservices/HealthDataAIServices.Management/examples/2024-02-28-preview/DeidServices_Create_MaximumSet_Gen.json +// Generated from example definition: 2024-09-20/DeidServices_Create_MaximumSet_Gen.json func ExampleDeidServicesClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -105,7 +105,7 @@ func ExampleDeidServicesClient_BeginCreate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/925b1febaaebc3e1d602c765168e8ddabc7153a5/specification/healthdataaiservices/HealthDataAIServices.Management/examples/2024-02-28-preview/DeidServices_Delete_MaximumSet_Gen.json +// Generated from example definition: 2024-09-20/DeidServices_Delete_MaximumSet_Gen.json func ExampleDeidServicesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -126,7 +126,7 @@ func ExampleDeidServicesClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/925b1febaaebc3e1d602c765168e8ddabc7153a5/specification/healthdataaiservices/HealthDataAIServices.Management/examples/2024-02-28-preview/DeidServices_Get_MaximumSet_Gen.json +// Generated from example definition: 2024-09-20/DeidServices_Get_MaximumSet_Gen.json func ExampleDeidServicesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -205,7 +205,7 @@ func ExampleDeidServicesClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/925b1febaaebc3e1d602c765168e8ddabc7153a5/specification/healthdataaiservices/HealthDataAIServices.Management/examples/2024-02-28-preview/DeidServices_ListByResourceGroup_MaximumSet_Gen.json +// Generated from example definition: 2024-09-20/DeidServices_ListByResourceGroup_MaximumSet_Gen.json func ExampleDeidServicesClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -294,7 +294,7 @@ func ExampleDeidServicesClient_NewListByResourceGroupPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/925b1febaaebc3e1d602c765168e8ddabc7153a5/specification/healthdataaiservices/HealthDataAIServices.Management/examples/2024-02-28-preview/DeidServices_ListBySubscription_MaximumSet_Gen.json +// Generated from example definition: 2024-09-20/DeidServices_ListBySubscription_MaximumSet_Gen.json func ExampleDeidServicesClient_NewListBySubscriptionPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -383,7 +383,7 @@ func ExampleDeidServicesClient_NewListBySubscriptionPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/925b1febaaebc3e1d602c765168e8ddabc7153a5/specification/healthdataaiservices/HealthDataAIServices.Management/examples/2024-02-28-preview/DeidServices_Update_MaximumSet_Gen.json +// Generated from example definition: 2024-09-20/DeidServices_Update_MaximumSet_Gen.json func ExampleDeidServicesClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/deidservices_server.go b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/deidservices_server.go index 237656497f61..3da7dc2fe250 100644 --- a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/deidservices_server.go +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/deidservices_server.go @@ -25,7 +25,7 @@ type DeidServicesServer struct { BeginCreate func(ctx context.Context, resourceGroupName string, deidServiceName string, resource armhealthdataaiservices.DeidService, options *armhealthdataaiservices.DeidServicesClientBeginCreateOptions) (resp azfake.PollerResponder[armhealthdataaiservices.DeidServicesClientCreateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method DeidServicesClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, deidServiceName string, options *armhealthdataaiservices.DeidServicesClientBeginDeleteOptions) (resp azfake.PollerResponder[armhealthdataaiservices.DeidServicesClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method DeidServicesClient.Get @@ -82,27 +82,46 @@ func (d *DeidServicesServerTransport) Do(req *http.Request) (*http.Response, err } func (d *DeidServicesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error - - switch method { - case "DeidServicesClient.BeginCreate": - resp, err = d.dispatchBeginCreate(req) - case "DeidServicesClient.BeginDelete": - resp, err = d.dispatchBeginDelete(req) - case "DeidServicesClient.Get": - resp, err = d.dispatchGet(req) - case "DeidServicesClient.NewListByResourceGroupPager": - resp, err = d.dispatchNewListByResourceGroupPager(req) - case "DeidServicesClient.NewListBySubscriptionPager": - resp, err = d.dispatchNewListBySubscriptionPager(req) - case "DeidServicesClient.BeginUpdate": - resp, err = d.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - return resp, err + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if deidServicesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = deidServicesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "DeidServicesClient.BeginCreate": + res.resp, res.err = d.dispatchBeginCreate(req) + case "DeidServicesClient.BeginDelete": + res.resp, res.err = d.dispatchBeginDelete(req) + case "DeidServicesClient.Get": + res.resp, res.err = d.dispatchGet(req) + case "DeidServicesClient.NewListByResourceGroupPager": + res.resp, res.err = d.dispatchNewListByResourceGroupPager(req) + case "DeidServicesClient.NewListBySubscriptionPager": + res.resp, res.err = d.dispatchNewListBySubscriptionPager(req) + case "DeidServicesClient.BeginUpdate": + res.resp, res.err = d.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (d *DeidServicesServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { @@ -186,9 +205,9 @@ func (d *DeidServicesServerTransport) dispatchBeginDelete(req *http.Request) (*h return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { d.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { d.beginDelete.remove(req) @@ -347,3 +366,9 @@ func (d *DeidServicesServerTransport) dispatchBeginUpdate(req *http.Request) (*h return resp, nil } + +// set this to conditionally intercept incoming requests to DeidServicesServerTransport +var deidServicesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/internal.go b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/internal.go index 56a8f624f5f3..7425b6a669e2 100644 --- a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/internal.go +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/internal.go @@ -10,6 +10,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } diff --git a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/operations_server.go b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/operations_server.go index c044234c726a..6535830b88f0 100644 --- a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/operations_server.go +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/operations_server.go @@ -51,17 +51,36 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error } func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -90,3 +109,9 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/privateendpointconnections_server.go b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/privateendpointconnections_server.go index 96f093975ccb..bfca92be1328 100644 --- a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/privateendpointconnections_server.go +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/privateendpointconnections_server.go @@ -25,7 +25,7 @@ type PrivateEndpointConnectionsServer struct { BeginCreate func(ctx context.Context, resourceGroupName string, deidServiceName string, privateEndpointConnectionName string, resource armhealthdataaiservices.PrivateEndpointConnectionResource, options *armhealthdataaiservices.PrivateEndpointConnectionsClientBeginCreateOptions) (resp azfake.PollerResponder[armhealthdataaiservices.PrivateEndpointConnectionsClientCreateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method PrivateEndpointConnectionsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, deidServiceName string, privateEndpointConnectionName string, options *armhealthdataaiservices.PrivateEndpointConnectionsClientBeginDeleteOptions) (resp azfake.PollerResponder[armhealthdataaiservices.PrivateEndpointConnectionsClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method PrivateEndpointConnectionsClient.Get @@ -70,23 +70,42 @@ func (p *PrivateEndpointConnectionsServerTransport) Do(req *http.Request) (*http } func (p *PrivateEndpointConnectionsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "PrivateEndpointConnectionsClient.BeginCreate": - resp, err = p.dispatchBeginCreate(req) - case "PrivateEndpointConnectionsClient.BeginDelete": - resp, err = p.dispatchBeginDelete(req) - case "PrivateEndpointConnectionsClient.Get": - resp, err = p.dispatchGet(req) - case "PrivateEndpointConnectionsClient.NewListByDeidServicePager": - resp, err = p.dispatchNewListByDeidServicePager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if privateEndpointConnectionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = privateEndpointConnectionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PrivateEndpointConnectionsClient.BeginCreate": + res.resp, res.err = p.dispatchBeginCreate(req) + case "PrivateEndpointConnectionsClient.BeginDelete": + res.resp, res.err = p.dispatchBeginDelete(req) + case "PrivateEndpointConnectionsClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "PrivateEndpointConnectionsClient.NewListByDeidServicePager": + res.resp, res.err = p.dispatchNewListByDeidServicePager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { @@ -178,9 +197,9 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginDelete(req *htt return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { p.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { p.beginDelete.remove(req) @@ -266,3 +285,9 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchNewListByDeidService } return resp, nil } + +// set this to conditionally intercept incoming requests to PrivateEndpointConnectionsServerTransport +var privateEndpointConnectionsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/privatelinks_server.go b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/privatelinks_server.go index 52ed836c941d..77aafe7fe043 100644 --- a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/privatelinks_server.go +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/privatelinks_server.go @@ -53,17 +53,36 @@ func (p *PrivateLinksServerTransport) Do(req *http.Request) (*http.Response, err } func (p *PrivateLinksServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "PrivateLinksClient.NewListByDeidServicePager": - resp, err = p.dispatchNewListByDeidServicePager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if privateLinksServerTransportInterceptor != nil { + res.resp, res.err, intercepted = privateLinksServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PrivateLinksClient.NewListByDeidServicePager": + res.resp, res.err = p.dispatchNewListByDeidServicePager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (p *PrivateLinksServerTransport) dispatchNewListByDeidServicePager(req *http.Request) (*http.Response, error) { @@ -106,3 +125,9 @@ func (p *PrivateLinksServerTransport) dispatchNewListByDeidServicePager(req *htt } return resp, nil } + +// set this to conditionally intercept incoming requests to PrivateLinksServerTransport +var privateLinksServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/go.mod b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/go.mod index d08d83a9c34c..c9d235a6e56f 100644 --- a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/go.mod +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/go.mod @@ -3,7 +3,7 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthdataaiservice go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 ) @@ -14,8 +14,8 @@ require ( github.com/google/uuid v1.6.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.25.0 // indirect - golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect - golang.org/x/text v0.16.0 // indirect + golang.org/x/crypto v0.27.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/text v0.18.0 // indirect ) diff --git a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/go.sum b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/go.sum index 09d275cb9a37..cbddbbd9ecec 100644 --- a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/go.sum +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/go.sum @@ -1,5 +1,5 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 h1:JZg6HRh6W6U4OLl6lk7BZ7BLisIzM9dG1R50zUk9C/M= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0/go.mod h1:YL1xnZ6QejvQHWJrX/AvhFl4WW4rqHVoKspWNVwFk0M= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= @@ -17,13 +17,13 @@ github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmd github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= -golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= -golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/operations_client.go b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/operations_client.go index 616849e13459..f5230a4487ec 100644 --- a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/operations_client.go +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/operations_client.go @@ -35,7 +35,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - List the operations for the provider // -// Generated from API version 2024-02-28-preview +// Generated from API version 2024-09-20 // - 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]{ @@ -68,7 +68,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *Operat return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-28-preview") + reqQP.Set("api-version", "2024-09-20") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/operations_client_example_test.go b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/operations_client_example_test.go index 8650da43638d..099d9d4d58da 100644 --- a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/operations_client_example_test.go +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/operations_client_example_test.go @@ -11,8 +11,8 @@ import ( "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/925b1febaaebc3e1d602c765168e8ddabc7153a5/specification/healthdataaiservices/HealthDataAIServices.Management/examples/2024-02-28-preview/Operations_List_MaximumSet_Gen.json -func ExampleOperationsClient_NewListPager_operationsListMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() { +// Generated from example definition: 2024-09-20/Operations_List_MaximumSet_Gen.json +func ExampleOperationsClient_NewListPager_operationsListMaximumSetGeneratedByMaximumSetRuleStable() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) @@ -55,8 +55,8 @@ func ExampleOperationsClient_NewListPager_operationsListMaximumSetGeneratedByMax } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/925b1febaaebc3e1d602c765168e8ddabc7153a5/specification/healthdataaiservices/HealthDataAIServices.Management/examples/2024-02-28-preview/Operations_List_MinimumSet_Gen.json -func ExampleOperationsClient_NewListPager_operationsListMaximumSetGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() { +// Generated from example definition: 2024-09-20/Operations_List_MinimumSet_Gen.json +func ExampleOperationsClient_NewListPager_operationsListMinimumSetGeneratedByMinimumSetRuleStable() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) diff --git a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/privateendpointconnections_client.go b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/privateendpointconnections_client.go index 36608f2fa1ba..5b9658fa71ec 100644 --- a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/privateendpointconnections_client.go +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/privateendpointconnections_client.go @@ -42,7 +42,7 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // BeginCreate - Create a Private endpoint connection // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-28-preview +// Generated from API version 2024-09-20 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - deidServiceName - The name of the deid service // - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource. @@ -69,7 +69,7 @@ func (client *PrivateEndpointConnectionsClient) BeginCreate(ctx context.Context, // Create - Create a Private endpoint connection // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-28-preview +// Generated from API version 2024-09-20 func (client *PrivateEndpointConnectionsClient) create(ctx context.Context, resourceGroupName string, deidServiceName string, privateEndpointConnectionName string, resource PrivateEndpointConnectionResource, options *PrivateEndpointConnectionsClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "PrivateEndpointConnectionsClient.BeginCreate" @@ -115,7 +115,7 @@ func (client *PrivateEndpointConnectionsClient) createCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-28-preview") + reqQP.Set("api-version", "2024-09-20") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} @@ -128,7 +128,7 @@ func (client *PrivateEndpointConnectionsClient) createCreateRequest(ctx context. // BeginDelete - Delete the private endpoint connection // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-28-preview +// Generated from API version 2024-09-20 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - deidServiceName - The name of the deid service // - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource. @@ -154,7 +154,7 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, // Delete - Delete the private endpoint connection // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-28-preview +// Generated from API version 2024-09-20 func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, deidServiceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "PrivateEndpointConnectionsClient.BeginDelete" @@ -200,7 +200,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-28-preview") + reqQP.Set("api-version", "2024-09-20") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -209,7 +209,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // Get - Get a specific private connection // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-28-preview +// Generated from API version 2024-09-20 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - deidServiceName - The name of the deid service // - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource. @@ -261,7 +261,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-28-preview") + reqQP.Set("api-version", "2024-09-20") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -278,7 +278,7 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // NewListByDeidServicePager - List private endpoint connections on the given resource // -// Generated from API version 2024-02-28-preview +// Generated from API version 2024-09-20 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - deidServiceName - The name of the deid service // - options - PrivateEndpointConnectionsClientListByDeidServiceOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByDeidServicePager @@ -326,7 +326,7 @@ func (client *PrivateEndpointConnectionsClient) listByDeidServiceCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-28-preview") + reqQP.Set("api-version", "2024-09-20") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/privateendpointconnections_client_example_test.go index 48c90e804f2e..ff77bbdb017d 100644 --- a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/privateendpointconnections_client_example_test.go +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/privateendpointconnections_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/925b1febaaebc3e1d602c765168e8ddabc7153a5/specification/healthdataaiservices/HealthDataAIServices.Management/examples/2024-02-28-preview/PrivateEndpointConnections_Create_MaximumSet_Gen.json +// Generated from example definition: 2024-09-20/PrivateEndpointConnections_Create_MaximumSet_Gen.json func ExamplePrivateEndpointConnectionsClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -74,7 +74,7 @@ func ExamplePrivateEndpointConnectionsClient_BeginCreate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/925b1febaaebc3e1d602c765168e8ddabc7153a5/specification/healthdataaiservices/HealthDataAIServices.Management/examples/2024-02-28-preview/PrivateEndpointConnections_Delete_MaximumSet_Gen.json +// Generated from example definition: 2024-09-20/PrivateEndpointConnections_Delete_MaximumSet_Gen.json func ExamplePrivateEndpointConnectionsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -95,7 +95,7 @@ func ExamplePrivateEndpointConnectionsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/925b1febaaebc3e1d602c765168e8ddabc7153a5/specification/healthdataaiservices/HealthDataAIServices.Management/examples/2024-02-28-preview/PrivateEndpointConnections_Get_MaximumSet_Gen.json +// Generated from example definition: 2024-09-20/PrivateEndpointConnections_Get_MaximumSet_Gen.json func ExamplePrivateEndpointConnectionsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -144,7 +144,7 @@ func ExamplePrivateEndpointConnectionsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/925b1febaaebc3e1d602c765168e8ddabc7153a5/specification/healthdataaiservices/HealthDataAIServices.Management/examples/2024-02-28-preview/PrivateEndpointConnections_ListByDeidService_MaximumSet_Gen.json +// Generated from example definition: 2024-09-20/PrivateEndpointConnections_ListByDeidService_MaximumSet_Gen.json func ExamplePrivateEndpointConnectionsClient_NewListByDeidServicePager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/privatelinks_client.go b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/privatelinks_client.go index 3dfc5df4be74..028345b69f0e 100644 --- a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/privatelinks_client.go +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/privatelinks_client.go @@ -41,7 +41,7 @@ func NewPrivateLinksClient(subscriptionID string, credential azcore.TokenCredent // NewListByDeidServicePager - List private links on the given resource // -// Generated from API version 2024-02-28-preview +// Generated from API version 2024-09-20 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - deidServiceName - The name of the deid service // - options - PrivateLinksClientListByDeidServiceOptions contains the optional parameters for the PrivateLinksClient.NewListByDeidServicePager @@ -89,7 +89,7 @@ func (client *PrivateLinksClient) listByDeidServiceCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-28-preview") + reqQP.Set("api-version", "2024-09-20") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/privatelinks_client_example_test.go b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/privatelinks_client_example_test.go index e4f80d5ee39f..98cd65a95d17 100644 --- a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/privatelinks_client_example_test.go +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/privatelinks_client_example_test.go @@ -11,7 +11,7 @@ import ( "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/925b1febaaebc3e1d602c765168e8ddabc7153a5/specification/healthdataaiservices/HealthDataAIServices.Management/examples/2024-02-28-preview/PrivateLinks_ListByDeidService_MaximumSet_Gen.json +// Generated from example definition: 2024-09-20/PrivateLinks_ListByDeidService_MaximumSet_Gen.json func ExamplePrivateLinksClient_NewListByDeidServicePager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/tsp-location.yaml b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/tsp-location.yaml index 169f1b53a7a8..6fb812105ce6 100644 --- a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/tsp-location.yaml +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/healthdataaiservices/HealthDataAIServices.Management -commit: 925b1febaaebc3e1d602c765168e8ddabc7153a5 +commit: df55cd8178ddd870dbd0c3b1e25c80e3ff48826c repo: Azure/azure-rest-api-specs additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/CHANGELOG.md b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/CHANGELOG.md index 05715bd58097..80981dc37e54 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/CHANGELOG.md +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/CHANGELOG.md @@ -1,5 +1,116 @@ # Release History +## 2.0.0 (2024-11-19) +### Breaking Changes + +- Function `NewClientFactory` parameter(s) have been changed from `(azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Type of `ErrorAdditionalInfo.Info` has been changed from `any` to `*ErrorAdditionalInfoInfo` +- Enum `ActionType` has been removed +- Enum `Origin` has been removed +- Enum `ProvisioningState` has been removed +- Enum `ServiceName` has been removed +- Enum `Type` has been removed +- Function `*ClientFactory.NewEndpointsClient` has been removed +- Function `*ClientFactory.NewOperationsClient` has been removed +- Function `*ClientFactory.NewServiceConfigurationsClient` has been removed +- Function `NewEndpointsClient` has been removed +- Function `*EndpointsClient.CreateOrUpdate` has been removed +- Function `*EndpointsClient.Delete` has been removed +- Function `*EndpointsClient.Get` has been removed +- Function `*EndpointsClient.ListCredentials` has been removed +- Function `*EndpointsClient.ListIngressGatewayCredentials` has been removed +- Function `*EndpointsClient.ListManagedProxyDetails` has been removed +- Function `*EndpointsClient.NewListPager` has been removed +- Function `*EndpointsClient.Update` has been removed +- Function `NewOperationsClient` has been removed +- Function `*OperationsClient.NewListPager` has been removed +- Function `NewServiceConfigurationsClient` has been removed +- Function `*ServiceConfigurationsClient.CreateOrupdate` has been removed +- Function `*ServiceConfigurationsClient.Delete` has been removed +- Function `*ServiceConfigurationsClient.Get` has been removed +- Function `*ServiceConfigurationsClient.NewListByEndpointResourcePager` has been removed +- Function `*ServiceConfigurationsClient.Update` has been removed +- Struct `AADProfileProperties` has been removed +- Struct `EndpointAccessResource` has been removed +- Struct `EndpointProperties` has been removed +- Struct `EndpointResource` has been removed +- Struct `EndpointsList` has been removed +- Struct `ErrorResponse` has been removed +- Struct `IngressGatewayResource` has been removed +- Struct `IngressProfileProperties` has been removed +- Struct `ListCredentialsRequest` has been removed +- Struct `ListIngressGatewayCredentialsRequest` has been removed +- Struct `ManagedProxyRequest` has been removed +- Struct `ManagedProxyResource` has been removed +- Struct `Operation` has been removed +- Struct `OperationDisplay` has been removed +- Struct `OperationListResult` has been removed +- Struct `ProxyResource` has been removed +- Struct `RelayNamespaceAccessProperties` has been removed +- Struct `Resource` has been removed +- Struct `ServiceConfigurationList` has been removed +- Struct `ServiceConfigurationProperties` has been removed +- Struct `ServiceConfigurationPropertiesPatch` has been removed +- Struct `ServiceConfigurationResource` has been removed +- Struct `ServiceConfigurationResourcePatch` has been removed + +### Features Added + +- New enum type `CloudNativeType` with values `CloudNativeTypeEc2` +- New enum type `HostType` with values `HostTypeAWS` +- New enum type `ResourceProvisioningState` with values `ResourceProvisioningStateCanceled`, `ResourceProvisioningStateFailed`, `ResourceProvisioningStateSucceeded` +- New enum type `SolutionConfigurationStatus` with values `SolutionConfigurationStatusCompleted`, `SolutionConfigurationStatusFailed`, `SolutionConfigurationStatusInProgress`, `SolutionConfigurationStatusNew` +- New function `*ClientFactory.NewGenerateAwsTemplateClient() *GenerateAwsTemplateClient` +- New function `*ClientFactory.NewInventoryClient() *InventoryClient` +- New function `*ClientFactory.NewPublicCloudConnectorsClient() *PublicCloudConnectorsClient` +- New function `*ClientFactory.NewSolutionConfigurationsClient() *SolutionConfigurationsClient` +- New function `*ClientFactory.NewSolutionTypesClient() *SolutionTypesClient` +- New function `NewGenerateAwsTemplateClient(string, azcore.TokenCredential, *arm.ClientOptions) (*GenerateAwsTemplateClient, error)` +- New function `*GenerateAwsTemplateClient.Post(context.Context, GenerateAwsTemplateRequest, *GenerateAwsTemplateClientPostOptions) (GenerateAwsTemplateClientPostResponse, error)` +- New function `NewInventoryClient(azcore.TokenCredential, *arm.ClientOptions) (*InventoryClient, error)` +- New function `*InventoryClient.Get(context.Context, string, string, string, *InventoryClientGetOptions) (InventoryClientGetResponse, error)` +- New function `*InventoryClient.NewListBySolutionConfigurationPager(string, string, *InventoryClientListBySolutionConfigurationOptions) *runtime.Pager[InventoryClientListBySolutionConfigurationResponse]` +- New function `NewPublicCloudConnectorsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*PublicCloudConnectorsClient, error)` +- New function `*PublicCloudConnectorsClient.BeginCreateOrUpdate(context.Context, string, string, PublicCloudConnector, *PublicCloudConnectorsClientBeginCreateOrUpdateOptions) (*runtime.Poller[PublicCloudConnectorsClientCreateOrUpdateResponse], error)` +- New function `*PublicCloudConnectorsClient.Delete(context.Context, string, string, *PublicCloudConnectorsClientDeleteOptions) (PublicCloudConnectorsClientDeleteResponse, error)` +- New function `*PublicCloudConnectorsClient.Get(context.Context, string, string, *PublicCloudConnectorsClientGetOptions) (PublicCloudConnectorsClientGetResponse, error)` +- New function `*PublicCloudConnectorsClient.NewListByResourceGroupPager(string, *PublicCloudConnectorsClientListByResourceGroupOptions) *runtime.Pager[PublicCloudConnectorsClientListByResourceGroupResponse]` +- New function `*PublicCloudConnectorsClient.NewListBySubscriptionPager(*PublicCloudConnectorsClientListBySubscriptionOptions) *runtime.Pager[PublicCloudConnectorsClientListBySubscriptionResponse]` +- New function `*PublicCloudConnectorsClient.BeginTestPermissions(context.Context, string, string, *PublicCloudConnectorsClientBeginTestPermissionsOptions) (*runtime.Poller[PublicCloudConnectorsClientTestPermissionsResponse], error)` +- New function `*PublicCloudConnectorsClient.Update(context.Context, string, string, PublicCloudConnector, *PublicCloudConnectorsClientUpdateOptions) (PublicCloudConnectorsClientUpdateResponse, error)` +- New function `NewSolutionConfigurationsClient(azcore.TokenCredential, *arm.ClientOptions) (*SolutionConfigurationsClient, error)` +- New function `*SolutionConfigurationsClient.CreateOrUpdate(context.Context, string, string, SolutionConfiguration, *SolutionConfigurationsClientCreateOrUpdateOptions) (SolutionConfigurationsClientCreateOrUpdateResponse, error)` +- New function `*SolutionConfigurationsClient.Delete(context.Context, string, string, *SolutionConfigurationsClientDeleteOptions) (SolutionConfigurationsClientDeleteResponse, error)` +- New function `*SolutionConfigurationsClient.Get(context.Context, string, string, *SolutionConfigurationsClientGetOptions) (SolutionConfigurationsClientGetResponse, error)` +- New function `*SolutionConfigurationsClient.NewListPager(string, *SolutionConfigurationsClientListOptions) *runtime.Pager[SolutionConfigurationsClientListResponse]` +- New function `*SolutionConfigurationsClient.BeginSyncNow(context.Context, string, string, *SolutionConfigurationsClientBeginSyncNowOptions) (*runtime.Poller[SolutionConfigurationsClientSyncNowResponse], error)` +- New function `*SolutionConfigurationsClient.Update(context.Context, string, string, SolutionConfiguration, *SolutionConfigurationsClientUpdateOptions) (SolutionConfigurationsClientUpdateResponse, error)` +- New function `NewSolutionTypesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*SolutionTypesClient, error)` +- New function `*SolutionTypesClient.Get(context.Context, string, string, *SolutionTypesClientGetOptions) (SolutionTypesClientGetResponse, error)` +- New function `*SolutionTypesClient.NewListByResourceGroupPager(string, *SolutionTypesClientListByResourceGroupOptions) *runtime.Pager[SolutionTypesClientListByResourceGroupResponse]` +- New function `*SolutionTypesClient.NewListBySubscriptionPager(*SolutionTypesClientListBySubscriptionOptions) *runtime.Pager[SolutionTypesClientListBySubscriptionResponse]` +- New struct `AwsCloudProfile` +- New struct `ErrorAdditionalInfoInfo` +- New struct `GenerateAwsTemplateRequest` +- New struct `InventoryProperties` +- New struct `InventoryResource` +- New struct `InventoryResourceListResult` +- New struct `OperationStatusResult` +- New struct `PostResponse` +- New struct `PublicCloudConnector` +- New struct `PublicCloudConnectorListResult` +- New struct `PublicCloudConnectorProperties` +- New struct `SolutionConfiguration` +- New struct `SolutionConfigurationListResult` +- New struct `SolutionConfigurationProperties` +- New struct `SolutionSettings` +- New struct `SolutionTypeProperties` +- New struct `SolutionTypeResource` +- New struct `SolutionTypeResourceListResult` +- New struct `SolutionTypeSettings` +- New struct `SolutionTypeSettingsProperties` + + ## 1.1.0 (2023-11-24) ### Features Added diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/README.md b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/README.md index 22ab09b89fd9..189958555abd 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/README.md +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/README.md @@ -18,7 +18,7 @@ This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for ve Install the Azure Arc Connectivity module: ```sh -go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/v2 ``` ## Authorization @@ -55,7 +55,7 @@ clientFactory, err := armhybridconnectivity.NewClientFactory(, 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.NewEndpointsClient() +client := clientFactory.NewGenerateAwsTemplateClient() ``` ## Fakes diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/autorest.md b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/autorest.md deleted file mode 100644 index afd5f368e2c3..000000000000 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/autorest.md +++ /dev/null @@ -1,13 +0,0 @@ -### AutoRest Configuration - -> see https://aka.ms/autorest - -``` yaml -azure-arm: true -require: -- https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/hybridconnectivity/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/hybridconnectivity/resource-manager/readme.go.md -license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.1.0 -tag: package-2023-03 -``` \ No newline at end of file diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/build.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/build.go deleted file mode 100644 index 8a77e9ffb103..000000000000 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/build.go +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. - -// This file enables 'go generate' to regenerate this specific SDK -//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate resourcemanager/hybridconnectivity/armhybridconnectivity - -package armhybridconnectivity diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/client_factory.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/client_factory.go index 89c044c9cb1d..51ff59f8bdb0 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/client_factory.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/client_factory.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armhybridconnectivity @@ -16,39 +12,60 @@ import ( // ClientFactory is a client factory used to create any client in this module. // Don't use this type directly, use NewClientFactory instead. type ClientFactory struct { - credential azcore.TokenCredential - options *arm.ClientOptions + subscriptionID string + internal *arm.Client } // 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 - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. -func NewClientFactory(credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { - _, err := arm.NewClient(moduleName, moduleVersion, credential, options) +func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } return &ClientFactory{ - credential: credential, - options: options.Clone(), + subscriptionID: subscriptionID, + internal: internal, }, nil } -// NewEndpointsClient creates a new instance of EndpointsClient. -func (c *ClientFactory) NewEndpointsClient() *EndpointsClient { - subClient, _ := NewEndpointsClient(c.credential, c.options) - return subClient +// NewGenerateAwsTemplateClient creates a new instance of GenerateAwsTemplateClient. +func (c *ClientFactory) NewGenerateAwsTemplateClient() *GenerateAwsTemplateClient { + return &GenerateAwsTemplateClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewInventoryClient creates a new instance of InventoryClient. +func (c *ClientFactory) NewInventoryClient() *InventoryClient { + return &InventoryClient{ + internal: c.internal, + } +} + +// NewPublicCloudConnectorsClient creates a new instance of PublicCloudConnectorsClient. +func (c *ClientFactory) NewPublicCloudConnectorsClient() *PublicCloudConnectorsClient { + return &PublicCloudConnectorsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } -// NewOperationsClient creates a new instance of OperationsClient. -func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) - return subClient +// NewSolutionConfigurationsClient creates a new instance of SolutionConfigurationsClient. +func (c *ClientFactory) NewSolutionConfigurationsClient() *SolutionConfigurationsClient { + return &SolutionConfigurationsClient{ + internal: c.internal, + } } -// NewServiceConfigurationsClient creates a new instance of ServiceConfigurationsClient. -func (c *ClientFactory) NewServiceConfigurationsClient() *ServiceConfigurationsClient { - subClient, _ := NewServiceConfigurationsClient(c.credential, c.options) - return subClient +// NewSolutionTypesClient creates a new instance of SolutionTypesClient. +func (c *ClientFactory) NewSolutionTypesClient() *SolutionTypesClient { + return &SolutionTypesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/constants.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/constants.go index 1cbb8bab1855..33c27e09ae97 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/constants.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/constants.go @@ -1,40 +1,41 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armhybridconnectivity const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity" - moduleVersion = "v1.1.0" + moduleVersion = "v2.0.0" ) -// ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. -type ActionType string +// CloudNativeType - Cloud Native Type enum. +type CloudNativeType string const ( - ActionTypeInternal ActionType = "Internal" + // CloudNativeTypeEc2 - ec2 enum. + CloudNativeTypeEc2 CloudNativeType = "ec2" ) -// PossibleActionTypeValues returns the possible values for the ActionType const type. -func PossibleActionTypeValues() []ActionType { - return []ActionType{ - ActionTypeInternal, +// PossibleCloudNativeTypeValues returns the possible values for the CloudNativeType const type. +func PossibleCloudNativeTypeValues() []CloudNativeType { + return []CloudNativeType{ + CloudNativeTypeEc2, } } -// CreatedByType - The type of identity that created the resource. +// CreatedByType - The kind of entity that created the resource. type CreatedByType string const ( - CreatedByTypeApplication CreatedByType = "Application" - CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeApplication - The entity was created by an application. + CreatedByTypeApplication CreatedByType = "Application" + // CreatedByTypeKey - The entity was created by a key. + CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeManagedIdentity - The entity was created by a managed identity. CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - CreatedByTypeUser CreatedByType = "User" + // CreatedByTypeUser - The entity was created by a user. + CreatedByTypeUser CreatedByType = "User" ) // PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. @@ -47,75 +48,62 @@ func PossibleCreatedByTypeValues() []CreatedByType { } } -// 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 ( - OriginSystem Origin = "system" - OriginUser Origin = "user" - OriginUserSystem Origin = "user,system" -) - -// PossibleOriginValues returns the possible values for the Origin const type. -func PossibleOriginValues() []Origin { - return []Origin{ - OriginSystem, - OriginUser, - OriginUserSystem, - } -} - -// ProvisioningState - The resource provisioning state. -type ProvisioningState string +// HostType - Enum of host cloud the public cloud connector is referencing. +type HostType string const ( - ProvisioningStateCanceled ProvisioningState = "Canceled" - ProvisioningStateCreating ProvisioningState = "Creating" - ProvisioningStateFailed ProvisioningState = "Failed" - ProvisioningStateSucceeded ProvisioningState = "Succeeded" - ProvisioningStateUpdating ProvisioningState = "Updating" + // HostTypeAWS - AWS state + HostTypeAWS HostType = "AWS" ) -// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{ - ProvisioningStateCanceled, - ProvisioningStateCreating, - ProvisioningStateFailed, - ProvisioningStateSucceeded, - ProvisioningStateUpdating, +// PossibleHostTypeValues returns the possible values for the HostType const type. +func PossibleHostTypeValues() []HostType { + return []HostType{ + HostTypeAWS, } } -// ServiceName - Name of the service. -type ServiceName string +// ResourceProvisioningState - The provisioning state of a resource type. +type ResourceProvisioningState string const ( - ServiceNameSSH ServiceName = "SSH" - ServiceNameWAC ServiceName = "WAC" + // ResourceProvisioningStateCanceled - Resource creation was canceled. + ResourceProvisioningStateCanceled ResourceProvisioningState = "Canceled" + // ResourceProvisioningStateFailed - Resource creation failed. + ResourceProvisioningStateFailed ResourceProvisioningState = "Failed" + // ResourceProvisioningStateSucceeded - Resource has been created. + ResourceProvisioningStateSucceeded ResourceProvisioningState = "Succeeded" ) -// PossibleServiceNameValues returns the possible values for the ServiceName const type. -func PossibleServiceNameValues() []ServiceName { - return []ServiceName{ - ServiceNameSSH, - ServiceNameWAC, +// PossibleResourceProvisioningStateValues returns the possible values for the ResourceProvisioningState const type. +func PossibleResourceProvisioningStateValues() []ResourceProvisioningState { + return []ResourceProvisioningState{ + ResourceProvisioningStateCanceled, + ResourceProvisioningStateFailed, + ResourceProvisioningStateSucceeded, } } -// Type - The type of endpoint. -type Type string +// SolutionConfigurationStatus - Solution Configuration Status. +type SolutionConfigurationStatus string const ( - TypeCustom Type = "custom" - TypeDefault Type = "default" + // SolutionConfigurationStatusCompleted - Canceled status + SolutionConfigurationStatusCompleted SolutionConfigurationStatus = "Completed" + // SolutionConfigurationStatusFailed - Failed status + SolutionConfigurationStatusFailed SolutionConfigurationStatus = "Failed" + // SolutionConfigurationStatusInProgress - InProgress status + SolutionConfigurationStatusInProgress SolutionConfigurationStatus = "InProgress" + // SolutionConfigurationStatusNew - New status + SolutionConfigurationStatusNew SolutionConfigurationStatus = "New" ) -// PossibleTypeValues returns the possible values for the Type const type. -func PossibleTypeValues() []Type { - return []Type{ - TypeCustom, - TypeDefault, +// PossibleSolutionConfigurationStatusValues returns the possible values for the SolutionConfigurationStatus const type. +func PossibleSolutionConfigurationStatusValues() []SolutionConfigurationStatus { + return []SolutionConfigurationStatus{ + SolutionConfigurationStatusCompleted, + SolutionConfigurationStatusFailed, + SolutionConfigurationStatusInProgress, + SolutionConfigurationStatusNew, } } diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/endpoints_client.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/endpoints_client.go deleted file mode 100644 index cb3b0cba148a..000000000000 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/endpoints_client.go +++ /dev/null @@ -1,494 +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 armhybridconnectivity - -import ( - "context" - "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" - "strconv" - "strings" -) - -// EndpointsClient contains the methods for the Endpoints group. -// Don't use this type directly, use NewEndpointsClient() instead. -type EndpointsClient struct { - internal *arm.Client -} - -// NewEndpointsClient creates a new instance of EndpointsClient with the specified values. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewEndpointsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*EndpointsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &EndpointsClient{ - internal: cl, - } - return client, nil -} - -// CreateOrUpdate - Create or update the endpoint to the target resource. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-03-15 -// - resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. -// - endpointName - The endpoint name. -// - endpointResource - Endpoint details -// - options - EndpointsClientCreateOrUpdateOptions contains the optional parameters for the EndpointsClient.CreateOrUpdate -// method. -func (client *EndpointsClient) CreateOrUpdate(ctx context.Context, resourceURI string, endpointName string, endpointResource EndpointResource, options *EndpointsClientCreateOrUpdateOptions) (EndpointsClientCreateOrUpdateResponse, error) { - var err error - const operationName = "EndpointsClient.CreateOrUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createOrUpdateCreateRequest(ctx, resourceURI, endpointName, endpointResource, options) - if err != nil { - return EndpointsClientCreateOrUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return EndpointsClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return EndpointsClientCreateOrUpdateResponse{}, err - } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *EndpointsClient) createOrUpdateCreateRequest(ctx context.Context, resourceURI string, endpointName string, endpointResource EndpointResource, options *EndpointsClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - urlPath = strings.ReplaceAll(urlPath, "{endpointName}", endpointName) - 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-03-15") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, endpointResource); err != nil { - return nil, err - } - return req, nil -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *EndpointsClient) createOrUpdateHandleResponse(resp *http.Response) (EndpointsClientCreateOrUpdateResponse, error) { - result := EndpointsClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.EndpointResource); err != nil { - return EndpointsClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// Delete - Deletes the endpoint access to the target resource. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-03-15 -// - resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. -// - endpointName - The endpoint name. -// - options - EndpointsClientDeleteOptions contains the optional parameters for the EndpointsClient.Delete method. -func (client *EndpointsClient) Delete(ctx context.Context, resourceURI string, endpointName string, options *EndpointsClientDeleteOptions) (EndpointsClientDeleteResponse, error) { - var err error - const operationName = "EndpointsClient.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, resourceURI, endpointName, options) - if err != nil { - return EndpointsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return EndpointsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return EndpointsClientDeleteResponse{}, err - } - return EndpointsClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *EndpointsClient) deleteCreateRequest(ctx context.Context, resourceURI string, endpointName string, options *EndpointsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - urlPath = strings.ReplaceAll(urlPath, "{endpointName}", endpointName) - 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-03-15") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Gets the endpoint to the resource. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-03-15 -// - resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. -// - endpointName - The endpoint name. -// - options - EndpointsClientGetOptions contains the optional parameters for the EndpointsClient.Get method. -func (client *EndpointsClient) Get(ctx context.Context, resourceURI string, endpointName string, options *EndpointsClientGetOptions) (EndpointsClientGetResponse, error) { - var err error - const operationName = "EndpointsClient.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, resourceURI, endpointName, options) - if err != nil { - return EndpointsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return EndpointsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return EndpointsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *EndpointsClient) getCreateRequest(ctx context.Context, resourceURI string, endpointName string, options *EndpointsClientGetOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - urlPath = strings.ReplaceAll(urlPath, "{endpointName}", endpointName) - 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-03-15") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *EndpointsClient) getHandleResponse(resp *http.Response) (EndpointsClientGetResponse, error) { - result := EndpointsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.EndpointResource); err != nil { - return EndpointsClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - List of endpoints to the target resource. -// -// Generated from API version 2023-03-15 -// - resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. -// - options - EndpointsClientListOptions contains the optional parameters for the EndpointsClient.NewListPager method. -func (client *EndpointsClient) NewListPager(resourceURI string, options *EndpointsClientListOptions) *runtime.Pager[EndpointsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[EndpointsClientListResponse]{ - More: func(page EndpointsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *EndpointsClientListResponse) (EndpointsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "EndpointsClient.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, resourceURI, options) - }, nil) - if err != nil { - return EndpointsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *EndpointsClient) listCreateRequest(ctx context.Context, resourceURI string, options *EndpointsClientListOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - 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-03-15") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *EndpointsClient) listHandleResponse(resp *http.Response) (EndpointsClientListResponse, error) { - result := EndpointsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.EndpointsList); err != nil { - return EndpointsClientListResponse{}, err - } - return result, nil -} - -// ListCredentials - Gets the endpoint access credentials to the resource. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-03-15 -// - resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. -// - endpointName - The endpoint name. -// - options - EndpointsClientListCredentialsOptions contains the optional parameters for the EndpointsClient.ListCredentials -// method. -func (client *EndpointsClient) ListCredentials(ctx context.Context, resourceURI string, endpointName string, options *EndpointsClientListCredentialsOptions) (EndpointsClientListCredentialsResponse, error) { - var err error - const operationName = "EndpointsClient.ListCredentials" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.listCredentialsCreateRequest(ctx, resourceURI, endpointName, options) - if err != nil { - return EndpointsClientListCredentialsResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return EndpointsClientListCredentialsResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return EndpointsClientListCredentialsResponse{}, err - } - resp, err := client.listCredentialsHandleResponse(httpResp) - return resp, err -} - -// listCredentialsCreateRequest creates the ListCredentials request. -func (client *EndpointsClient) listCredentialsCreateRequest(ctx context.Context, resourceURI string, endpointName string, options *EndpointsClientListCredentialsOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/listCredentials" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - urlPath = strings.ReplaceAll(urlPath, "{endpointName}", endpointName) - 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-03-15") - if options != nil && options.Expiresin != nil { - reqQP.Set("expiresin", strconv.FormatInt(*options.Expiresin, 10)) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.ListCredentialsRequest != nil { - if err := runtime.MarshalAsJSON(req, *options.ListCredentialsRequest); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// listCredentialsHandleResponse handles the ListCredentials response. -func (client *EndpointsClient) listCredentialsHandleResponse(resp *http.Response) (EndpointsClientListCredentialsResponse, error) { - result := EndpointsClientListCredentialsResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.EndpointAccessResource); err != nil { - return EndpointsClientListCredentialsResponse{}, err - } - return result, nil -} - -// ListIngressGatewayCredentials - Gets the ingress gateway endpoint credentials -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-03-15 -// - resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. -// - endpointName - The endpoint name. -// - options - EndpointsClientListIngressGatewayCredentialsOptions contains the optional parameters for the EndpointsClient.ListIngressGatewayCredentials -// method. -func (client *EndpointsClient) ListIngressGatewayCredentials(ctx context.Context, resourceURI string, endpointName string, options *EndpointsClientListIngressGatewayCredentialsOptions) (EndpointsClientListIngressGatewayCredentialsResponse, error) { - var err error - const operationName = "EndpointsClient.ListIngressGatewayCredentials" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.listIngressGatewayCredentialsCreateRequest(ctx, resourceURI, endpointName, options) - if err != nil { - return EndpointsClientListIngressGatewayCredentialsResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return EndpointsClientListIngressGatewayCredentialsResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return EndpointsClientListIngressGatewayCredentialsResponse{}, err - } - resp, err := client.listIngressGatewayCredentialsHandleResponse(httpResp) - return resp, err -} - -// listIngressGatewayCredentialsCreateRequest creates the ListIngressGatewayCredentials request. -func (client *EndpointsClient) listIngressGatewayCredentialsCreateRequest(ctx context.Context, resourceURI string, endpointName string, options *EndpointsClientListIngressGatewayCredentialsOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/listIngressGatewayCredentials" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - urlPath = strings.ReplaceAll(urlPath, "{endpointName}", endpointName) - 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-03-15") - if options != nil && options.Expiresin != nil { - reqQP.Set("expiresin", strconv.FormatInt(*options.Expiresin, 10)) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.ListIngressGatewayCredentialsRequest != nil { - if err := runtime.MarshalAsJSON(req, *options.ListIngressGatewayCredentialsRequest); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// listIngressGatewayCredentialsHandleResponse handles the ListIngressGatewayCredentials response. -func (client *EndpointsClient) listIngressGatewayCredentialsHandleResponse(resp *http.Response) (EndpointsClientListIngressGatewayCredentialsResponse, error) { - result := EndpointsClientListIngressGatewayCredentialsResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.IngressGatewayResource); err != nil { - return EndpointsClientListIngressGatewayCredentialsResponse{}, err - } - return result, nil -} - -// ListManagedProxyDetails - Fetches the managed proxy details -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-03-15 -// - resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. -// - endpointName - The endpoint name. -// - managedProxyRequest - Object of type ManagedProxyRequest -// - options - EndpointsClientListManagedProxyDetailsOptions contains the optional parameters for the EndpointsClient.ListManagedProxyDetails -// method. -func (client *EndpointsClient) ListManagedProxyDetails(ctx context.Context, resourceURI string, endpointName string, managedProxyRequest ManagedProxyRequest, options *EndpointsClientListManagedProxyDetailsOptions) (EndpointsClientListManagedProxyDetailsResponse, error) { - var err error - const operationName = "EndpointsClient.ListManagedProxyDetails" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.listManagedProxyDetailsCreateRequest(ctx, resourceURI, endpointName, managedProxyRequest, options) - if err != nil { - return EndpointsClientListManagedProxyDetailsResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return EndpointsClientListManagedProxyDetailsResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return EndpointsClientListManagedProxyDetailsResponse{}, err - } - resp, err := client.listManagedProxyDetailsHandleResponse(httpResp) - return resp, err -} - -// listManagedProxyDetailsCreateRequest creates the ListManagedProxyDetails request. -func (client *EndpointsClient) listManagedProxyDetailsCreateRequest(ctx context.Context, resourceURI string, endpointName string, managedProxyRequest ManagedProxyRequest, options *EndpointsClientListManagedProxyDetailsOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/listManagedProxyDetails" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - urlPath = strings.ReplaceAll(urlPath, "{endpointName}", endpointName) - 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-03-15") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, managedProxyRequest); err != nil { - return nil, err - } - return req, nil -} - -// listManagedProxyDetailsHandleResponse handles the ListManagedProxyDetails response. -func (client *EndpointsClient) listManagedProxyDetailsHandleResponse(resp *http.Response) (EndpointsClientListManagedProxyDetailsResponse, error) { - result := EndpointsClientListManagedProxyDetailsResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ManagedProxyResource); err != nil { - return EndpointsClientListManagedProxyDetailsResponse{}, err - } - return result, nil -} - -// Update - Update the endpoint to the target resource. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-03-15 -// - resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. -// - endpointName - The endpoint name. -// - endpointResource - Endpoint details -// - options - EndpointsClientUpdateOptions contains the optional parameters for the EndpointsClient.Update method. -func (client *EndpointsClient) Update(ctx context.Context, resourceURI string, endpointName string, endpointResource EndpointResource, options *EndpointsClientUpdateOptions) (EndpointsClientUpdateResponse, error) { - var err error - const operationName = "EndpointsClient.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, resourceURI, endpointName, endpointResource, options) - if err != nil { - return EndpointsClientUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return EndpointsClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return EndpointsClientUpdateResponse{}, err - } - resp, err := client.updateHandleResponse(httpResp) - return resp, err -} - -// updateCreateRequest creates the Update request. -func (client *EndpointsClient) updateCreateRequest(ctx context.Context, resourceURI string, endpointName string, endpointResource EndpointResource, options *EndpointsClientUpdateOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - urlPath = strings.ReplaceAll(urlPath, "{endpointName}", endpointName) - 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-03-15") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, endpointResource); err != nil { - return nil, err - } - return req, nil -} - -// updateHandleResponse handles the Update response. -func (client *EndpointsClient) updateHandleResponse(resp *http.Response) (EndpointsClientUpdateResponse, error) { - result := EndpointsClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.EndpointResource); err != nil { - return EndpointsClientUpdateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/endpoints_client_example_test.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/endpoints_client_example_test.go deleted file mode 100644 index 977b6e8aca9a..000000000000 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/endpoints_client_example_test.go +++ /dev/null @@ -1,340 +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 armhybridconnectivity_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/hybridconnectivity/armhybridconnectivity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/EndpointsList.json -func ExampleEndpointsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridconnectivity.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewEndpointsClient().NewListPager("subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", 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.EndpointsList = armhybridconnectivity.EndpointsList{ - // Value: []*armhybridconnectivity.EndpointResource{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.HybridConnectivity/endpoints"), - // ID: to.Ptr("/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default"), - // Properties: &armhybridconnectivity.EndpointProperties{ - // Type: to.Ptr(armhybridconnectivity.TypeDefault), - // }, - // }, - // { - // Name: to.Ptr("custom"), - // Type: to.Ptr("Microsoft.HybridConnectivity/endpoints"), - // ID: to.Ptr("/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/custom"), - // Properties: &armhybridconnectivity.EndpointProperties{ - // Type: to.Ptr(armhybridconnectivity.TypeCustom), - // ResourceID: to.Ptr("/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.Relay/namespaces/custom-relay-namespace"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/EndpointsGetCustom.json -func ExampleEndpointsClient_Get_hybridConnectivityEndpointsGetCustom() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridconnectivity.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEndpointsClient().Get(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", "custom", 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.EndpointResource = armhybridconnectivity.EndpointResource{ - // Name: to.Ptr("custom"), - // Type: to.Ptr("Microsoft.HybridConnectivity/endpoints"), - // ID: to.Ptr("/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/custom"), - // Properties: &armhybridconnectivity.EndpointProperties{ - // Type: to.Ptr(armhybridconnectivity.TypeCustom), - // ResourceID: to.Ptr("/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.Relay/namespaces/custom-relay-namespace"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/EndpointsGetDefault.json -func ExampleEndpointsClient_Get_hybridConnectivityEndpointsGetDefault() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridconnectivity.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEndpointsClient().Get(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", "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.EndpointResource = armhybridconnectivity.EndpointResource{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.HybridConnectivity/endpoints"), - // ID: to.Ptr("/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default"), - // Properties: &armhybridconnectivity.EndpointProperties{ - // Type: to.Ptr(armhybridconnectivity.TypeDefault), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/EndpointsPutCustom.json -func ExampleEndpointsClient_CreateOrUpdate_hybridConnectivityEndpointsPutCustom() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridconnectivity.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEndpointsClient().CreateOrUpdate(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", "custom", armhybridconnectivity.EndpointResource{ - Properties: &armhybridconnectivity.EndpointProperties{ - Type: to.Ptr(armhybridconnectivity.TypeCustom), - ResourceID: to.Ptr("/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.Relay/namespaces/custom-relay-namespace"), - }, - }, 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.EndpointResource = armhybridconnectivity.EndpointResource{ - // Name: to.Ptr("custom"), - // Type: to.Ptr("Microsoft.HybridConnectivity/endpoints"), - // ID: to.Ptr("/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/custom"), - // Properties: &armhybridconnectivity.EndpointProperties{ - // Type: to.Ptr(armhybridconnectivity.TypeCustom), - // ProvisioningState: to.Ptr("Succeeded"), - // ResourceID: to.Ptr("/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.Relay/namespaces/custom-relay-namespace"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/EndpointsPutDefault.json -func ExampleEndpointsClient_CreateOrUpdate_hybridConnectivityEndpointsPutDefault() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridconnectivity.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEndpointsClient().CreateOrUpdate(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", "default", armhybridconnectivity.EndpointResource{ - Properties: &armhybridconnectivity.EndpointProperties{ - Type: to.Ptr(armhybridconnectivity.TypeDefault), - }, - }, 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.EndpointResource = armhybridconnectivity.EndpointResource{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.HybridConnectivity/endpoints"), - // ID: to.Ptr("/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default"), - // Properties: &armhybridconnectivity.EndpointProperties{ - // Type: to.Ptr(armhybridconnectivity.TypeDefault), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/EndpointsPatchDefault.json -func ExampleEndpointsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridconnectivity.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEndpointsClient().Update(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", "default", armhybridconnectivity.EndpointResource{ - Properties: &armhybridconnectivity.EndpointProperties{ - Type: to.Ptr(armhybridconnectivity.TypeDefault), - }, - }, 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.EndpointResource = armhybridconnectivity.EndpointResource{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.HybridConnectivity/endpoints"), - // ID: to.Ptr("/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default"), - // Properties: &armhybridconnectivity.EndpointProperties{ - // Type: to.Ptr(armhybridconnectivity.TypeDefault), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/EndpointsDeleteDefault.json -func ExampleEndpointsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridconnectivity.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewEndpointsClient().Delete(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", "default", 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/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/EndpointsPostListCredentials.json -func ExampleEndpointsClient_ListCredentials() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridconnectivity.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEndpointsClient().ListCredentials(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", "default", &armhybridconnectivity.EndpointsClientListCredentialsOptions{Expiresin: to.Ptr[int64](10800), - ListCredentialsRequest: &armhybridconnectivity.ListCredentialsRequest{ - ServiceName: to.Ptr(armhybridconnectivity.ServiceNameSSH), - }, - }) - 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.EndpointAccessResource = armhybridconnectivity.EndpointAccessResource{ - // Relay: &armhybridconnectivity.RelayNamespaceAccessProperties{ - // AccessKey: to.Ptr("SharedAccessSignature sr=http%3A%2F%2Fazgnrelay-eastus-l1.servicebus.windows.net%2Fmicrosoft.kubernetes%2Fconnectedclusters%2Fa0e1fd7d1d974ddf6b11a952d67679c9f12c006eee16861857a8268da4eb1498%2F1619989456957411072%2F&sig=WxDwPF6AmmODaMHNnBGDSm773UG%2B%2Be"), - // ExpiresOn: to.Ptr[int64](1620000256), - // HybridConnectionName: to.Ptr("microsoft.kubernetes/connectedclusters/a0e1fd7d1d974ddf6b11a952d67679c9f12c006eee16861857a8268da4eb1498/1619989456957411072"), - // NamespaceName: to.Ptr("azgnrelay-eastus-l1"), - // NamespaceNameSuffix: to.Ptr("servicebus.windows.net"), - // ServiceConfigurationToken: to.Ptr("SSHvjqH=pTlKql=RtMGw/-k5VFBxSYHIiq5ZgbGFcLkNrDNz5fDsinCN2zkG"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/EndpointsPostListIngressGatewayCredentials.json -func ExampleEndpointsClient_ListIngressGatewayCredentials() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridconnectivity.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEndpointsClient().ListIngressGatewayCredentials(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/arcGroup/providers/Microsoft.ArcPlaceHolder/ProvisionedClusters/cluster0", "default", &armhybridconnectivity.EndpointsClientListIngressGatewayCredentialsOptions{Expiresin: to.Ptr[int64](10800), - ListIngressGatewayCredentialsRequest: 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.IngressGatewayResource = armhybridconnectivity.IngressGatewayResource{ - // Ingress: &armhybridconnectivity.IngressProfileProperties{ - // AADProfile: &armhybridconnectivity.AADProfileProperties{ - // ServerID: to.Ptr("6256c85f-0aad-4d50-b960-e6e9b21efe35"), - // TenantID: to.Ptr("hy657tgh-8d16-42db-81b7-1234hygt67hy5"), - // }, - // Hostname: to.Ptr("clusterhostname"), - // }, - // Relay: &armhybridconnectivity.RelayNamespaceAccessProperties{ - // AccessKey: to.Ptr("SharedAccessSignature sr=http%3A%2F%2Fazgnrelay-eastus-l1.servicebus.windows.net%2Fmicrosoft.provisionedcluster%hci"), - // ExpiresOn: to.Ptr[int64](1620000256), - // HybridConnectionName: to.Ptr("microsoft.arcplaceholder/provisionedclusters/000/1619989456957411072"), - // NamespaceName: to.Ptr("relaynamespace"), - // NamespaceNameSuffix: to.Ptr("servicebus.windows.net"), - // ServiceConfigurationToken: to.Ptr("SSHvjqH=pTlKql=RtMGw/-k5VFBxSYHIiq5ZgbGFcLkNrDNz5fDsinCN2zkG"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/EndpointsPostListManagedProxyDetails.json -func ExampleEndpointsClient_ListManagedProxyDetails() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridconnectivity.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEndpointsClient().ListManagedProxyDetails(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/arcGroup/providers/Microsoft.Compute/virtualMachines/vm00006", "default", armhybridconnectivity.ManagedProxyRequest{ - Hostname: to.Ptr("r.proxy.arc.com"), - Service: to.Ptr("127.0.0.1:65035"), - ServiceName: to.Ptr(armhybridconnectivity.ServiceNameWAC), - }, 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.ManagedProxyResource = armhybridconnectivity.ManagedProxyResource{ - // ExpiresOn: to.Ptr[int64](1620000256), - // Proxy: to.Ptr("uid.r.proxy.arc.com"), - // } -} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/endpoints_server.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/endpoints_server.go deleted file mode 100644 index a85842630ea2..000000000000 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/endpoints_server.go +++ /dev/null @@ -1,448 +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/hybridconnectivity/armhybridconnectivity" - "net/http" - "net/url" - "reflect" - "regexp" - "strconv" -) - -// EndpointsServer is a fake server for instances of the armhybridconnectivity.EndpointsClient type. -type EndpointsServer struct { - // CreateOrUpdate is the fake for method EndpointsClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK - CreateOrUpdate func(ctx context.Context, resourceURI string, endpointName string, endpointResource armhybridconnectivity.EndpointResource, options *armhybridconnectivity.EndpointsClientCreateOrUpdateOptions) (resp azfake.Responder[armhybridconnectivity.EndpointsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method EndpointsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceURI string, endpointName string, options *armhybridconnectivity.EndpointsClientDeleteOptions) (resp azfake.Responder[armhybridconnectivity.EndpointsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method EndpointsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceURI string, endpointName string, options *armhybridconnectivity.EndpointsClientGetOptions) (resp azfake.Responder[armhybridconnectivity.EndpointsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method EndpointsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceURI string, options *armhybridconnectivity.EndpointsClientListOptions) (resp azfake.PagerResponder[armhybridconnectivity.EndpointsClientListResponse]) - - // ListCredentials is the fake for method EndpointsClient.ListCredentials - // HTTP status codes to indicate success: http.StatusOK - ListCredentials func(ctx context.Context, resourceURI string, endpointName string, options *armhybridconnectivity.EndpointsClientListCredentialsOptions) (resp azfake.Responder[armhybridconnectivity.EndpointsClientListCredentialsResponse], errResp azfake.ErrorResponder) - - // ListIngressGatewayCredentials is the fake for method EndpointsClient.ListIngressGatewayCredentials - // HTTP status codes to indicate success: http.StatusOK - ListIngressGatewayCredentials func(ctx context.Context, resourceURI string, endpointName string, options *armhybridconnectivity.EndpointsClientListIngressGatewayCredentialsOptions) (resp azfake.Responder[armhybridconnectivity.EndpointsClientListIngressGatewayCredentialsResponse], errResp azfake.ErrorResponder) - - // ListManagedProxyDetails is the fake for method EndpointsClient.ListManagedProxyDetails - // HTTP status codes to indicate success: http.StatusOK - ListManagedProxyDetails func(ctx context.Context, resourceURI string, endpointName string, managedProxyRequest armhybridconnectivity.ManagedProxyRequest, options *armhybridconnectivity.EndpointsClientListManagedProxyDetailsOptions) (resp azfake.Responder[armhybridconnectivity.EndpointsClientListManagedProxyDetailsResponse], errResp azfake.ErrorResponder) - - // Update is the fake for method EndpointsClient.Update - // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, resourceURI string, endpointName string, endpointResource armhybridconnectivity.EndpointResource, options *armhybridconnectivity.EndpointsClientUpdateOptions) (resp azfake.Responder[armhybridconnectivity.EndpointsClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewEndpointsServerTransport creates a new instance of EndpointsServerTransport with the provided implementation. -// The returned EndpointsServerTransport instance is connected to an instance of armhybridconnectivity.EndpointsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewEndpointsServerTransport(srv *EndpointsServer) *EndpointsServerTransport { - return &EndpointsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armhybridconnectivity.EndpointsClientListResponse]](), - } -} - -// EndpointsServerTransport connects instances of armhybridconnectivity.EndpointsClient to instances of EndpointsServer. -// Don't use this type directly, use NewEndpointsServerTransport instead. -type EndpointsServerTransport struct { - srv *EndpointsServer - newListPager *tracker[azfake.PagerResponder[armhybridconnectivity.EndpointsClientListResponse]] -} - -// Do implements the policy.Transporter interface for EndpointsServerTransport. -func (e *EndpointsServerTransport) 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 "EndpointsClient.CreateOrUpdate": - resp, err = e.dispatchCreateOrUpdate(req) - case "EndpointsClient.Delete": - resp, err = e.dispatchDelete(req) - case "EndpointsClient.Get": - resp, err = e.dispatchGet(req) - case "EndpointsClient.NewListPager": - resp, err = e.dispatchNewListPager(req) - case "EndpointsClient.ListCredentials": - resp, err = e.dispatchListCredentials(req) - case "EndpointsClient.ListIngressGatewayCredentials": - resp, err = e.dispatchListIngressGatewayCredentials(req) - case "EndpointsClient.ListManagedProxyDetails": - resp, err = e.dispatchListManagedProxyDetails(req) - case "EndpointsClient.Update": - resp, err = e.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (e *EndpointsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { - if e.srv.CreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} - } - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - 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) - } - body, err := server.UnmarshalRequestAsJSON[armhybridconnectivity.EndpointResource](req) - if err != nil { - return nil, err - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - endpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("endpointName")]) - if err != nil { - return nil, err - } - respr, errRespr := e.srv.CreateOrUpdate(req.Context(), resourceURIParam, endpointNameParam, 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).EndpointResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (e *EndpointsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if e.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - 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) - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - endpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("endpointName")]) - if err != nil { - return nil, err - } - respr, errRespr := e.srv.Delete(req.Context(), resourceURIParam, endpointNameParam, 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 (e *EndpointsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if e.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - 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) - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - endpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("endpointName")]) - if err != nil { - return nil, err - } - respr, errRespr := e.srv.Get(req.Context(), resourceURIParam, endpointNameParam, 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).EndpointResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (e *EndpointsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if e.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := e.newListPager.get(req) - if newListPager == nil { - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/endpoints` - 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) - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - resp := e.srv.NewListPager(resourceURIParam, nil) - newListPager = &resp - e.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armhybridconnectivity.EndpointsClientListResponse, 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) { - e.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - e.newListPager.remove(req) - } - return resp, nil -} - -func (e *EndpointsServerTransport) dispatchListCredentials(req *http.Request) (*http.Response, error) { - if e.srv.ListCredentials == nil { - return nil, &nonRetriableError{errors.New("fake for method ListCredentials not implemented")} - } - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listCredentials` - 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) - } - qp := req.URL.Query() - body, err := server.UnmarshalRequestAsJSON[armhybridconnectivity.ListCredentialsRequest](req) - if err != nil { - return nil, err - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - endpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("endpointName")]) - if err != nil { - return nil, err - } - expiresinUnescaped, err := url.QueryUnescape(qp.Get("expiresin")) - if err != nil { - return nil, err - } - expiresinParam, err := parseOptional(expiresinUnescaped, func(v string) (int64, error) { - p, parseErr := strconv.ParseInt(v, 10, 64) - if parseErr != nil { - return 0, parseErr - } - return p, nil - }) - if err != nil { - return nil, err - } - var options *armhybridconnectivity.EndpointsClientListCredentialsOptions - if expiresinParam != nil || !reflect.ValueOf(body).IsZero() { - options = &armhybridconnectivity.EndpointsClientListCredentialsOptions{ - Expiresin: expiresinParam, - ListCredentialsRequest: &body, - } - } - respr, errRespr := e.srv.ListCredentials(req.Context(), resourceURIParam, endpointNameParam, 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).EndpointAccessResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (e *EndpointsServerTransport) dispatchListIngressGatewayCredentials(req *http.Request) (*http.Response, error) { - if e.srv.ListIngressGatewayCredentials == nil { - return nil, &nonRetriableError{errors.New("fake for method ListIngressGatewayCredentials not implemented")} - } - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listIngressGatewayCredentials` - 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) - } - qp := req.URL.Query() - body, err := server.UnmarshalRequestAsJSON[armhybridconnectivity.ListIngressGatewayCredentialsRequest](req) - if err != nil { - return nil, err - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - endpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("endpointName")]) - if err != nil { - return nil, err - } - expiresinUnescaped, err := url.QueryUnescape(qp.Get("expiresin")) - if err != nil { - return nil, err - } - expiresinParam, err := parseOptional(expiresinUnescaped, func(v string) (int64, error) { - p, parseErr := strconv.ParseInt(v, 10, 64) - if parseErr != nil { - return 0, parseErr - } - return p, nil - }) - if err != nil { - return nil, err - } - var options *armhybridconnectivity.EndpointsClientListIngressGatewayCredentialsOptions - if expiresinParam != nil || !reflect.ValueOf(body).IsZero() { - options = &armhybridconnectivity.EndpointsClientListIngressGatewayCredentialsOptions{ - Expiresin: expiresinParam, - ListIngressGatewayCredentialsRequest: &body, - } - } - respr, errRespr := e.srv.ListIngressGatewayCredentials(req.Context(), resourceURIParam, endpointNameParam, 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).IngressGatewayResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (e *EndpointsServerTransport) dispatchListManagedProxyDetails(req *http.Request) (*http.Response, error) { - if e.srv.ListManagedProxyDetails == nil { - return nil, &nonRetriableError{errors.New("fake for method ListManagedProxyDetails not implemented")} - } - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listManagedProxyDetails` - 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) - } - body, err := server.UnmarshalRequestAsJSON[armhybridconnectivity.ManagedProxyRequest](req) - if err != nil { - return nil, err - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - endpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("endpointName")]) - if err != nil { - return nil, err - } - respr, errRespr := e.srv.ListManagedProxyDetails(req.Context(), resourceURIParam, endpointNameParam, 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).ManagedProxyResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (e *EndpointsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { - if e.srv.Update == nil { - return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} - } - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - 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) - } - body, err := server.UnmarshalRequestAsJSON[armhybridconnectivity.EndpointResource](req) - if err != nil { - return nil, err - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - endpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("endpointName")]) - if err != nil { - return nil, err - } - respr, errRespr := e.srv.Update(req.Context(), resourceURIParam, endpointNameParam, 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).EndpointResource, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/generateawstemplate_server.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/generateawstemplate_server.go new file mode 100644 index 000000000000..f2cf85b83c7b --- /dev/null +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/generateawstemplate_server.go @@ -0,0 +1,116 @@ +// 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) Go Code Generator. DO NOT EDIT. + +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/hybridconnectivity/armhybridconnectivity/v2" + "net/http" + "regexp" +) + +// GenerateAwsTemplateServer is a fake server for instances of the armhybridconnectivity.GenerateAwsTemplateClient type. +type GenerateAwsTemplateServer struct { + // Post is the fake for method GenerateAwsTemplateClient.Post + // HTTP status codes to indicate success: http.StatusOK + Post func(ctx context.Context, generateAwsTemplateRequest armhybridconnectivity.GenerateAwsTemplateRequest, options *armhybridconnectivity.GenerateAwsTemplateClientPostOptions) (resp azfake.Responder[armhybridconnectivity.GenerateAwsTemplateClientPostResponse], errResp azfake.ErrorResponder) +} + +// NewGenerateAwsTemplateServerTransport creates a new instance of GenerateAwsTemplateServerTransport with the provided implementation. +// The returned GenerateAwsTemplateServerTransport instance is connected to an instance of armhybridconnectivity.GenerateAwsTemplateClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewGenerateAwsTemplateServerTransport(srv *GenerateAwsTemplateServer) *GenerateAwsTemplateServerTransport { + return &GenerateAwsTemplateServerTransport{srv: srv} +} + +// GenerateAwsTemplateServerTransport connects instances of armhybridconnectivity.GenerateAwsTemplateClient to instances of GenerateAwsTemplateServer. +// Don't use this type directly, use NewGenerateAwsTemplateServerTransport instead. +type GenerateAwsTemplateServerTransport struct { + srv *GenerateAwsTemplateServer +} + +// Do implements the policy.Transporter interface for GenerateAwsTemplateServerTransport. +func (g *GenerateAwsTemplateServerTransport) 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")} + } + + return g.dispatchToMethodFake(req, method) +} + +func (g *GenerateAwsTemplateServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if generateAwsTemplateServerTransportInterceptor != nil { + res.resp, res.err, intercepted = generateAwsTemplateServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "GenerateAwsTemplateClient.Post": + res.resp, res.err = g.dispatchPost(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (g *GenerateAwsTemplateServerTransport) dispatchPost(req *http.Request) (*http.Response, error) { + if g.srv.Post == nil { + return nil, &nonRetriableError{errors.New("fake for method Post not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/generateAwsTemplate` + 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) + } + body, err := server.UnmarshalRequestAsJSON[armhybridconnectivity.GenerateAwsTemplateRequest](req) + if err != nil { + return nil, err + } + respr, errRespr := g.srv.Post(req.Context(), 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).PostResponse, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to GenerateAwsTemplateServerTransport +var generateAwsTemplateServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/internal.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/internal.go index 4d8bd36394ec..7425b6a669e2 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/internal.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/internal.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -14,6 +10,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } @@ -31,17 +32,6 @@ func contains[T comparable](s []T, v T) bool { return false } -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 newTracker[T any]() *tracker[T] { return &tracker[T]{ items: map[string]*T{}, diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/inventory_server.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/inventory_server.go new file mode 100644 index 000000000000..e1da9bf65d5c --- /dev/null +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/inventory_server.go @@ -0,0 +1,177 @@ +// 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) Go Code Generator. DO NOT EDIT. + +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/hybridconnectivity/armhybridconnectivity/v2" + "net/http" + "net/url" + "regexp" +) + +// InventoryServer is a fake server for instances of the armhybridconnectivity.InventoryClient type. +type InventoryServer struct { + // Get is the fake for method InventoryClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceURI string, solutionConfiguration string, inventoryID string, options *armhybridconnectivity.InventoryClientGetOptions) (resp azfake.Responder[armhybridconnectivity.InventoryClientGetResponse], errResp azfake.ErrorResponder) + + // NewListBySolutionConfigurationPager is the fake for method InventoryClient.NewListBySolutionConfigurationPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySolutionConfigurationPager func(resourceURI string, solutionConfiguration string, options *armhybridconnectivity.InventoryClientListBySolutionConfigurationOptions) (resp azfake.PagerResponder[armhybridconnectivity.InventoryClientListBySolutionConfigurationResponse]) +} + +// NewInventoryServerTransport creates a new instance of InventoryServerTransport with the provided implementation. +// The returned InventoryServerTransport instance is connected to an instance of armhybridconnectivity.InventoryClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewInventoryServerTransport(srv *InventoryServer) *InventoryServerTransport { + return &InventoryServerTransport{ + srv: srv, + newListBySolutionConfigurationPager: newTracker[azfake.PagerResponder[armhybridconnectivity.InventoryClientListBySolutionConfigurationResponse]](), + } +} + +// InventoryServerTransport connects instances of armhybridconnectivity.InventoryClient to instances of InventoryServer. +// Don't use this type directly, use NewInventoryServerTransport instead. +type InventoryServerTransport struct { + srv *InventoryServer + newListBySolutionConfigurationPager *tracker[azfake.PagerResponder[armhybridconnectivity.InventoryClientListBySolutionConfigurationResponse]] +} + +// Do implements the policy.Transporter interface for InventoryServerTransport. +func (i *InventoryServerTransport) 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")} + } + + return i.dispatchToMethodFake(req, method) +} + +func (i *InventoryServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if inventoryServerTransportInterceptor != nil { + res.resp, res.err, intercepted = inventoryServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "InventoryClient.Get": + res.resp, res.err = i.dispatchGet(req) + case "InventoryClient.NewListBySolutionConfigurationPager": + res.resp, res.err = i.dispatchNewListBySolutionConfigurationPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (i *InventoryServerTransport) 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 = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/solutionConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/inventory/(?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) + } + resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) + if err != nil { + return nil, err + } + solutionConfigurationParam, err := url.PathUnescape(matches[regex.SubexpIndex("solutionConfiguration")]) + if err != nil { + return nil, err + } + inventoryIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("inventoryId")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.Get(req.Context(), resourceURIParam, solutionConfigurationParam, inventoryIDParam, 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).InventoryResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (i *InventoryServerTransport) dispatchNewListBySolutionConfigurationPager(req *http.Request) (*http.Response, error) { + if i.srv.NewListBySolutionConfigurationPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySolutionConfigurationPager not implemented")} + } + newListBySolutionConfigurationPager := i.newListBySolutionConfigurationPager.get(req) + if newListBySolutionConfigurationPager == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/solutionConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/inventory` + 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) + } + resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) + if err != nil { + return nil, err + } + solutionConfigurationParam, err := url.PathUnescape(matches[regex.SubexpIndex("solutionConfiguration")]) + if err != nil { + return nil, err + } + resp := i.srv.NewListBySolutionConfigurationPager(resourceURIParam, solutionConfigurationParam, nil) + newListBySolutionConfigurationPager = &resp + i.newListBySolutionConfigurationPager.add(req, newListBySolutionConfigurationPager) + server.PagerResponderInjectNextLinks(newListBySolutionConfigurationPager, req, func(page *armhybridconnectivity.InventoryClientListBySolutionConfigurationResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySolutionConfigurationPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + i.newListBySolutionConfigurationPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySolutionConfigurationPager) { + i.newListBySolutionConfigurationPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to InventoryServerTransport +var inventoryServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/publiccloudconnectors_server.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/publiccloudconnectors_server.go new file mode 100644 index 000000000000..62b43565e4ed --- /dev/null +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/publiccloudconnectors_server.go @@ -0,0 +1,400 @@ +// 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) Go Code Generator. DO NOT EDIT. + +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/hybridconnectivity/armhybridconnectivity/v2" + "net/http" + "net/url" + "regexp" +) + +// PublicCloudConnectorsServer is a fake server for instances of the armhybridconnectivity.PublicCloudConnectorsClient type. +type PublicCloudConnectorsServer struct { + // BeginCreateOrUpdate is the fake for method PublicCloudConnectorsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, publicCloudConnector string, resource armhybridconnectivity.PublicCloudConnector, options *armhybridconnectivity.PublicCloudConnectorsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armhybridconnectivity.PublicCloudConnectorsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method PublicCloudConnectorsClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, publicCloudConnector string, options *armhybridconnectivity.PublicCloudConnectorsClientDeleteOptions) (resp azfake.Responder[armhybridconnectivity.PublicCloudConnectorsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method PublicCloudConnectorsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, publicCloudConnector string, options *armhybridconnectivity.PublicCloudConnectorsClientGetOptions) (resp azfake.Responder[armhybridconnectivity.PublicCloudConnectorsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method PublicCloudConnectorsClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armhybridconnectivity.PublicCloudConnectorsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armhybridconnectivity.PublicCloudConnectorsClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method PublicCloudConnectorsClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armhybridconnectivity.PublicCloudConnectorsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armhybridconnectivity.PublicCloudConnectorsClientListBySubscriptionResponse]) + + // BeginTestPermissions is the fake for method PublicCloudConnectorsClient.BeginTestPermissions + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginTestPermissions func(ctx context.Context, resourceGroupName string, publicCloudConnector string, options *armhybridconnectivity.PublicCloudConnectorsClientBeginTestPermissionsOptions) (resp azfake.PollerResponder[armhybridconnectivity.PublicCloudConnectorsClientTestPermissionsResponse], errResp azfake.ErrorResponder) + + // Update is the fake for method PublicCloudConnectorsClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, publicCloudConnector string, properties armhybridconnectivity.PublicCloudConnector, options *armhybridconnectivity.PublicCloudConnectorsClientUpdateOptions) (resp azfake.Responder[armhybridconnectivity.PublicCloudConnectorsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewPublicCloudConnectorsServerTransport creates a new instance of PublicCloudConnectorsServerTransport with the provided implementation. +// The returned PublicCloudConnectorsServerTransport instance is connected to an instance of armhybridconnectivity.PublicCloudConnectorsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewPublicCloudConnectorsServerTransport(srv *PublicCloudConnectorsServer) *PublicCloudConnectorsServerTransport { + return &PublicCloudConnectorsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armhybridconnectivity.PublicCloudConnectorsClientCreateOrUpdateResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armhybridconnectivity.PublicCloudConnectorsClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armhybridconnectivity.PublicCloudConnectorsClientListBySubscriptionResponse]](), + beginTestPermissions: newTracker[azfake.PollerResponder[armhybridconnectivity.PublicCloudConnectorsClientTestPermissionsResponse]](), + } +} + +// PublicCloudConnectorsServerTransport connects instances of armhybridconnectivity.PublicCloudConnectorsClient to instances of PublicCloudConnectorsServer. +// Don't use this type directly, use NewPublicCloudConnectorsServerTransport instead. +type PublicCloudConnectorsServerTransport struct { + srv *PublicCloudConnectorsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armhybridconnectivity.PublicCloudConnectorsClientCreateOrUpdateResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armhybridconnectivity.PublicCloudConnectorsClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armhybridconnectivity.PublicCloudConnectorsClientListBySubscriptionResponse]] + beginTestPermissions *tracker[azfake.PollerResponder[armhybridconnectivity.PublicCloudConnectorsClientTestPermissionsResponse]] +} + +// Do implements the policy.Transporter interface for PublicCloudConnectorsServerTransport. +func (p *PublicCloudConnectorsServerTransport) 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")} + } + + return p.dispatchToMethodFake(req, method) +} + +func (p *PublicCloudConnectorsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if publicCloudConnectorsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = publicCloudConnectorsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PublicCloudConnectorsClient.BeginCreateOrUpdate": + res.resp, res.err = p.dispatchBeginCreateOrUpdate(req) + case "PublicCloudConnectorsClient.Delete": + res.resp, res.err = p.dispatchDelete(req) + case "PublicCloudConnectorsClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "PublicCloudConnectorsClient.NewListByResourceGroupPager": + res.resp, res.err = p.dispatchNewListByResourceGroupPager(req) + case "PublicCloudConnectorsClient.NewListBySubscriptionPager": + res.resp, res.err = p.dispatchNewListBySubscriptionPager(req) + case "PublicCloudConnectorsClient.BeginTestPermissions": + res.resp, res.err = p.dispatchBeginTestPermissions(req) + case "PublicCloudConnectorsClient.Update": + res.resp, res.err = p.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (p *PublicCloudConnectorsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if p.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := p.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/publicCloudConnectors/(?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[armhybridconnectivity.PublicCloudConnector](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + publicCloudConnectorParam, err := url.PathUnescape(matches[regex.SubexpIndex("publicCloudConnector")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, publicCloudConnectorParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + p.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + p.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + p.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (p *PublicCloudConnectorsServerTransport) 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\.HybridConnectivity/publicCloudConnectors/(?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 + } + publicCloudConnectorParam, err := url.PathUnescape(matches[regex.SubexpIndex("publicCloudConnector")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Delete(req.Context(), resourceGroupNameParam, publicCloudConnectorParam, 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 *PublicCloudConnectorsServerTransport) 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\.HybridConnectivity/publicCloudConnectors/(?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 + } + publicCloudConnectorParam, err := url.PathUnescape(matches[regex.SubexpIndex("publicCloudConnector")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, publicCloudConnectorParam, 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).PublicCloudConnector, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PublicCloudConnectorsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := p.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/publicCloudConnectors` + 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.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + p.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armhybridconnectivity.PublicCloudConnectorsClientListByResourceGroupResponse, 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) { + p.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + p.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (p *PublicCloudConnectorsServerTransport) 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\.HybridConnectivity/publicCloudConnectors` + 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 *armhybridconnectivity.PublicCloudConnectorsClientListBySubscriptionResponse, 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 *PublicCloudConnectorsServerTransport) dispatchBeginTestPermissions(req *http.Request) (*http.Response, error) { + if p.srv.BeginTestPermissions == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginTestPermissions not implemented")} + } + beginTestPermissions := p.beginTestPermissions.get(req) + if beginTestPermissions == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/publicCloudConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/testPermissions` + 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 + } + publicCloudConnectorParam, err := url.PathUnescape(matches[regex.SubexpIndex("publicCloudConnector")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginTestPermissions(req.Context(), resourceGroupNameParam, publicCloudConnectorParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginTestPermissions = &respr + p.beginTestPermissions.add(req, beginTestPermissions) + } + + resp, err := server.PollerResponderNext(beginTestPermissions, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + p.beginTestPermissions.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginTestPermissions) { + p.beginTestPermissions.remove(req) + } + + return resp, nil +} + +func (p *PublicCloudConnectorsServerTransport) 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\.HybridConnectivity/publicCloudConnectors/(?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[armhybridconnectivity.PublicCloudConnector](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + publicCloudConnectorParam, err := url.PathUnescape(matches[regex.SubexpIndex("publicCloudConnector")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Update(req.Context(), resourceGroupNameParam, publicCloudConnectorParam, 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).PublicCloudConnector, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to PublicCloudConnectorsServerTransport +var publicCloudConnectorsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/server_factory.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/server_factory.go index 34efe6c74a09..451a0fa8ad2d 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/server_factory.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/server_factory.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -19,9 +15,20 @@ import ( // ServerFactory is a fake server for instances of the armhybridconnectivity.ClientFactory type. type ServerFactory struct { - EndpointsServer EndpointsServer - OperationsServer OperationsServer - ServiceConfigurationsServer ServiceConfigurationsServer + // GenerateAwsTemplateServer contains the fakes for client GenerateAwsTemplateClient + GenerateAwsTemplateServer GenerateAwsTemplateServer + + // InventoryServer contains the fakes for client InventoryClient + InventoryServer InventoryServer + + // PublicCloudConnectorsServer contains the fakes for client PublicCloudConnectorsClient + PublicCloudConnectorsServer PublicCloudConnectorsServer + + // SolutionConfigurationsServer contains the fakes for client SolutionConfigurationsClient + SolutionConfigurationsServer SolutionConfigurationsServer + + // SolutionTypesServer contains the fakes for client SolutionTypesClient + SolutionTypesServer SolutionTypesServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. @@ -36,11 +43,13 @@ func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { // ServerFactoryTransport connects instances of armhybridconnectivity.ClientFactory to instances of ServerFactory. // Don't use this type directly, use NewServerFactoryTransport instead. type ServerFactoryTransport struct { - srv *ServerFactory - trMu sync.Mutex - trEndpointsServer *EndpointsServerTransport - trOperationsServer *OperationsServerTransport - trServiceConfigurationsServer *ServiceConfigurationsServerTransport + srv *ServerFactory + trMu sync.Mutex + trGenerateAwsTemplateServer *GenerateAwsTemplateServerTransport + trInventoryServer *InventoryServerTransport + trPublicCloudConnectorsServer *PublicCloudConnectorsServerTransport + trSolutionConfigurationsServer *SolutionConfigurationsServerTransport + trSolutionTypesServer *SolutionTypesServerTransport } // Do implements the policy.Transporter interface for ServerFactoryTransport. @@ -56,17 +65,29 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { var err error switch client { - case "EndpointsClient": - initServer(s, &s.trEndpointsServer, func() *EndpointsServerTransport { return NewEndpointsServerTransport(&s.srv.EndpointsServer) }) - resp, err = s.trEndpointsServer.Do(req) - case "OperationsClient": - initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) - resp, err = s.trOperationsServer.Do(req) - case "ServiceConfigurationsClient": - initServer(s, &s.trServiceConfigurationsServer, func() *ServiceConfigurationsServerTransport { - return NewServiceConfigurationsServerTransport(&s.srv.ServiceConfigurationsServer) + case "GenerateAwsTemplateClient": + initServer(s, &s.trGenerateAwsTemplateServer, func() *GenerateAwsTemplateServerTransport { + return NewGenerateAwsTemplateServerTransport(&s.srv.GenerateAwsTemplateServer) + }) + resp, err = s.trGenerateAwsTemplateServer.Do(req) + case "InventoryClient": + initServer(s, &s.trInventoryServer, func() *InventoryServerTransport { return NewInventoryServerTransport(&s.srv.InventoryServer) }) + resp, err = s.trInventoryServer.Do(req) + case "PublicCloudConnectorsClient": + initServer(s, &s.trPublicCloudConnectorsServer, func() *PublicCloudConnectorsServerTransport { + return NewPublicCloudConnectorsServerTransport(&s.srv.PublicCloudConnectorsServer) + }) + resp, err = s.trPublicCloudConnectorsServer.Do(req) + case "SolutionConfigurationsClient": + initServer(s, &s.trSolutionConfigurationsServer, func() *SolutionConfigurationsServerTransport { + return NewSolutionConfigurationsServerTransport(&s.srv.SolutionConfigurationsServer) + }) + resp, err = s.trSolutionConfigurationsServer.Do(req) + case "SolutionTypesClient": + initServer(s, &s.trSolutionTypesServer, func() *SolutionTypesServerTransport { + return NewSolutionTypesServerTransport(&s.srv.SolutionTypesServer) }) - resp, err = s.trServiceConfigurationsServer.Do(req) + resp, err = s.trSolutionTypesServer.Do(req) default: err = fmt.Errorf("unhandled client %s", client) } diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/serviceconfigurations_server.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/serviceconfigurations_server.go deleted file mode 100644 index bc2e11c98848..000000000000 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/serviceconfigurations_server.go +++ /dev/null @@ -1,293 +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/hybridconnectivity/armhybridconnectivity" - "net/http" - "net/url" - "regexp" -) - -// ServiceConfigurationsServer is a fake server for instances of the armhybridconnectivity.ServiceConfigurationsClient type. -type ServiceConfigurationsServer struct { - // CreateOrupdate is the fake for method ServiceConfigurationsClient.CreateOrupdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - CreateOrupdate func(ctx context.Context, resourceURI string, endpointName string, serviceConfigurationName string, serviceConfigurationResource armhybridconnectivity.ServiceConfigurationResource, options *armhybridconnectivity.ServiceConfigurationsClientCreateOrupdateOptions) (resp azfake.Responder[armhybridconnectivity.ServiceConfigurationsClientCreateOrupdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method ServiceConfigurationsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceURI string, endpointName string, serviceConfigurationName string, options *armhybridconnectivity.ServiceConfigurationsClientDeleteOptions) (resp azfake.Responder[armhybridconnectivity.ServiceConfigurationsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method ServiceConfigurationsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceURI string, endpointName string, serviceConfigurationName string, options *armhybridconnectivity.ServiceConfigurationsClientGetOptions) (resp azfake.Responder[armhybridconnectivity.ServiceConfigurationsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByEndpointResourcePager is the fake for method ServiceConfigurationsClient.NewListByEndpointResourcePager - // HTTP status codes to indicate success: http.StatusOK - NewListByEndpointResourcePager func(resourceURI string, endpointName string, options *armhybridconnectivity.ServiceConfigurationsClientListByEndpointResourceOptions) (resp azfake.PagerResponder[armhybridconnectivity.ServiceConfigurationsClientListByEndpointResourceResponse]) - - // Update is the fake for method ServiceConfigurationsClient.Update - // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, resourceURI string, endpointName string, serviceConfigurationName string, serviceConfigurationResource armhybridconnectivity.ServiceConfigurationResourcePatch, options *armhybridconnectivity.ServiceConfigurationsClientUpdateOptions) (resp azfake.Responder[armhybridconnectivity.ServiceConfigurationsClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewServiceConfigurationsServerTransport creates a new instance of ServiceConfigurationsServerTransport with the provided implementation. -// The returned ServiceConfigurationsServerTransport instance is connected to an instance of armhybridconnectivity.ServiceConfigurationsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewServiceConfigurationsServerTransport(srv *ServiceConfigurationsServer) *ServiceConfigurationsServerTransport { - return &ServiceConfigurationsServerTransport{ - srv: srv, - newListByEndpointResourcePager: newTracker[azfake.PagerResponder[armhybridconnectivity.ServiceConfigurationsClientListByEndpointResourceResponse]](), - } -} - -// ServiceConfigurationsServerTransport connects instances of armhybridconnectivity.ServiceConfigurationsClient to instances of ServiceConfigurationsServer. -// Don't use this type directly, use NewServiceConfigurationsServerTransport instead. -type ServiceConfigurationsServerTransport struct { - srv *ServiceConfigurationsServer - newListByEndpointResourcePager *tracker[azfake.PagerResponder[armhybridconnectivity.ServiceConfigurationsClientListByEndpointResourceResponse]] -} - -// Do implements the policy.Transporter interface for ServiceConfigurationsServerTransport. -func (s *ServiceConfigurationsServerTransport) 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 "ServiceConfigurationsClient.CreateOrupdate": - resp, err = s.dispatchCreateOrupdate(req) - case "ServiceConfigurationsClient.Delete": - resp, err = s.dispatchDelete(req) - case "ServiceConfigurationsClient.Get": - resp, err = s.dispatchGet(req) - case "ServiceConfigurationsClient.NewListByEndpointResourcePager": - resp, err = s.dispatchNewListByEndpointResourcePager(req) - case "ServiceConfigurationsClient.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 *ServiceConfigurationsServerTransport) dispatchCreateOrupdate(req *http.Request) (*http.Response, error) { - if s.srv.CreateOrupdate == nil { - return nil, &nonRetriableError{errors.New("fake for method CreateOrupdate not implemented")} - } - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/serviceConfigurations/(?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[armhybridconnectivity.ServiceConfigurationResource](req) - if err != nil { - return nil, err - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - endpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("endpointName")]) - if err != nil { - return nil, err - } - serviceConfigurationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("serviceConfigurationName")]) - if err != nil { - return nil, err - } - respr, errRespr := s.srv.CreateOrupdate(req.Context(), resourceURIParam, endpointNameParam, serviceConfigurationNameParam, 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).ServiceConfigurationResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (s *ServiceConfigurationsServerTransport) 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 = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/serviceConfigurations/(?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) - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - endpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("endpointName")]) - if err != nil { - return nil, err - } - serviceConfigurationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("serviceConfigurationName")]) - if err != nil { - return nil, err - } - respr, errRespr := s.srv.Delete(req.Context(), resourceURIParam, endpointNameParam, serviceConfigurationNameParam, 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 *ServiceConfigurationsServerTransport) 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 = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/serviceConfigurations/(?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) - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - endpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("endpointName")]) - if err != nil { - return nil, err - } - serviceConfigurationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("serviceConfigurationName")]) - if err != nil { - return nil, err - } - respr, errRespr := s.srv.Get(req.Context(), resourceURIParam, endpointNameParam, serviceConfigurationNameParam, 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).ServiceConfigurationResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (s *ServiceConfigurationsServerTransport) dispatchNewListByEndpointResourcePager(req *http.Request) (*http.Response, error) { - if s.srv.NewListByEndpointResourcePager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByEndpointResourcePager not implemented")} - } - newListByEndpointResourcePager := s.newListByEndpointResourcePager.get(req) - if newListByEndpointResourcePager == nil { - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/serviceConfigurations` - 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) - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - endpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("endpointName")]) - if err != nil { - return nil, err - } - resp := s.srv.NewListByEndpointResourcePager(resourceURIParam, endpointNameParam, nil) - newListByEndpointResourcePager = &resp - s.newListByEndpointResourcePager.add(req, newListByEndpointResourcePager) - server.PagerResponderInjectNextLinks(newListByEndpointResourcePager, req, func(page *armhybridconnectivity.ServiceConfigurationsClientListByEndpointResourceResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListByEndpointResourcePager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - s.newListByEndpointResourcePager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByEndpointResourcePager) { - s.newListByEndpointResourcePager.remove(req) - } - return resp, nil -} - -func (s *ServiceConfigurationsServerTransport) 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 = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/serviceConfigurations/(?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[armhybridconnectivity.ServiceConfigurationResourcePatch](req) - if err != nil { - return nil, err - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - endpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("endpointName")]) - if err != nil { - return nil, err - } - serviceConfigurationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("serviceConfigurationName")]) - if err != nil { - return nil, err - } - respr, errRespr := s.srv.Update(req.Context(), resourceURIParam, endpointNameParam, serviceConfigurationNameParam, 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).ServiceConfigurationResource, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/solutionconfigurations_server.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/solutionconfigurations_server.go new file mode 100644 index 000000000000..153f931b0d21 --- /dev/null +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/solutionconfigurations_server.go @@ -0,0 +1,346 @@ +// 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) Go Code Generator. DO NOT EDIT. + +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/hybridconnectivity/armhybridconnectivity/v2" + "net/http" + "net/url" + "regexp" +) + +// SolutionConfigurationsServer is a fake server for instances of the armhybridconnectivity.SolutionConfigurationsClient type. +type SolutionConfigurationsServer struct { + // CreateOrUpdate is the fake for method SolutionConfigurationsClient.CreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + CreateOrUpdate func(ctx context.Context, resourceURI string, solutionConfiguration string, resource armhybridconnectivity.SolutionConfiguration, options *armhybridconnectivity.SolutionConfigurationsClientCreateOrUpdateOptions) (resp azfake.Responder[armhybridconnectivity.SolutionConfigurationsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method SolutionConfigurationsClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceURI string, solutionConfiguration string, options *armhybridconnectivity.SolutionConfigurationsClientDeleteOptions) (resp azfake.Responder[armhybridconnectivity.SolutionConfigurationsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method SolutionConfigurationsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceURI string, solutionConfiguration string, options *armhybridconnectivity.SolutionConfigurationsClientGetOptions) (resp azfake.Responder[armhybridconnectivity.SolutionConfigurationsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method SolutionConfigurationsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceURI string, options *armhybridconnectivity.SolutionConfigurationsClientListOptions) (resp azfake.PagerResponder[armhybridconnectivity.SolutionConfigurationsClientListResponse]) + + // BeginSyncNow is the fake for method SolutionConfigurationsClient.BeginSyncNow + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginSyncNow func(ctx context.Context, resourceURI string, solutionConfiguration string, options *armhybridconnectivity.SolutionConfigurationsClientBeginSyncNowOptions) (resp azfake.PollerResponder[armhybridconnectivity.SolutionConfigurationsClientSyncNowResponse], errResp azfake.ErrorResponder) + + // Update is the fake for method SolutionConfigurationsClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceURI string, solutionConfiguration string, properties armhybridconnectivity.SolutionConfiguration, options *armhybridconnectivity.SolutionConfigurationsClientUpdateOptions) (resp azfake.Responder[armhybridconnectivity.SolutionConfigurationsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewSolutionConfigurationsServerTransport creates a new instance of SolutionConfigurationsServerTransport with the provided implementation. +// The returned SolutionConfigurationsServerTransport instance is connected to an instance of armhybridconnectivity.SolutionConfigurationsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSolutionConfigurationsServerTransport(srv *SolutionConfigurationsServer) *SolutionConfigurationsServerTransport { + return &SolutionConfigurationsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armhybridconnectivity.SolutionConfigurationsClientListResponse]](), + beginSyncNow: newTracker[azfake.PollerResponder[armhybridconnectivity.SolutionConfigurationsClientSyncNowResponse]](), + } +} + +// SolutionConfigurationsServerTransport connects instances of armhybridconnectivity.SolutionConfigurationsClient to instances of SolutionConfigurationsServer. +// Don't use this type directly, use NewSolutionConfigurationsServerTransport instead. +type SolutionConfigurationsServerTransport struct { + srv *SolutionConfigurationsServer + newListPager *tracker[azfake.PagerResponder[armhybridconnectivity.SolutionConfigurationsClientListResponse]] + beginSyncNow *tracker[azfake.PollerResponder[armhybridconnectivity.SolutionConfigurationsClientSyncNowResponse]] +} + +// Do implements the policy.Transporter interface for SolutionConfigurationsServerTransport. +func (s *SolutionConfigurationsServerTransport) 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")} + } + + return s.dispatchToMethodFake(req, method) +} + +func (s *SolutionConfigurationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if solutionConfigurationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = solutionConfigurationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SolutionConfigurationsClient.CreateOrUpdate": + res.resp, res.err = s.dispatchCreateOrUpdate(req) + case "SolutionConfigurationsClient.Delete": + res.resp, res.err = s.dispatchDelete(req) + case "SolutionConfigurationsClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "SolutionConfigurationsClient.NewListPager": + res.resp, res.err = s.dispatchNewListPager(req) + case "SolutionConfigurationsClient.BeginSyncNow": + res.resp, res.err = s.dispatchBeginSyncNow(req) + case "SolutionConfigurationsClient.Update": + res.resp, res.err = s.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (s *SolutionConfigurationsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { + if s.srv.CreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/solutionConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[armhybridconnectivity.SolutionConfiguration](req) + if err != nil { + return nil, err + } + resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) + if err != nil { + return nil, err + } + solutionConfigurationParam, err := url.PathUnescape(matches[regex.SubexpIndex("solutionConfiguration")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.CreateOrUpdate(req.Context(), resourceURIParam, solutionConfigurationParam, 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).SolutionConfiguration, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SolutionConfigurationsServerTransport) 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 = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/solutionConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) + if err != nil { + return nil, err + } + solutionConfigurationParam, err := url.PathUnescape(matches[regex.SubexpIndex("solutionConfiguration")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Delete(req.Context(), resourceURIParam, solutionConfigurationParam, 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 *SolutionConfigurationsServerTransport) 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 = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/solutionConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) + if err != nil { + return nil, err + } + solutionConfigurationParam, err := url.PathUnescape(matches[regex.SubexpIndex("solutionConfiguration")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), resourceURIParam, solutionConfigurationParam, 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).SolutionConfiguration, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SolutionConfigurationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := s.newListPager.get(req) + if newListPager == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/solutionConfigurations` + 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) + } + resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) + if err != nil { + return nil, err + } + resp := s.srv.NewListPager(resourceURIParam, nil) + newListPager = &resp + s.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armhybridconnectivity.SolutionConfigurationsClientListResponse, 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) { + s.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + s.newListPager.remove(req) + } + return resp, nil +} + +func (s *SolutionConfigurationsServerTransport) dispatchBeginSyncNow(req *http.Request) (*http.Response, error) { + if s.srv.BeginSyncNow == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginSyncNow not implemented")} + } + beginSyncNow := s.beginSyncNow.get(req) + if beginSyncNow == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/solutionConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/syncNow` + 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) + } + resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) + if err != nil { + return nil, err + } + solutionConfigurationParam, err := url.PathUnescape(matches[regex.SubexpIndex("solutionConfiguration")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginSyncNow(req.Context(), resourceURIParam, solutionConfigurationParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginSyncNow = &respr + s.beginSyncNow.add(req, beginSyncNow) + } + + resp, err := server.PollerResponderNext(beginSyncNow, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + s.beginSyncNow.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginSyncNow) { + s.beginSyncNow.remove(req) + } + + return resp, nil +} + +func (s *SolutionConfigurationsServerTransport) 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 = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/solutionConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[armhybridconnectivity.SolutionConfiguration](req) + if err != nil { + return nil, err + } + resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) + if err != nil { + return nil, err + } + solutionConfigurationParam, err := url.PathUnescape(matches[regex.SubexpIndex("solutionConfiguration")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Update(req.Context(), resourceURIParam, solutionConfigurationParam, 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).SolutionConfiguration, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to SolutionConfigurationsServerTransport +var solutionConfigurationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/solutiontypes_server.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/solutiontypes_server.go new file mode 100644 index 000000000000..903608c8da9a --- /dev/null +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/solutiontypes_server.go @@ -0,0 +1,210 @@ +// 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) Go Code Generator. DO NOT EDIT. + +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/hybridconnectivity/armhybridconnectivity/v2" + "net/http" + "net/url" + "regexp" +) + +// SolutionTypesServer is a fake server for instances of the armhybridconnectivity.SolutionTypesClient type. +type SolutionTypesServer struct { + // Get is the fake for method SolutionTypesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, solutionType string, options *armhybridconnectivity.SolutionTypesClientGetOptions) (resp azfake.Responder[armhybridconnectivity.SolutionTypesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method SolutionTypesClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armhybridconnectivity.SolutionTypesClientListByResourceGroupOptions) (resp azfake.PagerResponder[armhybridconnectivity.SolutionTypesClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method SolutionTypesClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armhybridconnectivity.SolutionTypesClientListBySubscriptionOptions) (resp azfake.PagerResponder[armhybridconnectivity.SolutionTypesClientListBySubscriptionResponse]) +} + +// NewSolutionTypesServerTransport creates a new instance of SolutionTypesServerTransport with the provided implementation. +// The returned SolutionTypesServerTransport instance is connected to an instance of armhybridconnectivity.SolutionTypesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSolutionTypesServerTransport(srv *SolutionTypesServer) *SolutionTypesServerTransport { + return &SolutionTypesServerTransport{ + srv: srv, + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armhybridconnectivity.SolutionTypesClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armhybridconnectivity.SolutionTypesClientListBySubscriptionResponse]](), + } +} + +// SolutionTypesServerTransport connects instances of armhybridconnectivity.SolutionTypesClient to instances of SolutionTypesServer. +// Don't use this type directly, use NewSolutionTypesServerTransport instead. +type SolutionTypesServerTransport struct { + srv *SolutionTypesServer + newListByResourceGroupPager *tracker[azfake.PagerResponder[armhybridconnectivity.SolutionTypesClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armhybridconnectivity.SolutionTypesClientListBySubscriptionResponse]] +} + +// Do implements the policy.Transporter interface for SolutionTypesServerTransport. +func (s *SolutionTypesServerTransport) 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")} + } + + return s.dispatchToMethodFake(req, method) +} + +func (s *SolutionTypesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if solutionTypesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = solutionTypesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SolutionTypesClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "SolutionTypesClient.NewListByResourceGroupPager": + res.resp, res.err = s.dispatchNewListByResourceGroupPager(req) + case "SolutionTypesClient.NewListBySubscriptionPager": + res.resp, res.err = s.dispatchNewListBySubscriptionPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (s *SolutionTypesServerTransport) 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\.HybridConnectivity/solutionTypes/(?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 + } + solutionTypeParam, err := url.PathUnescape(matches[regex.SubexpIndex("solutionType")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, solutionTypeParam, 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).SolutionTypeResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SolutionTypesServerTransport) 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\.HybridConnectivity/solutionTypes` + 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 *armhybridconnectivity.SolutionTypesClientListByResourceGroupResponse, 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 *SolutionTypesServerTransport) 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\.HybridConnectivity/solutionTypes` + 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 *armhybridconnectivity.SolutionTypesClientListBySubscriptionResponse, 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 +} + +// set this to conditionally intercept incoming requests to SolutionTypesServerTransport +var solutionTypesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/time_rfc3339.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/time_rfc3339.go index b0535a7b63e6..87ee11e83b32 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/time_rfc3339.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/time_rfc3339.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -19,12 +15,16 @@ import ( ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) type dateTimeRFC3339 time.Time @@ -40,17 +40,36 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) { } func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { + if len(data) == 0 { + return nil + } + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } @@ -61,6 +80,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error { return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return @@ -74,7 +97,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC3339 diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/generateawstemplate_client.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/generateawstemplate_client.go new file mode 100644 index 000000000000..76eba82d7603 --- /dev/null +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/generateawstemplate_client.go @@ -0,0 +1,100 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armhybridconnectivity + +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" +) + +// GenerateAwsTemplateClient contains the methods for the GenerateAwsTemplate group. +// Don't use this type directly, use NewGenerateAwsTemplateClient() instead. +type GenerateAwsTemplateClient struct { + internal *arm.Client + subscriptionID string +} + +// NewGenerateAwsTemplateClient creates a new instance of GenerateAwsTemplateClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewGenerateAwsTemplateClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GenerateAwsTemplateClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &GenerateAwsTemplateClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Post - Retrieve AWS Cloud Formation template +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-12-01 +// - generateAwsTemplateRequest - ConnectorId and SolutionTypes and their properties to Generate AWS CFT Template. +// - options - GenerateAwsTemplateClientPostOptions contains the optional parameters for the GenerateAwsTemplateClient.Post +// method. +func (client *GenerateAwsTemplateClient) Post(ctx context.Context, generateAwsTemplateRequest GenerateAwsTemplateRequest, options *GenerateAwsTemplateClientPostOptions) (GenerateAwsTemplateClientPostResponse, error) { + var err error + const operationName = "GenerateAwsTemplateClient.Post" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.postCreateRequest(ctx, generateAwsTemplateRequest, options) + if err != nil { + return GenerateAwsTemplateClientPostResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GenerateAwsTemplateClientPostResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return GenerateAwsTemplateClientPostResponse{}, err + } + resp, err := client.postHandleResponse(httpResp) + return resp, err +} + +// postCreateRequest creates the Post request. +func (client *GenerateAwsTemplateClient) postCreateRequest(ctx context.Context, generateAwsTemplateRequest GenerateAwsTemplateRequest, _ *GenerateAwsTemplateClientPostOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HybridConnectivity/generateAwsTemplate" + 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.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, generateAwsTemplateRequest); err != nil { + return nil, err + } + return req, nil +} + +// postHandleResponse handles the Post response. +func (client *GenerateAwsTemplateClient) postHandleResponse(resp *http.Response) (GenerateAwsTemplateClientPostResponse, error) { + result := GenerateAwsTemplateClientPostResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PostResponse); err != nil { + return GenerateAwsTemplateClientPostResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/generateawstemplate_client_example_test.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/generateawstemplate_client_example_test.go new file mode 100644 index 000000000000..f987419102f2 --- /dev/null +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/generateawstemplate_client_example_test.go @@ -0,0 +1,45 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armhybridconnectivity_test + +import ( + "context" + "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/hybridconnectivity/armhybridconnectivity/v2" + "log" +) + +// Generated from example definition: 2024-12-01/GenerateAwsTemplate_Post.json +func ExampleGenerateAwsTemplateClient_Post() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridconnectivity.NewClientFactory("5ACC4579-DB34-4C2F-8F8C-25061168F342", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewGenerateAwsTemplateClient().Post(ctx, armhybridconnectivity.GenerateAwsTemplateRequest{ + ConnectorID: to.Ptr("pnxcfjidglabnwxit"), + SolutionTypes: []*armhybridconnectivity.SolutionTypeSettings{ + { + SolutionType: to.Ptr("hjyownzpfxwiufmd"), + SolutionSettings: &armhybridconnectivity.SolutionSettings{}, + }, + }, + }, 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 = armhybridconnectivity.GenerateAwsTemplateClientPostResponse{ + // PostResponse: &armhybridconnectivity.PostResponse{ + // }, + // } +} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/go.mod b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/go.mod index ab785662b81f..bebcb8a9fdca 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/go.mod +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/go.mod @@ -1,9 +1,9 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/v2 go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 ) @@ -14,8 +14,8 @@ require ( github.com/google/uuid v1.6.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.25.0 // indirect - golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect - golang.org/x/text v0.16.0 // indirect + golang.org/x/crypto v0.27.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/text v0.18.0 // indirect ) diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/go.sum b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/go.sum index 09d275cb9a37..cbddbbd9ecec 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/go.sum +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/go.sum @@ -1,5 +1,5 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 h1:JZg6HRh6W6U4OLl6lk7BZ7BLisIzM9dG1R50zUk9C/M= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0/go.mod h1:YL1xnZ6QejvQHWJrX/AvhFl4WW4rqHVoKspWNVwFk0M= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= @@ -17,13 +17,13 @@ github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmd github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= -golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= -golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/inventory_client.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/inventory_client.go new file mode 100644 index 000000000000..44c273d7b0b8 --- /dev/null +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/inventory_client.go @@ -0,0 +1,157 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armhybridconnectivity + +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" +) + +// InventoryClient contains the methods for the Inventory group. +// Don't use this type directly, use NewInventoryClient() instead. +type InventoryClient struct { + internal *arm.Client +} + +// NewInventoryClient creates a new instance of InventoryClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewInventoryClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*InventoryClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &InventoryClient{ + internal: cl, + } + return client, nil +} + +// Get - Get a InventoryResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-12-01 +// - resourceURI - The fully qualified Azure Resource manager identifier of the resource. +// - solutionConfiguration - Represent Solution Configuration Resource. +// - inventoryID - Inventory resource +// - options - InventoryClientGetOptions contains the optional parameters for the InventoryClient.Get method. +func (client *InventoryClient) Get(ctx context.Context, resourceURI string, solutionConfiguration string, inventoryID string, options *InventoryClientGetOptions) (InventoryClientGetResponse, error) { + var err error + const operationName = "InventoryClient.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, resourceURI, solutionConfiguration, inventoryID, options) + if err != nil { + return InventoryClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return InventoryClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return InventoryClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *InventoryClient) getCreateRequest(ctx context.Context, resourceURI string, solutionConfiguration string, inventoryID string, _ *InventoryClientGetOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}/inventory/{inventoryId}" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + if solutionConfiguration == "" { + return nil, errors.New("parameter solutionConfiguration cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{solutionConfiguration}", url.PathEscape(solutionConfiguration)) + if inventoryID == "" { + return nil, errors.New("parameter inventoryID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{inventoryId}", url.PathEscape(inventoryID)) + 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", "2024-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *InventoryClient) getHandleResponse(resp *http.Response) (InventoryClientGetResponse, error) { + result := InventoryClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.InventoryResource); err != nil { + return InventoryClientGetResponse{}, err + } + return result, nil +} + +// NewListBySolutionConfigurationPager - List InventoryResource resources by SolutionConfiguration +// +// Generated from API version 2024-12-01 +// - resourceURI - The fully qualified Azure Resource manager identifier of the resource. +// - solutionConfiguration - Represent Solution Configuration Resource. +// - options - InventoryClientListBySolutionConfigurationOptions contains the optional parameters for the InventoryClient.NewListBySolutionConfigurationPager +// method. +func (client *InventoryClient) NewListBySolutionConfigurationPager(resourceURI string, solutionConfiguration string, options *InventoryClientListBySolutionConfigurationOptions) *runtime.Pager[InventoryClientListBySolutionConfigurationResponse] { + return runtime.NewPager(runtime.PagingHandler[InventoryClientListBySolutionConfigurationResponse]{ + More: func(page InventoryClientListBySolutionConfigurationResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *InventoryClientListBySolutionConfigurationResponse) (InventoryClientListBySolutionConfigurationResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "InventoryClient.NewListBySolutionConfigurationPager") + 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.listBySolutionConfigurationCreateRequest(ctx, resourceURI, solutionConfiguration, options) + }, nil) + if err != nil { + return InventoryClientListBySolutionConfigurationResponse{}, err + } + return client.listBySolutionConfigurationHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySolutionConfigurationCreateRequest creates the ListBySolutionConfiguration request. +func (client *InventoryClient) listBySolutionConfigurationCreateRequest(ctx context.Context, resourceURI string, solutionConfiguration string, _ *InventoryClientListBySolutionConfigurationOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}/inventory" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + if solutionConfiguration == "" { + return nil, errors.New("parameter solutionConfiguration cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{solutionConfiguration}", url.PathEscape(solutionConfiguration)) + 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", "2024-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySolutionConfigurationHandleResponse handles the ListBySolutionConfiguration response. +func (client *InventoryClient) listBySolutionConfigurationHandleResponse(resp *http.Response) (InventoryClientListBySolutionConfigurationResponse, error) { + result := InventoryClientListBySolutionConfigurationResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.InventoryResourceListResult); err != nil { + return InventoryClientListBySolutionConfigurationResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/inventory_client_example_test.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/inventory_client_example_test.go new file mode 100644 index 000000000000..580b829cba69 --- /dev/null +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/inventory_client_example_test.go @@ -0,0 +1,108 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armhybridconnectivity_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/v2" + "log" +) + +// Generated from example definition: 2024-12-01/Inventory_Get.json +func ExampleInventoryClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridconnectivity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewInventoryClient().Get(ctx, "ymuj", "zarfsraogroxlaqjjnwixtn", "xofprmcboosrbd", 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 = armhybridconnectivity.InventoryClientGetResponse{ + // InventoryResource: &armhybridconnectivity.InventoryResource{ + // Properties: &armhybridconnectivity.InventoryProperties{ + // CloudNativeType: to.Ptr(armhybridconnectivity.CloudNativeTypeEc2), + // CloudNativeResourceID: to.Ptr("ljnxclzxficxhdkr"), + // AzureResourceID: to.Ptr("ttzebbjzatugawuqxdupzmxkt"), + // Status: to.Ptr(armhybridconnectivity.SolutionConfigurationStatusNew), + // StatusDetails: to.Ptr("wxvnfzivtx"), + // ProvisioningState: to.Ptr(armhybridconnectivity.ResourceProvisioningStateSucceeded), + // }, + // ID: to.Ptr("/subscriptions/testSubcrptions/resourceGroups/testResourceGroup/providers/Microsoft.HybridConnectivity/SolutionConfigurations/qpwubemzmootxmtlxaerir/Inventory/xipjenocwvsqhhrplwmxwl"), + // Name: to.Ptr("xipjenocwvsqhhrplwmxwl"), + // Type: to.Ptr("jahwzrspsufypeouigsywjrx"), + // SystemData: &armhybridconnectivity.SystemData{ + // CreatedBy: to.Ptr("rpxzkcrobprrdvuoqxz"), + // CreatedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // LastModifiedBy: to.Ptr("jidegyskxi"), + // LastModifiedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2024-12-01/Inventory_ListBySolutionConfiguration.json +func ExampleInventoryClient_NewListBySolutionConfigurationPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridconnectivity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewInventoryClient().NewListBySolutionConfigurationPager("ymuj", "wsxt", 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 = armhybridconnectivity.InventoryClientListBySolutionConfigurationResponse{ + // InventoryResourceListResult: armhybridconnectivity.InventoryResourceListResult{ + // Value: []*armhybridconnectivity.InventoryResource{ + // { + // Properties: &armhybridconnectivity.InventoryProperties{ + // CloudNativeType: to.Ptr(armhybridconnectivity.CloudNativeTypeEc2), + // CloudNativeResourceID: to.Ptr("ljnxclzxficxhdkr"), + // AzureResourceID: to.Ptr("ttzebbjzatugawuqxdupzmxkt"), + // Status: to.Ptr(armhybridconnectivity.SolutionConfigurationStatusNew), + // StatusDetails: to.Ptr("wxvnfzivtx"), + // ProvisioningState: to.Ptr(armhybridconnectivity.ResourceProvisioningStateSucceeded), + // }, + // ID: to.Ptr("/subscriptions/testSubcrptions/resourceGroups/testResourceGroup/providers/Microsoft.HybridConnectivity/SolutionConfigurations/qpwubemzmootxmtlxaerir/Inventory/xipjenocwvsqhhrplwmxwl"), + // Name: to.Ptr("xipjenocwvsqhhrplwmxwl"), + // Type: to.Ptr("jahwzrspsufypeouigsywjrx"), + // SystemData: &armhybridconnectivity.SystemData{ + // CreatedBy: to.Ptr("rpxzkcrobprrdvuoqxz"), + // CreatedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // LastModifiedBy: to.Ptr("jidegyskxi"), + // LastModifiedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/models.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/models.go index f4d4786c2664..ac5c190c4836 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/models.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/models.go @@ -1,78 +1,36 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armhybridconnectivity import "time" -// AADProfileProperties - The AAD Profile -type AADProfileProperties struct { - // REQUIRED; The arc ingress gateway server app id. - ServerID *string - - // REQUIRED; The target resource home tenant id. - TenantID *string -} - -// EndpointAccessResource - The endpoint access for the target resource. -type EndpointAccessResource struct { - // Azure relay hybrid connection access properties - Relay *RelayNamespaceAccessProperties -} - -// EndpointProperties - Endpoint details -type EndpointProperties struct { - // REQUIRED; The type of endpoint. - Type *Type - - // The resource Id of the connectivity endpoint (optional). - ResourceID *string - - // READ-ONLY; The resource provisioning state. - ProvisioningState *string -} - -// EndpointResource - The endpoint for the target resource. -type EndpointResource struct { - // The endpoint properties. - Properties *EndpointProperties +// AwsCloudProfile - cloud profile for AWS. +type AwsCloudProfile struct { + // REQUIRED; Account id for the AWS account. + AccountID *string - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/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 + // List of AWS accounts which need to be excluded. + ExcludedAccounts []*string - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} - -// EndpointsList - The list of endpoints. -type EndpointsList struct { - // The link used to get the next page of endpoints list. - NextLink *string - - // The list of endpoint. - Value []*EndpointResource + // Boolean value that indicates whether the account is organizational or not. True represents organization account, whereas + // false represents a single account. + IsOrganizationalAccount *bool } // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { // READ-ONLY; The additional info. - Info any + Info *ErrorAdditionalInfoInfo // READ-ONLY; The additional info type. Type *string } +type ErrorAdditionalInfoInfo struct { +} + // ErrorDetail - The error detail. type ErrorDetail struct { // READ-ONLY; The error additional info. @@ -91,123 +49,110 @@ type ErrorDetail struct { Target *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 +// GenerateAwsTemplateRequest - ConnectorId and SolutionTypes and their properties to Generate AWS CFT Template. +type GenerateAwsTemplateRequest struct { + // REQUIRED; The name of public cloud connector + ConnectorID *string + + // The list of solution types and their settings + SolutionTypes []*SolutionTypeSettings } -// IngressGatewayResource - The ingress gateway access credentials -type IngressGatewayResource struct { - // Ingress gateway profile - Ingress *IngressProfileProperties +// InventoryProperties - Definition of inventory. +type InventoryProperties struct { + // Gets or sets the mapped azure resource id. + AzureResourceID *string - // Azure relay hybrid connection access properties - Relay *RelayNamespaceAccessProperties -} + // Gets or sets the cloud native resource name. + CloudNativeResourceID *string -// IngressProfileProperties - Ingress gateway profile -type IngressProfileProperties struct { - // REQUIRED; The AAD Profile - AADProfile *AADProfileProperties + // Gets or sets the cloud native resource type. + CloudNativeType *CloudNativeType - // REQUIRED; The ingress hostname. - Hostname *string -} + // Gets or sets the status of the inventory. + Status *SolutionConfigurationStatus -// ListCredentialsRequest - The details of the service for which credentials needs to be returned. -type ListCredentialsRequest struct { - // The name of the service. If not provided, the request will by pass the generation of service configuration token - ServiceName *ServiceName -} + // Gets or sets the status details. + StatusDetails *string -// ListIngressGatewayCredentialsRequest - Represent ListIngressGatewayCredentials Request object. -type ListIngressGatewayCredentialsRequest struct { - // The name of the service. - ServiceName *ServiceName + // READ-ONLY; The resource provisioning state. + ProvisioningState *ResourceProvisioningState } -// ManagedProxyRequest - Represent ManageProxy Request object. -type ManagedProxyRequest struct { - // REQUIRED; The name of the service. - Service *string +// InventoryResource - Concrete proxy resource types can be created by aliasing this type using a specific property type. +type InventoryResource struct { + // The resource-specific properties for this resource. + Properties *InventoryProperties - // The target host name. - Hostname *string + // READ-ONLY; Inventory resource + Name *string - // The name of the service. It is an optional property, if not provided, service configuration tokens issue code would be - // by passed. - ServiceName *ServiceName + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *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 } -// ManagedProxyResource - Managed Proxy -type ManagedProxyResource struct { - // REQUIRED; The expiration time of short lived proxy name in unix epoch. - ExpiresOn *int64 +// InventoryResourceListResult - The response of a InventoryResource list operation. +type InventoryResourceListResult struct { + // REQUIRED; The InventoryResource items on this page + Value []*InventoryResource - // REQUIRED; The short lived proxy name. - Proxy *string + // The link to the next page of items + NextLink *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 +// OperationStatusResult - The current status of an async operation. +type OperationStatusResult struct { + // REQUIRED; Operation status. + Status *string - // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - ActionType *ActionType + // The end time of the operation. + EndTime *time.Time - // 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 + // If present, details of the operation error. + Error *ErrorDetail - // 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 + // Fully qualified ID for the async operation. + ID *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 -} + // Name of the async operation. + Name *string -// 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 + // The operations list. + Operations []*OperationStatusResult - // 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 + // Percent of the operation that is complete. + PercentComplete *float64 - // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft - // Compute". - Provider *string + // The start time of the operation. + StartTime *time.Time +} - // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job - // Schedule Collections". - Resource *string +type PostResponse struct { } -// 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 +// PublicCloudConnector - Public Cloud Connector +type PublicCloudConnector struct { + // REQUIRED; The geo-location where the resource lives + Location *string - // READ-ONLY; List of operations supported by the resource provider - Value []*Operation -} + // The resource-specific properties for this resource. + Properties *PublicCloudConnectorProperties -// 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. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" - ID *string + // Resource tags. + Tags map[string]*string - // READ-ONLY; The name of the resource + // READ-ONLY; Represent public cloud connectors resource. Name *string + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData @@ -215,35 +160,41 @@ type ProxyResource struct { Type *string } -// RelayNamespaceAccessProperties - Azure relay hybrid connection access properties -type RelayNamespaceAccessProperties struct { - // REQUIRED; Azure Relay hybrid connection name for the resource. - HybridConnectionName *string +// PublicCloudConnectorListResult - The response of a PublicCloudConnector list operation. +type PublicCloudConnectorListResult struct { + // REQUIRED; The PublicCloudConnector items on this page + Value []*PublicCloudConnector - // REQUIRED; The namespace name. - NamespaceName *string + // The link to the next page of items + NextLink *string +} - // REQUIRED; The suffix domain name of relay namespace. - NamespaceNameSuffix *string +// PublicCloudConnectorProperties - Properties of public cloud connectors. +type PublicCloudConnectorProperties struct { + // REQUIRED; Cloud profile for AWS. + AwsCloudProfile *AwsCloudProfile - // The expiration of access key in unix time. - ExpiresOn *int64 + // REQUIRED; Host cloud the public cloud connector. + HostType *HostType - // The token to access the enabled service. - ServiceConfigurationToken *string + // READ-ONLY; Connector primary identifier. + ConnectorPrimaryIdentifier *string - // READ-ONLY; Access key for hybrid connection. - AccessKey *string + // READ-ONLY; The resource provisioning state. + ProvisioningState *ResourceProvisioningState } -// 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. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" - ID *string +// SolutionConfiguration - Solution Configuration +type SolutionConfiguration struct { + // The resource-specific properties for this resource. + Properties *SolutionConfigurationProperties - // READ-ONLY; The name of the resource + // READ-ONLY; Represent Solution Configuration Resource. Name *string + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData @@ -251,47 +202,67 @@ type Resource struct { Type *string } -// ServiceConfigurationList - The paginated list of serviceConfigurations -type ServiceConfigurationList struct { - // The link to fetch the next page of connected cluster - NextLink *string +// SolutionConfigurationListResult - The response of a SolutionConfiguration list operation. +type SolutionConfigurationListResult struct { + // REQUIRED; The SolutionConfiguration items on this page + Value []*SolutionConfiguration - // The list of service configuration - Value []*ServiceConfigurationResource + // The link to the next page of items + NextLink *string } -// ServiceConfigurationProperties - Service configuration details -type ServiceConfigurationProperties struct { - // REQUIRED; Name of the service. - ServiceName *ServiceName +// SolutionConfigurationProperties - Solution configuration resource. +type SolutionConfigurationProperties struct { + // REQUIRED; The type of the solution + SolutionType *string - // The port on which service is enabled. - Port *int64 + // Solution settings + SolutionSettings *SolutionSettings - // The resource Id of the connectivity endpoint (optional). - ResourceID *string + // READ-ONLY; The last time resources were inventoried + LastSyncTime *time.Time // READ-ONLY; The resource provisioning state. - ProvisioningState *ProvisioningState + ProvisioningState *ResourceProvisioningState + + // READ-ONLY; The status of solution configurations + Status *SolutionConfigurationStatus + + // READ-ONLY; The detailed message of status details + StatusDetails *string } -// ServiceConfigurationPropertiesPatch - Service configuration details -type ServiceConfigurationPropertiesPatch struct { - // The port on which service is enabled. - Port *int64 +// SolutionSettings - Solution settings +type SolutionSettings struct { + AdditionalProperties map[string]*string } -// ServiceConfigurationResource - The service configuration details associated with the target resource. -type ServiceConfigurationResource struct { - // The service configuration properties. - Properties *ServiceConfigurationProperties +// SolutionTypeProperties - Definition of Solution type resource. +type SolutionTypeProperties struct { + // Short description of solution type. + Description *string - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" - ID *string + // Array of solution settings and its description. + SolutionSettings []*SolutionTypeSettingsProperties - // READ-ONLY; The name of the resource + // The name of the solution type. + SolutionType *string + + // The locations this solution is supported in. + SupportedAzureRegions []*string +} + +// SolutionTypeResource - Concrete proxy resource types can be created by aliasing this type using a specific property type. +type SolutionTypeResource struct { + // The resource-specific properties for this resource. + Properties *SolutionTypeProperties + + // READ-ONLY; Solution Type resource Name *string + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData @@ -299,10 +270,43 @@ type ServiceConfigurationResource struct { Type *string } -// ServiceConfigurationResourcePatch - The service details under service configuration for the target endpoint resource. -type ServiceConfigurationResourcePatch struct { - // The service configuration properties. - Properties *ServiceConfigurationPropertiesPatch +// SolutionTypeResourceListResult - The response of a SolutionTypeResource list operation. +type SolutionTypeResourceListResult struct { + // REQUIRED; The SolutionTypeResource items on this page + Value []*SolutionTypeResource + + // The link to the next page of items + NextLink *string +} + +// SolutionTypeSettings - The properties of Solution Type +type SolutionTypeSettings struct { + // REQUIRED; The type of the solution + SolutionType *string + + // Solution settings + SolutionSettings *SolutionSettings +} + +// SolutionTypeSettingsProperties - Represent Solution settings properties description array. +type SolutionTypeSettingsProperties struct { + // REQUIRED; Array of allowed values for this solution settings property. + AllowedValues []*string + + // REQUIRED; Default value for this solution settings property. + DefaultValue *string + + // REQUIRED; Description of solution setting property. + Description *string + + // REQUIRED; The UI friendly name of the solution setting property. + DisplayName *string + + // REQUIRED; The name of the solution setting property. + Name *string + + // REQUIRED; Type of the solution setting property, represented as a string. + Type *string } // SystemData - Metadata pertaining to creation and last modification of the resource. diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/models_serde.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/models_serde.go index 90a6217fa5f1..8efd3836ed69 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/models_serde.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/models_serde.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armhybridconnectivity @@ -15,16 +11,17 @@ import ( "reflect" ) -// MarshalJSON implements the json.Marshaller interface for type AADProfileProperties. -func (a AADProfileProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AwsCloudProfile. +func (a AwsCloudProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "serverId", a.ServerID) - populate(objectMap, "tenantId", a.TenantID) + populate(objectMap, "accountId", a.AccountID) + populate(objectMap, "excludedAccounts", a.ExcludedAccounts) + populate(objectMap, "isOrganizationalAccount", a.IsOrganizationalAccount) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AADProfileProperties. -func (a *AADProfileProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AwsCloudProfile. +func (a *AwsCloudProfile) UnmarshalJSON(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) @@ -32,151 +29,18 @@ func (a *AADProfileProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "serverId": - err = unpopulate(val, "ServerID", &a.ServerID) - delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &a.TenantID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EndpointAccessResource. -func (e EndpointAccessResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "relay", e.Relay) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointAccessResource. -func (e *EndpointAccessResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "relay": - err = unpopulate(val, "Relay", &e.Relay) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EndpointProperties. -func (e EndpointProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "provisioningState", e.ProvisioningState) - populate(objectMap, "resourceId", e.ResourceID) - populate(objectMap, "type", e.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointProperties. -func (e *EndpointProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) - delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, "ResourceID", &e.ResourceID) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EndpointResource. -func (e EndpointResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", e.ID) - populate(objectMap, "name", e.Name) - populate(objectMap, "properties", e.Properties) - populate(objectMap, "systemData", e.SystemData) - populate(objectMap, "type", e.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointResource. -func (e *EndpointResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &e.ID) + case "accountId": + err = unpopulate(val, "AccountID", &a.AccountID) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &e.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &e.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &e.SystemData) + case "excludedAccounts": + err = unpopulate(val, "ExcludedAccounts", &a.ExcludedAccounts) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) + case "isOrganizationalAccount": + err = unpopulate(val, "IsOrganizationalAccount", &a.IsOrganizationalAccount) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EndpointsList. -func (e EndpointsList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", e.NextLink) - populate(objectMap, "value", e.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointsList. -func (e *EndpointsList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - 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", &e.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &e.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil @@ -185,7 +49,7 @@ func (e *EndpointsList) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateAny(objectMap, "info", e.Info) + populate(objectMap, "info", e.Info) populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } @@ -256,43 +120,51 @@ func (e *ErrorDetail) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. -func (e ErrorResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GenerateAwsTemplateRequest. +func (g GenerateAwsTemplateRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "error", e.Error) + populate(objectMap, "connectorId", g.ConnectorID) + populate(objectMap, "solutionTypes", g.SolutionTypes) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. -func (e *ErrorResponse) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GenerateAwsTemplateRequest. +func (g *GenerateAwsTemplateRequest) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "error": - err = unpopulate(val, "Error", &e.Error) + case "connectorId": + err = unpopulate(val, "ConnectorID", &g.ConnectorID) + delete(rawMsg, key) + case "solutionTypes": + err = unpopulate(val, "SolutionTypes", &g.SolutionTypes) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type IngressGatewayResource. -func (i IngressGatewayResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type InventoryProperties. +func (i InventoryProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "ingress", i.Ingress) - populate(objectMap, "relay", i.Relay) + populate(objectMap, "azureResourceId", i.AzureResourceID) + populate(objectMap, "cloudNativeResourceId", i.CloudNativeResourceID) + populate(objectMap, "cloudNativeType", i.CloudNativeType) + populate(objectMap, "provisioningState", i.ProvisioningState) + populate(objectMap, "status", i.Status) + populate(objectMap, "statusDetails", i.StatusDetails) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type IngressGatewayResource. -func (i *IngressGatewayResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type InventoryProperties. +func (i *InventoryProperties) UnmarshalJSON(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) @@ -300,11 +172,23 @@ func (i *IngressGatewayResource) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "ingress": - err = unpopulate(val, "Ingress", &i.Ingress) + case "azureResourceId": + err = unpopulate(val, "AzureResourceID", &i.AzureResourceID) + delete(rawMsg, key) + case "cloudNativeResourceId": + err = unpopulate(val, "CloudNativeResourceID", &i.CloudNativeResourceID) + delete(rawMsg, key) + case "cloudNativeType": + err = unpopulate(val, "CloudNativeType", &i.CloudNativeType) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &i.ProvisioningState) delete(rawMsg, key) - case "relay": - err = unpopulate(val, "Relay", &i.Relay) + case "status": + err = unpopulate(val, "Status", &i.Status) + delete(rawMsg, key) + case "statusDetails": + err = unpopulate(val, "StatusDetails", &i.StatusDetails) delete(rawMsg, key) } if err != nil { @@ -314,16 +198,19 @@ func (i *IngressGatewayResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type IngressProfileProperties. -func (i IngressProfileProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type InventoryResource. +func (i InventoryResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "aadProfile", i.AADProfile) - populate(objectMap, "hostname", i.Hostname) + 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 IngressProfileProperties. -func (i *IngressProfileProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type InventoryResource. +func (i *InventoryResource) UnmarshalJSON(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) @@ -331,11 +218,20 @@ func (i *IngressProfileProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "aadProfile": - err = unpopulate(val, "AADProfile", &i.AADProfile) + 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 "hostname": - err = unpopulate(val, "Hostname", &i.Hostname) + 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 { @@ -345,374 +241,424 @@ func (i *IngressProfileProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ListCredentialsRequest. -func (l ListCredentialsRequest) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type InventoryResourceListResult. +func (i InventoryResourceListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "serviceName", l.ServiceName) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ListCredentialsRequest. -func (l *ListCredentialsRequest) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type InventoryResourceListResult. +func (i *InventoryResourceListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "serviceName": - err = unpopulate(val, "ServiceName", &l.ServiceName) + 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", l, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ListIngressGatewayCredentialsRequest. -func (l ListIngressGatewayCredentialsRequest) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationStatusResult. +func (o OperationStatusResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "serviceName", l.ServiceName) + populateDateTimeRFC3339(objectMap, "endTime", o.EndTime) + populate(objectMap, "error", o.Error) + populate(objectMap, "id", o.ID) + populate(objectMap, "name", o.Name) + populate(objectMap, "operations", o.Operations) + populate(objectMap, "percentComplete", o.PercentComplete) + populateDateTimeRFC3339(objectMap, "startTime", o.StartTime) + populate(objectMap, "status", o.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ListIngressGatewayCredentialsRequest. -func (l *ListIngressGatewayCredentialsRequest) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatusResult. +func (o *OperationStatusResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "serviceName": - err = unpopulate(val, "ServiceName", &l.ServiceName) + case "endTime": + err = unpopulateDateTimeRFC3339(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 "operations": + err = unpopulate(val, "Operations", &o.Operations) + delete(rawMsg, key) + case "percentComplete": + err = unpopulate(val, "PercentComplete", &o.PercentComplete) + delete(rawMsg, key) + case "startTime": + err = unpopulateDateTimeRFC3339(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", l, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ManagedProxyRequest. -func (m ManagedProxyRequest) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PublicCloudConnector. +func (p PublicCloudConnector) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "hostname", m.Hostname) - populate(objectMap, "service", m.Service) - populate(objectMap, "serviceName", m.ServiceName) + populate(objectMap, "id", p.ID) + populate(objectMap, "location", p.Location) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "tags", p.Tags) + populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedProxyRequest. -func (m *ManagedProxyRequest) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PublicCloudConnector. +func (p *PublicCloudConnector) UnmarshalJSON(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", p, err) } for key, val := range rawMsg { var err error switch key { - case "hostname": - err = unpopulate(val, "Hostname", &m.Hostname) + case "id": + err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) - case "service": - err = unpopulate(val, "Service", &m.Service) + case "location": + err = unpopulate(val, "Location", &p.Location) delete(rawMsg, key) - case "serviceName": - err = unpopulate(val, "ServiceName", &m.ServiceName) + 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 "tags": + err = unpopulate(val, "Tags", &p.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ManagedProxyResource. -func (m ManagedProxyResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PublicCloudConnectorListResult. +func (p PublicCloudConnectorListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "expiresOn", m.ExpiresOn) - populate(objectMap, "proxy", m.Proxy) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedProxyResource. -func (m *ManagedProxyResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PublicCloudConnectorListResult. +func (p *PublicCloudConnectorListResult) UnmarshalJSON(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", p, err) } for key, val := range rawMsg { var err error switch key { - case "expiresOn": - err = unpopulate(val, "ExpiresOn", &m.ExpiresOn) + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) delete(rawMsg, key) - case "proxy": - err = unpopulate(val, "Proxy", &m.Proxy) + case "value": + err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", p, 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 PublicCloudConnectorProperties. +func (p PublicCloudConnectorProperties) 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) + populate(objectMap, "awsCloudProfile", p.AwsCloudProfile) + populate(objectMap, "connectorPrimaryIdentifier", p.ConnectorPrimaryIdentifier) + populate(objectMap, "hostType", p.HostType) + populate(objectMap, "provisioningState", p.ProvisioningState) 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 PublicCloudConnectorProperties. +func (p *PublicCloudConnectorProperties) UnmarshalJSON(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", p, err) } for key, val := range rawMsg { var err error switch key { - case "actionType": - err = unpopulate(val, "ActionType", &o.ActionType) + case "awsCloudProfile": + err = unpopulate(val, "AwsCloudProfile", &p.AwsCloudProfile) delete(rawMsg, key) - case "display": - err = unpopulate(val, "Display", &o.Display) + case "connectorPrimaryIdentifier": + err = unpopulate(val, "ConnectorPrimaryIdentifier", &p.ConnectorPrimaryIdentifier) delete(rawMsg, key) - case "isDataAction": - err = unpopulate(val, "IsDataAction", &o.IsDataAction) + case "hostType": + err = unpopulate(val, "HostType", &p.HostType) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) - delete(rawMsg, key) - case "origin": - err = unpopulate(val, "Origin", &o.Origin) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, 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 SolutionConfiguration. +func (s SolutionConfiguration) 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, "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 OperationDisplay. -func (o *OperationDisplay) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SolutionConfiguration. +func (s *SolutionConfiguration) UnmarshalJSON(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", s, err) } for key, val := range rawMsg { var err error switch key { - case "description": - err = unpopulate(val, "Description", &o.Description) + case "id": + err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) - case "operation": - err = unpopulate(val, "Operation", &o.Operation) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) - case "provider": - err = unpopulate(val, "Provider", &o.Provider) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) delete(rawMsg, key) - case "resource": - err = unpopulate(val, "Resource", &o.Resource) + case "type": + err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationListResult. -func (o OperationListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SolutionConfigurationListResult. +func (s SolutionConfigurationListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", o.NextLink) - populate(objectMap, "value", o.Value) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. -func (o *OperationListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SolutionConfigurationListResult. +func (s *SolutionConfigurationListResult) UnmarshalJSON(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", s, err) } for key, val := range rawMsg { var err error switch key { case "nextLink": - err = unpopulate(val, "NextLink", &o.NextLink) + err = unpopulate(val, "NextLink", &s.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &o.Value) + err = unpopulate(val, "Value", &s.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ProxyResource. -func (p ProxyResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SolutionConfigurationProperties. +func (s SolutionConfigurationProperties) 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) + populateDateTimeRFC3339(objectMap, "lastSyncTime", s.LastSyncTime) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "solutionSettings", s.SolutionSettings) + populate(objectMap, "solutionType", s.SolutionType) + populate(objectMap, "status", s.Status) + populate(objectMap, "statusDetails", s.StatusDetails) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource. -func (p *ProxyResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SolutionConfigurationProperties. +func (s *SolutionConfigurationProperties) UnmarshalJSON(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", s, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) + case "lastSyncTime": + err = unpopulateDateTimeRFC3339(val, "LastSyncTime", &s.LastSyncTime) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &p.SystemData) + case "solutionSettings": + err = unpopulate(val, "SolutionSettings", &s.SolutionSettings) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) + case "solutionType": + err = unpopulate(val, "SolutionType", &s.SolutionType) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &s.Status) + delete(rawMsg, key) + case "statusDetails": + err = unpopulate(val, "StatusDetails", &s.StatusDetails) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RelayNamespaceAccessProperties. -func (r RelayNamespaceAccessProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SolutionSettings. +func (s SolutionSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "accessKey", r.AccessKey) - populate(objectMap, "expiresOn", r.ExpiresOn) - populate(objectMap, "hybridConnectionName", r.HybridConnectionName) - populate(objectMap, "namespaceName", r.NamespaceName) - populate(objectMap, "namespaceNameSuffix", r.NamespaceNameSuffix) - populate(objectMap, "serviceConfigurationToken", r.ServiceConfigurationToken) + if s.AdditionalProperties != nil { + for key, val := range s.AdditionalProperties { + objectMap[key] = val + } + } return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RelayNamespaceAccessProperties. -func (r *RelayNamespaceAccessProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SolutionSettings. +func (s *SolutionSettings) UnmarshalJSON(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", s, err) } for key, val := range rawMsg { var err error switch key { - case "accessKey": - err = unpopulate(val, "AccessKey", &r.AccessKey) - delete(rawMsg, key) - case "expiresOn": - err = unpopulate(val, "ExpiresOn", &r.ExpiresOn) - delete(rawMsg, key) - case "hybridConnectionName": - err = unpopulate(val, "HybridConnectionName", &r.HybridConnectionName) - delete(rawMsg, key) - case "namespaceName": - err = unpopulate(val, "NamespaceName", &r.NamespaceName) - delete(rawMsg, key) - case "namespaceNameSuffix": - err = unpopulate(val, "NamespaceNameSuffix", &r.NamespaceNameSuffix) - delete(rawMsg, key) - case "serviceConfigurationToken": - err = unpopulate(val, "ServiceConfigurationToken", &r.ServiceConfigurationToken) + default: + if s.AdditionalProperties == nil { + s.AdditionalProperties = map[string]*string{} + } + if val != nil { + var aux string + err = json.Unmarshal(val, &aux) + s.AdditionalProperties[key] = &aux + } delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Resource. -func (r Resource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SolutionTypeProperties. +func (s SolutionTypeProperties) 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) + populate(objectMap, "description", s.Description) + populate(objectMap, "solutionSettings", s.SolutionSettings) + populate(objectMap, "solutionType", s.SolutionType) + populate(objectMap, "supportedAzureRegions", s.SupportedAzureRegions) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. -func (r *Resource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SolutionTypeProperties. +func (s *SolutionTypeProperties) UnmarshalJSON(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", s, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) + case "description": + err = unpopulate(val, "Description", &s.Description) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) + case "solutionSettings": + err = unpopulate(val, "SolutionSettings", &s.SolutionSettings) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &r.SystemData) + case "solutionType": + err = unpopulate(val, "SolutionType", &s.SolutionType) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) + case "supportedAzureRegions": + err = unpopulate(val, "SupportedAzureRegions", &s.SupportedAzureRegions) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ServiceConfigurationList. -func (s ServiceConfigurationList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SolutionTypeResource. +func (s SolutionTypeResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", s.NextLink) - populate(objectMap, "value", s.Value) + 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 ServiceConfigurationList. -func (s *ServiceConfigurationList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SolutionTypeResource. +func (s *SolutionTypeResource) UnmarshalJSON(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) @@ -720,11 +666,20 @@ func (s *ServiceConfigurationList) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &s.NextLink) + case "id": + err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &s.Value) + 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 { @@ -734,18 +689,16 @@ func (s *ServiceConfigurationList) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServiceConfigurationProperties. -func (s ServiceConfigurationProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SolutionTypeResourceListResult. +func (s SolutionTypeResourceListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "port", s.Port) - populate(objectMap, "provisioningState", s.ProvisioningState) - populate(objectMap, "resourceId", s.ResourceID) - populate(objectMap, "serviceName", s.ServiceName) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceConfigurationProperties. -func (s *ServiceConfigurationProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SolutionTypeResourceListResult. +func (s *SolutionTypeResourceListResult) UnmarshalJSON(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) @@ -753,17 +706,11 @@ func (s *ServiceConfigurationProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "port": - err = unpopulate(val, "Port", &s.Port) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) - delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, "ResourceID", &s.ResourceID) + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) delete(rawMsg, key) - case "serviceName": - err = unpopulate(val, "ServiceName", &s.ServiceName) + case "value": + err = unpopulate(val, "Value", &s.Value) delete(rawMsg, key) } if err != nil { @@ -773,15 +720,16 @@ func (s *ServiceConfigurationProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServiceConfigurationPropertiesPatch. -func (s ServiceConfigurationPropertiesPatch) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SolutionTypeSettings. +func (s SolutionTypeSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "port", s.Port) + populate(objectMap, "solutionSettings", s.SolutionSettings) + populate(objectMap, "solutionType", s.SolutionType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceConfigurationPropertiesPatch. -func (s *ServiceConfigurationPropertiesPatch) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SolutionTypeSettings. +func (s *SolutionTypeSettings) UnmarshalJSON(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) @@ -789,8 +737,11 @@ func (s *ServiceConfigurationPropertiesPatch) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "port": - err = unpopulate(val, "Port", &s.Port) + case "solutionSettings": + err = unpopulate(val, "SolutionSettings", &s.SolutionSettings) + delete(rawMsg, key) + case "solutionType": + err = unpopulate(val, "SolutionType", &s.SolutionType) delete(rawMsg, key) } if err != nil { @@ -800,19 +751,20 @@ func (s *ServiceConfigurationPropertiesPatch) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServiceConfigurationResource. -func (s ServiceConfigurationResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SolutionTypeSettingsProperties. +func (s SolutionTypeSettingsProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", s.ID) + populate(objectMap, "allowedValues", s.AllowedValues) + populate(objectMap, "defaultValue", s.DefaultValue) + populate(objectMap, "description", s.Description) + populate(objectMap, "displayName", s.DisplayName) 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 ServiceConfigurationResource. -func (s *ServiceConfigurationResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SolutionTypeSettingsProperties. +func (s *SolutionTypeSettingsProperties) UnmarshalJSON(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) @@ -820,17 +772,20 @@ func (s *ServiceConfigurationResource) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) + case "allowedValues": + err = unpopulate(val, "AllowedValues", &s.AllowedValues) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) + case "defaultValue": + err = unpopulate(val, "DefaultValue", &s.DefaultValue) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) + case "description": + err = unpopulate(val, "Description", &s.Description) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &s.SystemData) + case "displayName": + err = unpopulate(val, "DisplayName", &s.DisplayName) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &s.Type) @@ -843,33 +798,6 @@ func (s *ServiceConfigurationResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServiceConfigurationResourcePatch. -func (s ServiceConfigurationResourcePatch) 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 ServiceConfigurationResourcePatch. -func (s *ServiceConfigurationResourcePatch) UnmarshalJSON(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 SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -927,18 +855,8 @@ func populate(m map[string]any, k string, v any) { } } -func populateAny(m map[string]any, k string, v any) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else { - m[k] = v - } -} - func unpopulate(data json.RawMessage, fn string, v any) error { - if data == nil { + if data == nil || string(data) == "null" { return nil } if err := json.Unmarshal(data, v); err != nil { diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/operations_client_example_test.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/operations_client_example_test.go deleted file mode 100644 index c6b38498e358..000000000000 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/operations_client_example_test.go +++ /dev/null @@ -1,126 +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 armhybridconnectivity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/OperationsList.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 := armhybridconnectivity.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.OperationListResult = armhybridconnectivity.OperationListResult{ - // Value: []*armhybridconnectivity.Operation{ - // { - // Name: to.Ptr("Microsoft.HybridConnectivity/operations/read"), - // Display: &armhybridconnectivity.OperationDisplay{ - // Description: to.Ptr("Get the list of Operations"), - // Operation: to.Ptr("Get operations"), - // Provider: to.Ptr("Microsoft.HybridConnectivity"), - // Resource: to.Ptr("Operations"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.HybridConnectivity/endpoints/read"), - // Display: &armhybridconnectivity.OperationDisplay{ - // Description: to.Ptr("Get or list of endpoints to the target resource."), - // Operation: to.Ptr("Get/List endpoints"), - // Provider: to.Ptr("Microsoft.HybridConnectivity"), - // Resource: to.Ptr("endpoints"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.HybridConnectivity/endpoints/write"), - // Display: &armhybridconnectivity.OperationDisplay{ - // Description: to.Ptr("Create or update the endpoint to the target resource."), - // Operation: to.Ptr("Create/Update endpoint"), - // Provider: to.Ptr("Microsoft.HybridConnectivity"), - // Resource: to.Ptr("endpoints"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.HybridConnectivity/endpoints/delete"), - // Display: &armhybridconnectivity.OperationDisplay{ - // Description: to.Ptr("Deletes the endpoint access to the target resource."), - // Operation: to.Ptr("Delete endpoint"), - // Provider: to.Ptr("Microsoft.HybridConnectivity"), - // Resource: to.Ptr("endpoints"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.HybridConnectivity/endpoints/listCredentials/action"), - // Display: &armhybridconnectivity.OperationDisplay{ - // Description: to.Ptr("List the endpoint access credentials to the resource."), - // Operation: to.Ptr("List credentials for endpoint access"), - // Provider: to.Ptr("Microsoft.HybridConnectivity"), - // Resource: to.Ptr("endpoints"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.HybridConnectivity/endpoints/listIngressGatewayCredentials/action"), - // Display: &armhybridconnectivity.OperationDisplay{ - // Description: to.Ptr("List the ingress gateway credentials to the resource."), - // Operation: to.Ptr("List credentials for ingress gateway"), - // Provider: to.Ptr("Microsoft.HybridConnectivity"), - // Resource: to.Ptr("endpoints"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.HybridConnectivity/register/action"), - // Display: &armhybridconnectivity.OperationDisplay{ - // Description: to.Ptr("Register the subscription for Microsoft.HybridConnectivity"), - // Operation: to.Ptr("Register the Microsoft.HybridConnectivity"), - // Provider: to.Ptr("Microsoft.HybridConnectivity"), - // Resource: to.Ptr("Microsoft.HybridConnectivity"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.HybridConnectivity/unregister/action"), - // Display: &armhybridconnectivity.OperationDisplay{ - // Description: to.Ptr("Unregister the subscription for Microsoft.HybridConnectivity"), - // Operation: to.Ptr("Unregister the Microsoft.HybridConnectivity"), - // Provider: to.Ptr("Microsoft.HybridConnectivity"), - // Resource: to.Ptr("Microsoft.HybridConnectivity"), - // }, - // IsDataAction: to.Ptr(false), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/options.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/options.go index 9ea1b3fdaa4a..0f314024cec9 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/options.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/options.go @@ -1,91 +1,115 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armhybridconnectivity -// EndpointsClientCreateOrUpdateOptions contains the optional parameters for the EndpointsClient.CreateOrUpdate method. -type EndpointsClientCreateOrUpdateOptions struct { +// GenerateAwsTemplateClientPostOptions contains the optional parameters for the GenerateAwsTemplateClient.Post method. +type GenerateAwsTemplateClientPostOptions struct { // placeholder for future optional parameters } -// EndpointsClientDeleteOptions contains the optional parameters for the EndpointsClient.Delete method. -type EndpointsClientDeleteOptions struct { +// InventoryClientGetOptions contains the optional parameters for the InventoryClient.Get method. +type InventoryClientGetOptions struct { // placeholder for future optional parameters } -// EndpointsClientGetOptions contains the optional parameters for the EndpointsClient.Get method. -type EndpointsClientGetOptions struct { +// InventoryClientListBySolutionConfigurationOptions contains the optional parameters for the InventoryClient.NewListBySolutionConfigurationPager +// method. +type InventoryClientListBySolutionConfigurationOptions struct { // placeholder for future optional parameters } -// EndpointsClientListCredentialsOptions contains the optional parameters for the EndpointsClient.ListCredentials method. -type EndpointsClientListCredentialsOptions struct { - // The is how long the endpoint access token is valid (in seconds). - Expiresin *int64 - - // Object of type ListCredentialsRequest - ListCredentialsRequest *ListCredentialsRequest +// PublicCloudConnectorsClientBeginCreateOrUpdateOptions contains the optional parameters for the PublicCloudConnectorsClient.BeginCreateOrUpdate +// method. +type PublicCloudConnectorsClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string } -// EndpointsClientListIngressGatewayCredentialsOptions contains the optional parameters for the EndpointsClient.ListIngressGatewayCredentials +// PublicCloudConnectorsClientBeginTestPermissionsOptions contains the optional parameters for the PublicCloudConnectorsClient.BeginTestPermissions // method. -type EndpointsClientListIngressGatewayCredentialsOptions struct { - // The is how long the endpoint access token is valid (in seconds). - Expiresin *int64 +type PublicCloudConnectorsClientBeginTestPermissionsOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// PublicCloudConnectorsClientDeleteOptions contains the optional parameters for the PublicCloudConnectorsClient.Delete method. +type PublicCloudConnectorsClientDeleteOptions struct { + // placeholder for future optional parameters +} - // Object of type ListIngressGatewayCredentialsRequest - ListIngressGatewayCredentialsRequest *ListIngressGatewayCredentialsRequest +// PublicCloudConnectorsClientGetOptions contains the optional parameters for the PublicCloudConnectorsClient.Get method. +type PublicCloudConnectorsClientGetOptions struct { + // placeholder for future optional parameters } -// EndpointsClientListManagedProxyDetailsOptions contains the optional parameters for the EndpointsClient.ListManagedProxyDetails +// PublicCloudConnectorsClientListByResourceGroupOptions contains the optional parameters for the PublicCloudConnectorsClient.NewListByResourceGroupPager // method. -type EndpointsClientListManagedProxyDetailsOptions struct { +type PublicCloudConnectorsClientListByResourceGroupOptions struct { // placeholder for future optional parameters } -// EndpointsClientListOptions contains the optional parameters for the EndpointsClient.NewListPager method. -type EndpointsClientListOptions struct { +// PublicCloudConnectorsClientListBySubscriptionOptions contains the optional parameters for the PublicCloudConnectorsClient.NewListBySubscriptionPager +// method. +type PublicCloudConnectorsClientListBySubscriptionOptions struct { // placeholder for future optional parameters } -// EndpointsClientUpdateOptions contains the optional parameters for the EndpointsClient.Update method. -type EndpointsClientUpdateOptions struct { +// PublicCloudConnectorsClientUpdateOptions contains the optional parameters for the PublicCloudConnectorsClient.Update method. +type PublicCloudConnectorsClientUpdateOptions struct { // placeholder for future optional parameters } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -type OperationsClientListOptions struct { +// SolutionConfigurationsClientBeginSyncNowOptions contains the optional parameters for the SolutionConfigurationsClient.BeginSyncNow +// method. +type SolutionConfigurationsClientBeginSyncNowOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// SolutionConfigurationsClientCreateOrUpdateOptions contains the optional parameters for the SolutionConfigurationsClient.CreateOrUpdate +// method. +type SolutionConfigurationsClientCreateOrUpdateOptions struct { // placeholder for future optional parameters } -// ServiceConfigurationsClientCreateOrupdateOptions contains the optional parameters for the ServiceConfigurationsClient.CreateOrupdate +// SolutionConfigurationsClientDeleteOptions contains the optional parameters for the SolutionConfigurationsClient.Delete // method. -type ServiceConfigurationsClientCreateOrupdateOptions struct { +type SolutionConfigurationsClientDeleteOptions struct { // placeholder for future optional parameters } -// ServiceConfigurationsClientDeleteOptions contains the optional parameters for the ServiceConfigurationsClient.Delete method. -type ServiceConfigurationsClientDeleteOptions struct { +// SolutionConfigurationsClientGetOptions contains the optional parameters for the SolutionConfigurationsClient.Get method. +type SolutionConfigurationsClientGetOptions struct { // placeholder for future optional parameters } -// ServiceConfigurationsClientGetOptions contains the optional parameters for the ServiceConfigurationsClient.Get method. -type ServiceConfigurationsClientGetOptions struct { +// SolutionConfigurationsClientListOptions contains the optional parameters for the SolutionConfigurationsClient.NewListPager +// method. +type SolutionConfigurationsClientListOptions struct { // placeholder for future optional parameters } -// ServiceConfigurationsClientListByEndpointResourceOptions contains the optional parameters for the ServiceConfigurationsClient.NewListByEndpointResourcePager +// SolutionConfigurationsClientUpdateOptions contains the optional parameters for the SolutionConfigurationsClient.Update // method. -type ServiceConfigurationsClientListByEndpointResourceOptions struct { +type SolutionConfigurationsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// SolutionTypesClientGetOptions contains the optional parameters for the SolutionTypesClient.Get method. +type SolutionTypesClientGetOptions struct { // placeholder for future optional parameters } -// ServiceConfigurationsClientUpdateOptions contains the optional parameters for the ServiceConfigurationsClient.Update method. -type ServiceConfigurationsClientUpdateOptions struct { +// SolutionTypesClientListByResourceGroupOptions contains the optional parameters for the SolutionTypesClient.NewListByResourceGroupPager +// method. +type SolutionTypesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// SolutionTypesClientListBySubscriptionOptions contains the optional parameters for the SolutionTypesClient.NewListBySubscriptionPager +// method. +type SolutionTypesClientListBySubscriptionOptions struct { // placeholder for future optional parameters } diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/publiccloudconnectors_client.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/publiccloudconnectors_client.go new file mode 100644 index 000000000000..28eb57d5d6ce --- /dev/null +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/publiccloudconnectors_client.go @@ -0,0 +1,502 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armhybridconnectivity + +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" +) + +// PublicCloudConnectorsClient contains the methods for the PublicCloudConnectors group. +// Don't use this type directly, use NewPublicCloudConnectorsClient() instead. +type PublicCloudConnectorsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewPublicCloudConnectorsClient creates a new instance of PublicCloudConnectorsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewPublicCloudConnectorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PublicCloudConnectorsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PublicCloudConnectorsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a PublicCloudConnector +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-12-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - publicCloudConnector - Represent public cloud connectors resource. +// - resource - Resource create parameters. +// - options - PublicCloudConnectorsClientBeginCreateOrUpdateOptions contains the optional parameters for the PublicCloudConnectorsClient.BeginCreateOrUpdate +// method. +func (client *PublicCloudConnectorsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, publicCloudConnector string, resource PublicCloudConnector, options *PublicCloudConnectorsClientBeginCreateOrUpdateOptions) (*runtime.Poller[PublicCloudConnectorsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, publicCloudConnector, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PublicCloudConnectorsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PublicCloudConnectorsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a PublicCloudConnector +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-12-01 +func (client *PublicCloudConnectorsClient) createOrUpdate(ctx context.Context, resourceGroupName string, publicCloudConnector string, resource PublicCloudConnector, options *PublicCloudConnectorsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "PublicCloudConnectorsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, publicCloudConnector, resource, 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 +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *PublicCloudConnectorsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, publicCloudConnector string, resource PublicCloudConnector, _ *PublicCloudConnectorsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector}" + 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 publicCloudConnector == "" { + return nil, errors.New("parameter publicCloudConnector cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publicCloudConnector}", url.PathEscape(publicCloudConnector)) + 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", "2024-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// Delete - Delete a PublicCloudConnector +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-12-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - publicCloudConnector - Represent public cloud connectors resource. +// - options - PublicCloudConnectorsClientDeleteOptions contains the optional parameters for the PublicCloudConnectorsClient.Delete +// method. +func (client *PublicCloudConnectorsClient) Delete(ctx context.Context, resourceGroupName string, publicCloudConnector string, options *PublicCloudConnectorsClientDeleteOptions) (PublicCloudConnectorsClientDeleteResponse, error) { + var err error + const operationName = "PublicCloudConnectorsClient.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, publicCloudConnector, options) + if err != nil { + return PublicCloudConnectorsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PublicCloudConnectorsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return PublicCloudConnectorsClientDeleteResponse{}, err + } + return PublicCloudConnectorsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *PublicCloudConnectorsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, publicCloudConnector string, _ *PublicCloudConnectorsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector}" + 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 publicCloudConnector == "" { + return nil, errors.New("parameter publicCloudConnector cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publicCloudConnector}", url.PathEscape(publicCloudConnector)) + 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", "2024-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a PublicCloudConnector +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-12-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - publicCloudConnector - Represent public cloud connectors resource. +// - options - PublicCloudConnectorsClientGetOptions contains the optional parameters for the PublicCloudConnectorsClient.Get +// method. +func (client *PublicCloudConnectorsClient) Get(ctx context.Context, resourceGroupName string, publicCloudConnector string, options *PublicCloudConnectorsClientGetOptions) (PublicCloudConnectorsClientGetResponse, error) { + var err error + const operationName = "PublicCloudConnectorsClient.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, publicCloudConnector, options) + if err != nil { + return PublicCloudConnectorsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PublicCloudConnectorsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PublicCloudConnectorsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *PublicCloudConnectorsClient) getCreateRequest(ctx context.Context, resourceGroupName string, publicCloudConnector string, _ *PublicCloudConnectorsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector}" + 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 publicCloudConnector == "" { + return nil, errors.New("parameter publicCloudConnector cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publicCloudConnector}", url.PathEscape(publicCloudConnector)) + 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", "2024-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PublicCloudConnectorsClient) getHandleResponse(resp *http.Response) (PublicCloudConnectorsClientGetResponse, error) { + result := PublicCloudConnectorsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PublicCloudConnector); err != nil { + return PublicCloudConnectorsClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List PublicCloudConnector resources by resource group +// +// Generated from API version 2024-12-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - PublicCloudConnectorsClientListByResourceGroupOptions contains the optional parameters for the PublicCloudConnectorsClient.NewListByResourceGroupPager +// method. +func (client *PublicCloudConnectorsClient) NewListByResourceGroupPager(resourceGroupName string, options *PublicCloudConnectorsClientListByResourceGroupOptions) *runtime.Pager[PublicCloudConnectorsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[PublicCloudConnectorsClientListByResourceGroupResponse]{ + More: func(page PublicCloudConnectorsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PublicCloudConnectorsClientListByResourceGroupResponse) (PublicCloudConnectorsClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PublicCloudConnectorsClient.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 PublicCloudConnectorsClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *PublicCloudConnectorsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *PublicCloudConnectorsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors" + 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", "2024-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *PublicCloudConnectorsClient) listByResourceGroupHandleResponse(resp *http.Response) (PublicCloudConnectorsClientListByResourceGroupResponse, error) { + result := PublicCloudConnectorsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PublicCloudConnectorListResult); err != nil { + return PublicCloudConnectorsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List PublicCloudConnector resources by subscription ID +// +// Generated from API version 2024-12-01 +// - options - PublicCloudConnectorsClientListBySubscriptionOptions contains the optional parameters for the PublicCloudConnectorsClient.NewListBySubscriptionPager +// method. +func (client *PublicCloudConnectorsClient) NewListBySubscriptionPager(options *PublicCloudConnectorsClientListBySubscriptionOptions) *runtime.Pager[PublicCloudConnectorsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[PublicCloudConnectorsClientListBySubscriptionResponse]{ + More: func(page PublicCloudConnectorsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PublicCloudConnectorsClientListBySubscriptionResponse) (PublicCloudConnectorsClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PublicCloudConnectorsClient.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 PublicCloudConnectorsClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *PublicCloudConnectorsClient) listBySubscriptionCreateRequest(ctx context.Context, _ *PublicCloudConnectorsClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HybridConnectivity/publicCloudConnectors" + 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", "2024-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *PublicCloudConnectorsClient) listBySubscriptionHandleResponse(resp *http.Response) (PublicCloudConnectorsClientListBySubscriptionResponse, error) { + result := PublicCloudConnectorsClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PublicCloudConnectorListResult); err != nil { + return PublicCloudConnectorsClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// BeginTestPermissions - A long-running resource action. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-12-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - publicCloudConnector - Represent public cloud connectors resource. +// - options - PublicCloudConnectorsClientBeginTestPermissionsOptions contains the optional parameters for the PublicCloudConnectorsClient.BeginTestPermissions +// method. +func (client *PublicCloudConnectorsClient) BeginTestPermissions(ctx context.Context, resourceGroupName string, publicCloudConnector string, options *PublicCloudConnectorsClientBeginTestPermissionsOptions) (*runtime.Poller[PublicCloudConnectorsClientTestPermissionsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.testPermissions(ctx, resourceGroupName, publicCloudConnector, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PublicCloudConnectorsClientTestPermissionsResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PublicCloudConnectorsClientTestPermissionsResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// TestPermissions - A long-running resource action. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-12-01 +func (client *PublicCloudConnectorsClient) testPermissions(ctx context.Context, resourceGroupName string, publicCloudConnector string, options *PublicCloudConnectorsClientBeginTestPermissionsOptions) (*http.Response, error) { + var err error + const operationName = "PublicCloudConnectorsClient.BeginTestPermissions" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.testPermissionsCreateRequest(ctx, resourceGroupName, publicCloudConnector, 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 +} + +// testPermissionsCreateRequest creates the TestPermissions request. +func (client *PublicCloudConnectorsClient) testPermissionsCreateRequest(ctx context.Context, resourceGroupName string, publicCloudConnector string, _ *PublicCloudConnectorsClientBeginTestPermissionsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector}/testPermissions" + 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 publicCloudConnector == "" { + return nil, errors.New("parameter publicCloudConnector cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publicCloudConnector}", url.PathEscape(publicCloudConnector)) + 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", "2024-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Update - Update a PublicCloudConnector +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-12-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - publicCloudConnector - Represent public cloud connectors resource. +// - properties - The resource properties to be updated. +// - options - PublicCloudConnectorsClientUpdateOptions contains the optional parameters for the PublicCloudConnectorsClient.Update +// method. +func (client *PublicCloudConnectorsClient) Update(ctx context.Context, resourceGroupName string, publicCloudConnector string, properties PublicCloudConnector, options *PublicCloudConnectorsClientUpdateOptions) (PublicCloudConnectorsClientUpdateResponse, error) { + var err error + const operationName = "PublicCloudConnectorsClient.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, publicCloudConnector, properties, options) + if err != nil { + return PublicCloudConnectorsClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PublicCloudConnectorsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PublicCloudConnectorsClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *PublicCloudConnectorsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, publicCloudConnector string, properties PublicCloudConnector, _ *PublicCloudConnectorsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector}" + 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 publicCloudConnector == "" { + return nil, errors.New("parameter publicCloudConnector cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publicCloudConnector}", url.PathEscape(publicCloudConnector)) + 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", "2024-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *PublicCloudConnectorsClient) updateHandleResponse(resp *http.Response) (PublicCloudConnectorsClientUpdateResponse, error) { + result := PublicCloudConnectorsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PublicCloudConnector); err != nil { + return PublicCloudConnectorsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/publiccloudconnectors_client_example_test.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/publiccloudconnectors_client_example_test.go new file mode 100644 index 000000000000..a820f6cb942c --- /dev/null +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/publiccloudconnectors_client_example_test.go @@ -0,0 +1,405 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armhybridconnectivity_test + +import ( + "context" + "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/hybridconnectivity/armhybridconnectivity/v2" + "log" +) + +// Generated from example definition: 2024-12-01/PublicCloudConnectors_CreateOrUpdate.json +func ExamplePublicCloudConnectorsClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridconnectivity.NewClientFactory("5ACC4579-DB34-4C2F-8F8C-25061168F342", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewPublicCloudConnectorsClient().BeginCreateOrUpdate(ctx, "rgpublicCloud", "advjwoakdusalamomg", armhybridconnectivity.PublicCloudConnector{ + Properties: &armhybridconnectivity.PublicCloudConnectorProperties{ + AwsCloudProfile: &armhybridconnectivity.AwsCloudProfile{ + AccountID: to.Ptr("snbnuxckevyqpm"), + ExcludedAccounts: []*string{ + to.Ptr("rwgqpukglvbqmogqcliqolucp"), + }, + IsOrganizationalAccount: to.Ptr(true), + }, + HostType: to.Ptr(armhybridconnectivity.HostTypeAWS), + }, + Tags: map[string]*string{}, + Location: to.Ptr("jpiglusfxynfcewcjwvvnn"), + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %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 = armhybridconnectivity.PublicCloudConnectorsClientCreateOrUpdateResponse{ + // PublicCloudConnector: &armhybridconnectivity.PublicCloudConnector{ + // Properties: &armhybridconnectivity.PublicCloudConnectorProperties{ + // AwsCloudProfile: &armhybridconnectivity.AwsCloudProfile{ + // AccountID: to.Ptr("snbnuxckevyqpm"), + // ExcludedAccounts: []*string{ + // to.Ptr("rwgqpukglvbqmogqcliqolucp"), + // }, + // IsOrganizationalAccount: to.Ptr(true), + // }, + // HostType: to.Ptr(armhybridconnectivity.HostTypeAWS), + // ProvisioningState: to.Ptr(armhybridconnectivity.ResourceProvisioningStateSucceeded), + // ConnectorPrimaryIdentifier: to.Ptr("20a4e2be-8158-4b9e-b512-7a1af6f827de"), + // }, + // Tags: map[string]*string{ + // }, + // Location: to.Ptr("jpiglusfxynfcewcjwvvnn"), + // ID: to.Ptr("/subscriptions/5ACC4579-DB34-4C2F-8F8C-25061168F342/providers/Microsoft.HybridConnectivity/PublicCloudConnectors/esixipkbydb"), + // Name: to.Ptr("esixipkbydb"), + // Type: to.Ptr("eelsjvqvkdxdncptsobrswhulnm"), + // SystemData: &armhybridconnectivity.SystemData{ + // CreatedBy: to.Ptr("rpxzkcrobprrdvuoqxz"), + // CreatedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // LastModifiedBy: to.Ptr("jidegyskxi"), + // LastModifiedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2024-12-01/PublicCloudConnectors_Delete.json +func ExamplePublicCloudConnectorsClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridconnectivity.NewClientFactory("5ACC4579-DB34-4C2F-8F8C-25061168F342", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPublicCloudConnectorsClient().Delete(ctx, "rgpublicCloud", "skcfyjvflkhibdywjay", 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 = armhybridconnectivity.PublicCloudConnectorsClientDeleteResponse{ + // } +} + +// Generated from example definition: 2024-12-01/PublicCloudConnectors_Get.json +func ExamplePublicCloudConnectorsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridconnectivity.NewClientFactory("5ACC4579-DB34-4C2F-8F8C-25061168F342", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPublicCloudConnectorsClient().Get(ctx, "rgpublicCloud", "rzygvnpsnrdylwzdbsscjazvamyxmh", 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 = armhybridconnectivity.PublicCloudConnectorsClientGetResponse{ + // PublicCloudConnector: &armhybridconnectivity.PublicCloudConnector{ + // Properties: &armhybridconnectivity.PublicCloudConnectorProperties{ + // AwsCloudProfile: &armhybridconnectivity.AwsCloudProfile{ + // AccountID: to.Ptr("snbnuxckevyqpm"), + // ExcludedAccounts: []*string{ + // to.Ptr("rwgqpukglvbqmogqcliqolucp"), + // }, + // IsOrganizationalAccount: to.Ptr(true), + // }, + // HostType: to.Ptr(armhybridconnectivity.HostTypeAWS), + // ProvisioningState: to.Ptr(armhybridconnectivity.ResourceProvisioningStateSucceeded), + // ConnectorPrimaryIdentifier: to.Ptr("20a4e2be-8158-4b9e-b512-7a1af6f827de"), + // }, + // Tags: map[string]*string{ + // }, + // Location: to.Ptr("jpiglusfxynfcewcjwvvnn"), + // ID: to.Ptr("/subscriptions/5ACC4579-DB34-4C2F-8F8C-25061168F342/providers/Microsoft.HybridConnectivity/PublicCloudConnectors/esixipkbydb"), + // Name: to.Ptr("esixipkbydb"), + // Type: to.Ptr("eelsjvqvkdxdncptsobrswhulnm"), + // SystemData: &armhybridconnectivity.SystemData{ + // CreatedBy: to.Ptr("rpxzkcrobprrdvuoqxz"), + // CreatedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // LastModifiedBy: to.Ptr("jidegyskxi"), + // LastModifiedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2024-12-01/PublicCloudConnectors_ListByResourceGroup.json +func ExamplePublicCloudConnectorsClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridconnectivity.NewClientFactory("5ACC4579-DB34-4C2F-8F8C-25061168F342", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewPublicCloudConnectorsClient().NewListByResourceGroupPager("rgpublicCloud", 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 = armhybridconnectivity.PublicCloudConnectorsClientListByResourceGroupResponse{ + // PublicCloudConnectorListResult: armhybridconnectivity.PublicCloudConnectorListResult{ + // Value: []*armhybridconnectivity.PublicCloudConnector{ + // { + // Properties: &armhybridconnectivity.PublicCloudConnectorProperties{ + // AwsCloudProfile: &armhybridconnectivity.AwsCloudProfile{ + // ExcludedAccounts: []*string{ + // to.Ptr("rwgqpukglvbqmogqcliqolucp"), + // }, + // AccountID: to.Ptr("troiiavknxmcpczvxwjhrdue"), + // IsOrganizationalAccount: to.Ptr(true), + // }, + // HostType: to.Ptr(armhybridconnectivity.HostTypeAWS), + // ProvisioningState: to.Ptr(armhybridconnectivity.ResourceProvisioningStateSucceeded), + // ConnectorPrimaryIdentifier: to.Ptr("20a4e2be-8158-4b9e-b512-7a1af6f827de"), + // }, + // Tags: map[string]*string{ + // }, + // Location: to.Ptr("jpiglusfxynfcewcjwvvnn"), + // ID: to.Ptr("/subscriptions/5ACC4579-DB34-4C2F-8F8C-25061168F342/providers/Microsoft.HybridConnectivity/PublicCloudConnectors/esixipkbydb"), + // Name: to.Ptr("esixipkbydb"), + // Type: to.Ptr("eelsjvqvkdxdncptsobrswhulnm"), + // SystemData: &armhybridconnectivity.SystemData{ + // CreatedBy: to.Ptr("rpxzkcrobprrdvuoqxz"), + // CreatedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // LastModifiedBy: to.Ptr("jidegyskxi"), + // LastModifiedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2024-12-01/PublicCloudConnectors_ListBySubscription.json +func ExamplePublicCloudConnectorsClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridconnectivity.NewClientFactory("5ACC4579-DB34-4C2F-8F8C-25061168F342", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewPublicCloudConnectorsClient().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 = armhybridconnectivity.PublicCloudConnectorsClientListBySubscriptionResponse{ + // PublicCloudConnectorListResult: armhybridconnectivity.PublicCloudConnectorListResult{ + // Value: []*armhybridconnectivity.PublicCloudConnector{ + // { + // Properties: &armhybridconnectivity.PublicCloudConnectorProperties{ + // AwsCloudProfile: &armhybridconnectivity.AwsCloudProfile{ + // ExcludedAccounts: []*string{ + // to.Ptr("rwgqpukglvbqmogqcliqolucp"), + // }, + // AccountID: to.Ptr("troiiavknxmcpczvxwjhrdue"), + // IsOrganizationalAccount: to.Ptr(true), + // }, + // HostType: to.Ptr(armhybridconnectivity.HostTypeAWS), + // ProvisioningState: to.Ptr(armhybridconnectivity.ResourceProvisioningStateSucceeded), + // ConnectorPrimaryIdentifier: to.Ptr("20a4e2be-8158-4b9e-b512-7a1af6f827de"), + // }, + // Tags: map[string]*string{ + // }, + // Location: to.Ptr("jpiglusfxynfcewcjwvvnn"), + // ID: to.Ptr("/subscriptions/5ACC4579-DB34-4C2F-8F8C-25061168F342/providers/Microsoft.HybridConnectivity/PublicCloudConnectors/esixipkbydb"), + // Name: to.Ptr("esixipkbydb"), + // Type: to.Ptr("eelsjvqvkdxdncptsobrswhulnm"), + // SystemData: &armhybridconnectivity.SystemData{ + // CreatedBy: to.Ptr("rpxzkcrobprrdvuoqxz"), + // CreatedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // LastModifiedBy: to.Ptr("jidegyskxi"), + // LastModifiedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2024-12-01/PublicCloudConnectors_TestPermissions.json +func ExamplePublicCloudConnectorsClient_BeginTestPermissions() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridconnectivity.NewClientFactory("5ACC4579-DB34-4C2F-8F8C-25061168F342", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewPublicCloudConnectorsClient().BeginTestPermissions(ctx, "rgpublicCloud", "rzygvnpsnrdylwzdbsscjazvamyxmh", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %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 = armhybridconnectivity.PublicCloudConnectorsClientTestPermissionsResponse{ + // OperationStatusResult: &armhybridconnectivity.OperationStatusResult{ + // ID: to.Ptr("/subscriptions/5ACC4579-DB34-4C2F-8F8C-25061168F342/providers/Microsoft.HybridConnectivity/PublicCloudConnectors/esixipkbydb"), + // Name: to.Ptr("ppeygvsnaspxmpwalpmkqva"), + // Status: to.Ptr("toyjllkvm"), + // PercentComplete: to.Ptr[float64](81), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-10-02T18:38:19.143Z"); return t}()), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-10-02T18:38:19.143Z"); return t}()), + // Operations: []*armhybridconnectivity.OperationStatusResult{ + // { + // ID: to.Ptr("/subscriptions/5ACC4579-DB34-4C2F-8F8C-25061168F342/providers/Microsoft.HybridConnectivity/PublicCloudConnectors/esixipkbydb"), + // Name: to.Ptr("svqtraeuwvyvblujlvqilypwpdrt"), + // Status: to.Ptr("bevmrejij"), + // PercentComplete: to.Ptr[float64](15), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-10-02T18:38:19.143Z"); return t}()), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-10-02T18:38:19.143Z"); return t}()), + // Operations: []*armhybridconnectivity.OperationStatusResult{ + // }, + // Error: &armhybridconnectivity.ErrorDetail{ + // Code: to.Ptr("ykzvluyqiftfsumgvwzdh"), + // Message: to.Ptr("krbjgtqkjgiux"), + // Target: to.Ptr("nsaucxt"), + // Details: []*armhybridconnectivity.ErrorDetail{ + // }, + // AdditionalInfo: []*armhybridconnectivity.ErrorAdditionalInfo{ + // { + // Type: to.Ptr("qivvrewsjvcildjgwwytgimwklh"), + // Info: &armhybridconnectivity.ErrorAdditionalInfoInfo{ + // }, + // }, + // }, + // }, + // }, + // }, + // Error: &armhybridconnectivity.ErrorDetail{ + // Code: to.Ptr("ykzvluyqiftfsumgvwzdh"), + // Message: to.Ptr("krbjgtqkjgiux"), + // Target: to.Ptr("nsaucxt"), + // Details: []*armhybridconnectivity.ErrorDetail{ + // }, + // AdditionalInfo: []*armhybridconnectivity.ErrorAdditionalInfo{ + // { + // Type: to.Ptr("qivvrewsjvcildjgwwytgimwklh"), + // Info: &armhybridconnectivity.ErrorAdditionalInfoInfo{ + // }, + // }, + // }, + // }, + // }, + // } +} + +// Generated from example definition: 2024-12-01/PublicCloudConnectors_Update.json +func ExamplePublicCloudConnectorsClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridconnectivity.NewClientFactory("5ACC4579-DB34-4C2F-8F8C-25061168F342", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPublicCloudConnectorsClient().Update(ctx, "rgpublicCloud", "svtirlbyqpepbzyessjenlueeznhg", armhybridconnectivity.PublicCloudConnector{ + Tags: map[string]*string{}, + Properties: &armhybridconnectivity.PublicCloudConnectorProperties{ + AwsCloudProfile: &armhybridconnectivity.AwsCloudProfile{ + ExcludedAccounts: []*string{ + to.Ptr("zrbtd"), + }, + }, + }, + }, 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 = armhybridconnectivity.PublicCloudConnectorsClientUpdateResponse{ + // PublicCloudConnector: &armhybridconnectivity.PublicCloudConnector{ + // Properties: &armhybridconnectivity.PublicCloudConnectorProperties{ + // AwsCloudProfile: &armhybridconnectivity.AwsCloudProfile{ + // AccountID: to.Ptr("snbnuxckevyqpm"), + // ExcludedAccounts: []*string{ + // to.Ptr("zrbtd"), + // }, + // IsOrganizationalAccount: to.Ptr(true), + // }, + // HostType: to.Ptr(armhybridconnectivity.HostTypeAWS), + // ProvisioningState: to.Ptr(armhybridconnectivity.ResourceProvisioningStateSucceeded), + // ConnectorPrimaryIdentifier: to.Ptr("20a4e2be-8158-4b9e-b512-7a1af6f827de"), + // }, + // Tags: map[string]*string{ + // }, + // Location: to.Ptr("jpiglusfxynfcewcjwvvnn"), + // ID: to.Ptr("/subscriptions/5ACC4579-DB34-4C2F-8F8C-25061168F342/providers/Microsoft.HybridConnectivity/PublicCloudConnectors/esixipkbydb"), + // Name: to.Ptr("esixipkbydb"), + // Type: to.Ptr("eelsjvqvkdxdncptsobrswhulnm"), + // SystemData: &armhybridconnectivity.SystemData{ + // CreatedBy: to.Ptr("rpxzkcrobprrdvuoqxz"), + // CreatedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // LastModifiedBy: to.Ptr("jidegyskxi"), + // LastModifiedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/response_types.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/response_types.go deleted file mode 100644 index 56d2a363d1d4..000000000000 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/response_types.go +++ /dev/null @@ -1,91 +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 armhybridconnectivity - -// EndpointsClientCreateOrUpdateResponse contains the response from method EndpointsClient.CreateOrUpdate. -type EndpointsClientCreateOrUpdateResponse struct { - // The endpoint for the target resource. - EndpointResource -} - -// EndpointsClientDeleteResponse contains the response from method EndpointsClient.Delete. -type EndpointsClientDeleteResponse struct { - // placeholder for future response values -} - -// EndpointsClientGetResponse contains the response from method EndpointsClient.Get. -type EndpointsClientGetResponse struct { - // The endpoint for the target resource. - EndpointResource -} - -// EndpointsClientListCredentialsResponse contains the response from method EndpointsClient.ListCredentials. -type EndpointsClientListCredentialsResponse struct { - // The endpoint access for the target resource. - EndpointAccessResource -} - -// EndpointsClientListIngressGatewayCredentialsResponse contains the response from method EndpointsClient.ListIngressGatewayCredentials. -type EndpointsClientListIngressGatewayCredentialsResponse struct { - // The ingress gateway access credentials - IngressGatewayResource -} - -// EndpointsClientListManagedProxyDetailsResponse contains the response from method EndpointsClient.ListManagedProxyDetails. -type EndpointsClientListManagedProxyDetailsResponse struct { - // Managed Proxy - ManagedProxyResource -} - -// EndpointsClientListResponse contains the response from method EndpointsClient.NewListPager. -type EndpointsClientListResponse struct { - // The list of endpoints. - EndpointsList -} - -// EndpointsClientUpdateResponse contains the response from method EndpointsClient.Update. -type EndpointsClientUpdateResponse struct { - // The endpoint for the target resource. - EndpointResource -} - -// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. -type OperationsClientListResponse struct { - // 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 -} - -// ServiceConfigurationsClientCreateOrupdateResponse contains the response from method ServiceConfigurationsClient.CreateOrupdate. -type ServiceConfigurationsClientCreateOrupdateResponse struct { - // The service configuration details associated with the target resource. - ServiceConfigurationResource -} - -// ServiceConfigurationsClientDeleteResponse contains the response from method ServiceConfigurationsClient.Delete. -type ServiceConfigurationsClientDeleteResponse struct { - // placeholder for future response values -} - -// ServiceConfigurationsClientGetResponse contains the response from method ServiceConfigurationsClient.Get. -type ServiceConfigurationsClientGetResponse struct { - // The service configuration details associated with the target resource. - ServiceConfigurationResource -} - -// ServiceConfigurationsClientListByEndpointResourceResponse contains the response from method ServiceConfigurationsClient.NewListByEndpointResourcePager. -type ServiceConfigurationsClientListByEndpointResourceResponse struct { - // The paginated list of serviceConfigurations - ServiceConfigurationList -} - -// ServiceConfigurationsClientUpdateResponse contains the response from method ServiceConfigurationsClient.Update. -type ServiceConfigurationsClientUpdateResponse struct { - // The service configuration details associated with the target resource. - ServiceConfigurationResource -} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/responses.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/responses.go new file mode 100644 index 000000000000..d259242f57c0 --- /dev/null +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/responses.go @@ -0,0 +1,116 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armhybridconnectivity + +// GenerateAwsTemplateClientPostResponse contains the response from method GenerateAwsTemplateClient.Post. +type GenerateAwsTemplateClientPostResponse struct { + PostResponse +} + +// InventoryClientGetResponse contains the response from method InventoryClient.Get. +type InventoryClientGetResponse struct { + // Concrete proxy resource types can be created by aliasing this type using a specific property type. + InventoryResource +} + +// InventoryClientListBySolutionConfigurationResponse contains the response from method InventoryClient.NewListBySolutionConfigurationPager. +type InventoryClientListBySolutionConfigurationResponse struct { + // The response of a InventoryResource list operation. + InventoryResourceListResult +} + +// PublicCloudConnectorsClientCreateOrUpdateResponse contains the response from method PublicCloudConnectorsClient.BeginCreateOrUpdate. +type PublicCloudConnectorsClientCreateOrUpdateResponse struct { + // Public Cloud Connector + PublicCloudConnector +} + +// PublicCloudConnectorsClientDeleteResponse contains the response from method PublicCloudConnectorsClient.Delete. +type PublicCloudConnectorsClientDeleteResponse struct { + // placeholder for future response values +} + +// PublicCloudConnectorsClientGetResponse contains the response from method PublicCloudConnectorsClient.Get. +type PublicCloudConnectorsClientGetResponse struct { + // Public Cloud Connector + PublicCloudConnector +} + +// PublicCloudConnectorsClientListByResourceGroupResponse contains the response from method PublicCloudConnectorsClient.NewListByResourceGroupPager. +type PublicCloudConnectorsClientListByResourceGroupResponse struct { + // The response of a PublicCloudConnector list operation. + PublicCloudConnectorListResult +} + +// PublicCloudConnectorsClientListBySubscriptionResponse contains the response from method PublicCloudConnectorsClient.NewListBySubscriptionPager. +type PublicCloudConnectorsClientListBySubscriptionResponse struct { + // The response of a PublicCloudConnector list operation. + PublicCloudConnectorListResult +} + +// PublicCloudConnectorsClientTestPermissionsResponse contains the response from method PublicCloudConnectorsClient.BeginTestPermissions. +type PublicCloudConnectorsClientTestPermissionsResponse struct { + // The current status of an async operation. + OperationStatusResult +} + +// PublicCloudConnectorsClientUpdateResponse contains the response from method PublicCloudConnectorsClient.Update. +type PublicCloudConnectorsClientUpdateResponse struct { + // Public Cloud Connector + PublicCloudConnector +} + +// SolutionConfigurationsClientCreateOrUpdateResponse contains the response from method SolutionConfigurationsClient.CreateOrUpdate. +type SolutionConfigurationsClientCreateOrUpdateResponse struct { + // Solution Configuration + SolutionConfiguration +} + +// SolutionConfigurationsClientDeleteResponse contains the response from method SolutionConfigurationsClient.Delete. +type SolutionConfigurationsClientDeleteResponse struct { + // placeholder for future response values +} + +// SolutionConfigurationsClientGetResponse contains the response from method SolutionConfigurationsClient.Get. +type SolutionConfigurationsClientGetResponse struct { + // Solution Configuration + SolutionConfiguration +} + +// SolutionConfigurationsClientListResponse contains the response from method SolutionConfigurationsClient.NewListPager. +type SolutionConfigurationsClientListResponse struct { + // The response of a SolutionConfiguration list operation. + SolutionConfigurationListResult +} + +// SolutionConfigurationsClientSyncNowResponse contains the response from method SolutionConfigurationsClient.BeginSyncNow. +type SolutionConfigurationsClientSyncNowResponse struct { + // The current status of an async operation. + OperationStatusResult +} + +// SolutionConfigurationsClientUpdateResponse contains the response from method SolutionConfigurationsClient.Update. +type SolutionConfigurationsClientUpdateResponse struct { + // Solution Configuration + SolutionConfiguration +} + +// SolutionTypesClientGetResponse contains the response from method SolutionTypesClient.Get. +type SolutionTypesClientGetResponse struct { + // Concrete proxy resource types can be created by aliasing this type using a specific property type. + SolutionTypeResource +} + +// SolutionTypesClientListByResourceGroupResponse contains the response from method SolutionTypesClient.NewListByResourceGroupPager. +type SolutionTypesClientListByResourceGroupResponse struct { + // The response of a SolutionTypeResource list operation. + SolutionTypeResourceListResult +} + +// SolutionTypesClientListBySubscriptionResponse contains the response from method SolutionTypesClient.NewListBySubscriptionPager. +type SolutionTypesClientListBySubscriptionResponse struct { + // The response of a SolutionTypeResource list operation. + SolutionTypeResourceListResult +} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/serviceconfigurations_client.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/serviceconfigurations_client.go deleted file mode 100644 index a760822737fb..000000000000 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/serviceconfigurations_client.go +++ /dev/null @@ -1,320 +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 armhybridconnectivity - -import ( - "context" - "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" - "strings" -) - -// ServiceConfigurationsClient contains the methods for the ServiceConfigurations group. -// Don't use this type directly, use NewServiceConfigurationsClient() instead. -type ServiceConfigurationsClient struct { - internal *arm.Client -} - -// NewServiceConfigurationsClient creates a new instance of ServiceConfigurationsClient with the specified values. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewServiceConfigurationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ServiceConfigurationsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ServiceConfigurationsClient{ - internal: cl, - } - return client, nil -} - -// CreateOrupdate - Create or update a service in serviceConfiguration for the endpoint resource. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-03-15 -// - resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. -// - endpointName - The endpoint name. -// - serviceConfigurationName - The service name. -// - serviceConfigurationResource - Service details -// - options - ServiceConfigurationsClientCreateOrupdateOptions contains the optional parameters for the ServiceConfigurationsClient.CreateOrupdate -// method. -func (client *ServiceConfigurationsClient) CreateOrupdate(ctx context.Context, resourceURI string, endpointName string, serviceConfigurationName string, serviceConfigurationResource ServiceConfigurationResource, options *ServiceConfigurationsClientCreateOrupdateOptions) (ServiceConfigurationsClientCreateOrupdateResponse, error) { - var err error - const operationName = "ServiceConfigurationsClient.CreateOrupdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createOrupdateCreateRequest(ctx, resourceURI, endpointName, serviceConfigurationName, serviceConfigurationResource, options) - if err != nil { - return ServiceConfigurationsClientCreateOrupdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ServiceConfigurationsClientCreateOrupdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return ServiceConfigurationsClientCreateOrupdateResponse{}, err - } - resp, err := client.createOrupdateHandleResponse(httpResp) - return resp, err -} - -// createOrupdateCreateRequest creates the CreateOrupdate request. -func (client *ServiceConfigurationsClient) createOrupdateCreateRequest(ctx context.Context, resourceURI string, endpointName string, serviceConfigurationName string, serviceConfigurationResource ServiceConfigurationResource, options *ServiceConfigurationsClientCreateOrupdateOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/serviceConfigurations/{serviceConfigurationName}" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - urlPath = strings.ReplaceAll(urlPath, "{endpointName}", endpointName) - urlPath = strings.ReplaceAll(urlPath, "{serviceConfigurationName}", serviceConfigurationName) - 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-03-15") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, serviceConfigurationResource); err != nil { - return nil, err - } - return req, nil -} - -// createOrupdateHandleResponse handles the CreateOrupdate response. -func (client *ServiceConfigurationsClient) createOrupdateHandleResponse(resp *http.Response) (ServiceConfigurationsClientCreateOrupdateResponse, error) { - result := ServiceConfigurationsClientCreateOrupdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ServiceConfigurationResource); err != nil { - return ServiceConfigurationsClientCreateOrupdateResponse{}, err - } - return result, nil -} - -// Delete - Deletes the service details to the target resource. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-03-15 -// - resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. -// - endpointName - The endpoint name. -// - serviceConfigurationName - The service name. -// - options - ServiceConfigurationsClientDeleteOptions contains the optional parameters for the ServiceConfigurationsClient.Delete -// method. -func (client *ServiceConfigurationsClient) Delete(ctx context.Context, resourceURI string, endpointName string, serviceConfigurationName string, options *ServiceConfigurationsClientDeleteOptions) (ServiceConfigurationsClientDeleteResponse, error) { - var err error - const operationName = "ServiceConfigurationsClient.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, resourceURI, endpointName, serviceConfigurationName, options) - if err != nil { - return ServiceConfigurationsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ServiceConfigurationsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return ServiceConfigurationsClientDeleteResponse{}, err - } - return ServiceConfigurationsClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *ServiceConfigurationsClient) deleteCreateRequest(ctx context.Context, resourceURI string, endpointName string, serviceConfigurationName string, options *ServiceConfigurationsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/serviceConfigurations/{serviceConfigurationName}" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - urlPath = strings.ReplaceAll(urlPath, "{endpointName}", endpointName) - urlPath = strings.ReplaceAll(urlPath, "{serviceConfigurationName}", serviceConfigurationName) - 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-03-15") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Gets the details about the service to the resource. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-03-15 -// - resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. -// - endpointName - The endpoint name. -// - serviceConfigurationName - The service name. -// - options - ServiceConfigurationsClientGetOptions contains the optional parameters for the ServiceConfigurationsClient.Get -// method. -func (client *ServiceConfigurationsClient) Get(ctx context.Context, resourceURI string, endpointName string, serviceConfigurationName string, options *ServiceConfigurationsClientGetOptions) (ServiceConfigurationsClientGetResponse, error) { - var err error - const operationName = "ServiceConfigurationsClient.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, resourceURI, endpointName, serviceConfigurationName, options) - if err != nil { - return ServiceConfigurationsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ServiceConfigurationsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ServiceConfigurationsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ServiceConfigurationsClient) getCreateRequest(ctx context.Context, resourceURI string, endpointName string, serviceConfigurationName string, options *ServiceConfigurationsClientGetOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/serviceConfigurations/{serviceConfigurationName}" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - urlPath = strings.ReplaceAll(urlPath, "{endpointName}", endpointName) - urlPath = strings.ReplaceAll(urlPath, "{serviceConfigurationName}", serviceConfigurationName) - 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-03-15") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ServiceConfigurationsClient) getHandleResponse(resp *http.Response) (ServiceConfigurationsClientGetResponse, error) { - result := ServiceConfigurationsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ServiceConfigurationResource); err != nil { - return ServiceConfigurationsClientGetResponse{}, err - } - return result, nil -} - -// NewListByEndpointResourcePager - API to enumerate registered services in service configurations under a Endpoint Resource -// -// Generated from API version 2023-03-15 -// - resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. -// - endpointName - The endpoint name. -// - options - ServiceConfigurationsClientListByEndpointResourceOptions contains the optional parameters for the ServiceConfigurationsClient.NewListByEndpointResourcePager -// method. -func (client *ServiceConfigurationsClient) NewListByEndpointResourcePager(resourceURI string, endpointName string, options *ServiceConfigurationsClientListByEndpointResourceOptions) *runtime.Pager[ServiceConfigurationsClientListByEndpointResourceResponse] { - return runtime.NewPager(runtime.PagingHandler[ServiceConfigurationsClientListByEndpointResourceResponse]{ - More: func(page ServiceConfigurationsClientListByEndpointResourceResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ServiceConfigurationsClientListByEndpointResourceResponse) (ServiceConfigurationsClientListByEndpointResourceResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ServiceConfigurationsClient.NewListByEndpointResourcePager") - 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.listByEndpointResourceCreateRequest(ctx, resourceURI, endpointName, options) - }, nil) - if err != nil { - return ServiceConfigurationsClientListByEndpointResourceResponse{}, err - } - return client.listByEndpointResourceHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByEndpointResourceCreateRequest creates the ListByEndpointResource request. -func (client *ServiceConfigurationsClient) listByEndpointResourceCreateRequest(ctx context.Context, resourceURI string, endpointName string, options *ServiceConfigurationsClientListByEndpointResourceOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/serviceConfigurations" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - urlPath = strings.ReplaceAll(urlPath, "{endpointName}", endpointName) - 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-03-15") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByEndpointResourceHandleResponse handles the ListByEndpointResource response. -func (client *ServiceConfigurationsClient) listByEndpointResourceHandleResponse(resp *http.Response) (ServiceConfigurationsClientListByEndpointResourceResponse, error) { - result := ServiceConfigurationsClientListByEndpointResourceResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ServiceConfigurationList); err != nil { - return ServiceConfigurationsClientListByEndpointResourceResponse{}, err - } - return result, nil -} - -// Update - Update the service details in the service configurations of the target resource. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-03-15 -// - resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. -// - endpointName - The endpoint name. -// - serviceConfigurationName - The service name. -// - serviceConfigurationResource - Service details -// - options - ServiceConfigurationsClientUpdateOptions contains the optional parameters for the ServiceConfigurationsClient.Update -// method. -func (client *ServiceConfigurationsClient) Update(ctx context.Context, resourceURI string, endpointName string, serviceConfigurationName string, serviceConfigurationResource ServiceConfigurationResourcePatch, options *ServiceConfigurationsClientUpdateOptions) (ServiceConfigurationsClientUpdateResponse, error) { - var err error - const operationName = "ServiceConfigurationsClient.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, resourceURI, endpointName, serviceConfigurationName, serviceConfigurationResource, options) - if err != nil { - return ServiceConfigurationsClientUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ServiceConfigurationsClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ServiceConfigurationsClientUpdateResponse{}, err - } - resp, err := client.updateHandleResponse(httpResp) - return resp, err -} - -// updateCreateRequest creates the Update request. -func (client *ServiceConfigurationsClient) updateCreateRequest(ctx context.Context, resourceURI string, endpointName string, serviceConfigurationName string, serviceConfigurationResource ServiceConfigurationResourcePatch, options *ServiceConfigurationsClientUpdateOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/serviceConfigurations/{serviceConfigurationName}" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - urlPath = strings.ReplaceAll(urlPath, "{endpointName}", endpointName) - urlPath = strings.ReplaceAll(urlPath, "{serviceConfigurationName}", serviceConfigurationName) - 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-03-15") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, serviceConfigurationResource); err != nil { - return nil, err - } - return req, nil -} - -// updateHandleResponse handles the Update response. -func (client *ServiceConfigurationsClient) updateHandleResponse(resp *http.Response) (ServiceConfigurationsClientUpdateResponse, error) { - result := ServiceConfigurationsClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ServiceConfigurationResource); err != nil { - return ServiceConfigurationsClientUpdateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/serviceconfigurations_client_example_test.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/serviceconfigurations_client_example_test.go deleted file mode 100644 index 59b2813f785e..000000000000 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/serviceconfigurations_client_example_test.go +++ /dev/null @@ -1,235 +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 armhybridconnectivity_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/hybridconnectivity/armhybridconnectivity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/ServiceConfigurationsList.json -func ExampleServiceConfigurationsClient_NewListByEndpointResourcePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridconnectivity.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServiceConfigurationsClient().NewListByEndpointResourcePager("subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default", "default", 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.ServiceConfigurationList = armhybridconnectivity.ServiceConfigurationList{ - // Value: []*armhybridconnectivity.ServiceConfigurationResource{ - // { - // Type: to.Ptr("Microsoft.HybridConnectivity/endpoints/serviceConfigurations"), - // ID: to.Ptr("/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default/serviceconfigurations/SSH"), - // Properties: &armhybridconnectivity.ServiceConfigurationProperties{ - // Port: to.Ptr[int64](22), - // ServiceName: to.Ptr(armhybridconnectivity.ServiceNameSSH), - // }, - // }, - // { - // Type: to.Ptr("Microsoft.HybridConnectivity/endpoints/serviceConfigurations"), - // ID: to.Ptr("/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default/serviceconfigurations/WAC"), - // Properties: &armhybridconnectivity.ServiceConfigurationProperties{ - // Port: to.Ptr[int64](6516), - // ServiceName: to.Ptr(armhybridconnectivity.ServiceNameWAC), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/ServiceConfigurationsGetSSH.json -func ExampleServiceConfigurationsClient_Get_hybridConnectivityEndpointsServiceconfigurationsGetSsh() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridconnectivity.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServiceConfigurationsClient().Get(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default", "default", "SSH", 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.ServiceConfigurationResource = armhybridconnectivity.ServiceConfigurationResource{ - // Type: to.Ptr("Microsoft.HybridConnectivity/endpoints/serviceConfigurations"), - // ID: to.Ptr("/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default/serviceconfigurations/SSH"), - // Properties: &armhybridconnectivity.ServiceConfigurationProperties{ - // Port: to.Ptr[int64](22), - // ServiceName: to.Ptr(armhybridconnectivity.ServiceNameSSH), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/ServiceConfigurationsGetWAC.json -func ExampleServiceConfigurationsClient_Get_hybridConnectivityEndpointsServiceconfigurationsGetWac() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridconnectivity.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServiceConfigurationsClient().Get(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default", "default", "WAC", 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.ServiceConfigurationResource = armhybridconnectivity.ServiceConfigurationResource{ - // Type: to.Ptr("Microsoft.HybridConnectivity/endpoints/serviceConfigurations"), - // ID: to.Ptr("/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default/serviceconfigurations/WAC"), - // Properties: &armhybridconnectivity.ServiceConfigurationProperties{ - // Port: to.Ptr[int64](6516), - // ServiceName: to.Ptr(armhybridconnectivity.ServiceNameWAC), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/ServiceConfigurationsPutSSH.json -func ExampleServiceConfigurationsClient_CreateOrupdate_serviceConfigurationsPutSsh() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridconnectivity.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServiceConfigurationsClient().CreateOrupdate(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default", "default", "SSH", armhybridconnectivity.ServiceConfigurationResource{ - Properties: &armhybridconnectivity.ServiceConfigurationProperties{ - Port: to.Ptr[int64](22), - ServiceName: to.Ptr(armhybridconnectivity.ServiceNameSSH), - }, - }, 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.ServiceConfigurationResource = armhybridconnectivity.ServiceConfigurationResource{ - // Type: to.Ptr("Microsoft.HybridConnectivity/endpoints/serviceConfigurations"), - // ID: to.Ptr("/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default/serviceconfigurations/SSH"), - // Properties: &armhybridconnectivity.ServiceConfigurationProperties{ - // Port: to.Ptr[int64](22), - // ProvisioningState: to.Ptr(armhybridconnectivity.ProvisioningStateSucceeded), - // ServiceName: to.Ptr(armhybridconnectivity.ServiceNameSSH), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/ServiceConfigurationsPutWAC.json -func ExampleServiceConfigurationsClient_CreateOrupdate_serviceConfigurationsPutWac() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridconnectivity.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServiceConfigurationsClient().CreateOrupdate(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default", "default", "WAC", armhybridconnectivity.ServiceConfigurationResource{ - Properties: &armhybridconnectivity.ServiceConfigurationProperties{ - Port: to.Ptr[int64](6516), - ServiceName: to.Ptr(armhybridconnectivity.ServiceNameWAC), - }, - }, 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.ServiceConfigurationResource = armhybridconnectivity.ServiceConfigurationResource{ - // Type: to.Ptr("Microsoft.HybridConnectivity/endpoints/serviceConfigurations"), - // ID: to.Ptr("/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default/serviceconfigurations/WAC"), - // Properties: &armhybridconnectivity.ServiceConfigurationProperties{ - // Port: to.Ptr[int64](6516), - // ProvisioningState: to.Ptr(armhybridconnectivity.ProvisioningStateSucceeded), - // ServiceName: to.Ptr(armhybridconnectivity.ServiceNameWAC), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/ServiceConfigurationsPatchSSH.json -func ExampleServiceConfigurationsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridconnectivity.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServiceConfigurationsClient().Update(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default", "default", "SSH", armhybridconnectivity.ServiceConfigurationResourcePatch{ - Properties: &armhybridconnectivity.ServiceConfigurationPropertiesPatch{ - Port: to.Ptr[int64](22), - }, - }, 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.ServiceConfigurationResource = armhybridconnectivity.ServiceConfigurationResource{ - // ID: to.Ptr("/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default/serviceConfigurations/SSH"), - // Properties: &armhybridconnectivity.ServiceConfigurationProperties{ - // Port: to.Ptr[int64](22), - // ServiceName: to.Ptr(armhybridconnectivity.ServiceNameSSH), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/ServiceConfigurationsDeleteSSH.json -func ExampleServiceConfigurationsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridconnectivity.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewServiceConfigurationsClient().Delete(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default", "default", "SSH", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/solutionconfigurations_client.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/solutionconfigurations_client.go new file mode 100644 index 000000000000..62d0293c43cd --- /dev/null +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/solutionconfigurations_client.go @@ -0,0 +1,391 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armhybridconnectivity + +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" +) + +// SolutionConfigurationsClient contains the methods for the SolutionConfigurations group. +// Don't use this type directly, use NewSolutionConfigurationsClient() instead. +type SolutionConfigurationsClient struct { + internal *arm.Client +} + +// NewSolutionConfigurationsClient creates a new instance of SolutionConfigurationsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewSolutionConfigurationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*SolutionConfigurationsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SolutionConfigurationsClient{ + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Create a SolutionConfiguration +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-12-01 +// - resourceURI - The fully qualified Azure Resource manager identifier of the resource. +// - solutionConfiguration - Represent Solution Configuration Resource. +// - resource - Resource create parameters. +// - options - SolutionConfigurationsClientCreateOrUpdateOptions contains the optional parameters for the SolutionConfigurationsClient.CreateOrUpdate +// method. +func (client *SolutionConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceURI string, solutionConfiguration string, resource SolutionConfiguration, options *SolutionConfigurationsClientCreateOrUpdateOptions) (SolutionConfigurationsClientCreateOrUpdateResponse, error) { + var err error + const operationName = "SolutionConfigurationsClient.CreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceURI, solutionConfiguration, resource, options) + if err != nil { + return SolutionConfigurationsClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SolutionConfigurationsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return SolutionConfigurationsClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *SolutionConfigurationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceURI string, solutionConfiguration string, resource SolutionConfiguration, _ *SolutionConfigurationsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + if solutionConfiguration == "" { + return nil, errors.New("parameter solutionConfiguration cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{solutionConfiguration}", url.PathEscape(solutionConfiguration)) + 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", "2024-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *SolutionConfigurationsClient) createOrUpdateHandleResponse(resp *http.Response) (SolutionConfigurationsClientCreateOrUpdateResponse, error) { + result := SolutionConfigurationsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SolutionConfiguration); err != nil { + return SolutionConfigurationsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete a SolutionConfiguration +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-12-01 +// - resourceURI - The fully qualified Azure Resource manager identifier of the resource. +// - solutionConfiguration - Represent Solution Configuration Resource. +// - options - SolutionConfigurationsClientDeleteOptions contains the optional parameters for the SolutionConfigurationsClient.Delete +// method. +func (client *SolutionConfigurationsClient) Delete(ctx context.Context, resourceURI string, solutionConfiguration string, options *SolutionConfigurationsClientDeleteOptions) (SolutionConfigurationsClientDeleteResponse, error) { + var err error + const operationName = "SolutionConfigurationsClient.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, resourceURI, solutionConfiguration, options) + if err != nil { + return SolutionConfigurationsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SolutionConfigurationsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return SolutionConfigurationsClientDeleteResponse{}, err + } + return SolutionConfigurationsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *SolutionConfigurationsClient) deleteCreateRequest(ctx context.Context, resourceURI string, solutionConfiguration string, _ *SolutionConfigurationsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + if solutionConfiguration == "" { + return nil, errors.New("parameter solutionConfiguration cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{solutionConfiguration}", url.PathEscape(solutionConfiguration)) + 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", "2024-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a SolutionConfiguration +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-12-01 +// - resourceURI - The fully qualified Azure Resource manager identifier of the resource. +// - solutionConfiguration - Represent Solution Configuration Resource. +// - options - SolutionConfigurationsClientGetOptions contains the optional parameters for the SolutionConfigurationsClient.Get +// method. +func (client *SolutionConfigurationsClient) Get(ctx context.Context, resourceURI string, solutionConfiguration string, options *SolutionConfigurationsClientGetOptions) (SolutionConfigurationsClientGetResponse, error) { + var err error + const operationName = "SolutionConfigurationsClient.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, resourceURI, solutionConfiguration, options) + if err != nil { + return SolutionConfigurationsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SolutionConfigurationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SolutionConfigurationsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *SolutionConfigurationsClient) getCreateRequest(ctx context.Context, resourceURI string, solutionConfiguration string, _ *SolutionConfigurationsClientGetOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + if solutionConfiguration == "" { + return nil, errors.New("parameter solutionConfiguration cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{solutionConfiguration}", url.PathEscape(solutionConfiguration)) + 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", "2024-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SolutionConfigurationsClient) getHandleResponse(resp *http.Response) (SolutionConfigurationsClientGetResponse, error) { + result := SolutionConfigurationsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SolutionConfiguration); err != nil { + return SolutionConfigurationsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List SolutionConfiguration resources by parent +// +// Generated from API version 2024-12-01 +// - resourceURI - The fully qualified Azure Resource manager identifier of the resource. +// - options - SolutionConfigurationsClientListOptions contains the optional parameters for the SolutionConfigurationsClient.NewListPager +// method. +func (client *SolutionConfigurationsClient) NewListPager(resourceURI string, options *SolutionConfigurationsClientListOptions) *runtime.Pager[SolutionConfigurationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[SolutionConfigurationsClientListResponse]{ + More: func(page SolutionConfigurationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SolutionConfigurationsClientListResponse) (SolutionConfigurationsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SolutionConfigurationsClient.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, resourceURI, options) + }, nil) + if err != nil { + return SolutionConfigurationsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *SolutionConfigurationsClient) listCreateRequest(ctx context.Context, resourceURI string, _ *SolutionConfigurationsClientListOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + 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", "2024-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *SolutionConfigurationsClient) listHandleResponse(resp *http.Response) (SolutionConfigurationsClientListResponse, error) { + result := SolutionConfigurationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SolutionConfigurationListResult); err != nil { + return SolutionConfigurationsClientListResponse{}, err + } + return result, nil +} + +// BeginSyncNow - Trigger immediate sync with source cloud +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-12-01 +// - resourceURI - The fully qualified Azure Resource manager identifier of the resource. +// - solutionConfiguration - Represent Solution Configuration Resource. +// - options - SolutionConfigurationsClientBeginSyncNowOptions contains the optional parameters for the SolutionConfigurationsClient.BeginSyncNow +// method. +func (client *SolutionConfigurationsClient) BeginSyncNow(ctx context.Context, resourceURI string, solutionConfiguration string, options *SolutionConfigurationsClientBeginSyncNowOptions) (*runtime.Poller[SolutionConfigurationsClientSyncNowResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.syncNow(ctx, resourceURI, solutionConfiguration, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SolutionConfigurationsClientSyncNowResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SolutionConfigurationsClientSyncNowResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// SyncNow - Trigger immediate sync with source cloud +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-12-01 +func (client *SolutionConfigurationsClient) syncNow(ctx context.Context, resourceURI string, solutionConfiguration string, options *SolutionConfigurationsClientBeginSyncNowOptions) (*http.Response, error) { + var err error + const operationName = "SolutionConfigurationsClient.BeginSyncNow" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.syncNowCreateRequest(ctx, resourceURI, solutionConfiguration, 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 +} + +// syncNowCreateRequest creates the SyncNow request. +func (client *SolutionConfigurationsClient) syncNowCreateRequest(ctx context.Context, resourceURI string, solutionConfiguration string, _ *SolutionConfigurationsClientBeginSyncNowOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}/syncNow" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + if solutionConfiguration == "" { + return nil, errors.New("parameter solutionConfiguration cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{solutionConfiguration}", url.PathEscape(solutionConfiguration)) + 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", "2024-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Update - Update a SolutionConfiguration +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-12-01 +// - resourceURI - The fully qualified Azure Resource manager identifier of the resource. +// - solutionConfiguration - Represent Solution Configuration Resource. +// - properties - The resource properties to be updated. +// - options - SolutionConfigurationsClientUpdateOptions contains the optional parameters for the SolutionConfigurationsClient.Update +// method. +func (client *SolutionConfigurationsClient) Update(ctx context.Context, resourceURI string, solutionConfiguration string, properties SolutionConfiguration, options *SolutionConfigurationsClientUpdateOptions) (SolutionConfigurationsClientUpdateResponse, error) { + var err error + const operationName = "SolutionConfigurationsClient.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, resourceURI, solutionConfiguration, properties, options) + if err != nil { + return SolutionConfigurationsClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SolutionConfigurationsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SolutionConfigurationsClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *SolutionConfigurationsClient) updateCreateRequest(ctx context.Context, resourceURI string, solutionConfiguration string, properties SolutionConfiguration, _ *SolutionConfigurationsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + if solutionConfiguration == "" { + return nil, errors.New("parameter solutionConfiguration cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{solutionConfiguration}", url.PathEscape(solutionConfiguration)) + 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", "2024-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *SolutionConfigurationsClient) updateHandleResponse(resp *http.Response) (SolutionConfigurationsClientUpdateResponse, error) { + result := SolutionConfigurationsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SolutionConfiguration); err != nil { + return SolutionConfigurationsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/solutionconfigurations_client_example_test.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/solutionconfigurations_client_example_test.go new file mode 100644 index 000000000000..6cce14fb7257 --- /dev/null +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/solutionconfigurations_client_example_test.go @@ -0,0 +1,301 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armhybridconnectivity_test + +import ( + "context" + "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/hybridconnectivity/armhybridconnectivity/v2" + "log" +) + +// Generated from example definition: 2024-12-01/SolutionConfigurations_CreateOrUpdate.json +func ExampleSolutionConfigurationsClient_CreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridconnectivity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSolutionConfigurationsClient().CreateOrUpdate(ctx, "ymuj", "keebwujt", armhybridconnectivity.SolutionConfiguration{ + Properties: &armhybridconnectivity.SolutionConfigurationProperties{ + SolutionType: to.Ptr("nmtqllkyohwtsthxaimsye"), + SolutionSettings: &armhybridconnectivity.SolutionSettings{}, + }, + }, 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 = armhybridconnectivity.SolutionConfigurationsClientCreateOrUpdateResponse{ + // SolutionConfiguration: &armhybridconnectivity.SolutionConfiguration{ + // Properties: &armhybridconnectivity.SolutionConfigurationProperties{ + // SolutionType: to.Ptr("nmtqllkyohwtsthxaimsye"), + // SolutionSettings: &armhybridconnectivity.SolutionSettings{ + // }, + // ProvisioningState: to.Ptr(armhybridconnectivity.ResourceProvisioningStateSucceeded), + // Status: to.Ptr(armhybridconnectivity.SolutionConfigurationStatusNew), + // StatusDetails: to.Ptr("rqbrzildwecankrpukkbjjqrczxboz"), + // LastSyncTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-20T03:24:15.820Z"); return t}()), + // }, + // ID: to.Ptr("/subscriptions/testSubcrptions/resourceGroups/testResourceGroup/providers/Microsoft.HybridConnectivity/SolutionConfigurations/qpwubemzmootxmtlxaerir"), + // Name: to.Ptr("qpwubemzmootxmtlxaerir"), + // Type: to.Ptr("uknrk"), + // SystemData: &armhybridconnectivity.SystemData{ + // CreatedBy: to.Ptr("rpxzkcrobprrdvuoqxz"), + // CreatedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // LastModifiedBy: to.Ptr("jidegyskxi"), + // LastModifiedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2024-12-01/SolutionConfigurations_Delete.json +func ExampleSolutionConfigurationsClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridconnectivity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSolutionConfigurationsClient().Delete(ctx, "ymuj", "stu", 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 = armhybridconnectivity.SolutionConfigurationsClientDeleteResponse{ + // } +} + +// Generated from example definition: 2024-12-01/SolutionConfigurations_Get.json +func ExampleSolutionConfigurationsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridconnectivity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSolutionConfigurationsClient().Get(ctx, "ymuj", "tks", 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 = armhybridconnectivity.SolutionConfigurationsClientGetResponse{ + // SolutionConfiguration: &armhybridconnectivity.SolutionConfiguration{ + // Properties: &armhybridconnectivity.SolutionConfigurationProperties{ + // SolutionType: to.Ptr("nmtqllkyohwtsthxaimsye"), + // SolutionSettings: &armhybridconnectivity.SolutionSettings{ + // }, + // ProvisioningState: to.Ptr(armhybridconnectivity.ResourceProvisioningStateSucceeded), + // Status: to.Ptr(armhybridconnectivity.SolutionConfigurationStatusNew), + // StatusDetails: to.Ptr("rqbrzildwecankrpukkbjjqrczxboz"), + // LastSyncTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-20T03:24:15.820Z"); return t}()), + // }, + // ID: to.Ptr("/subscriptions/testSubcrptions/resourceGroups/testResourceGroup/providers/Microsoft.HybridConnectivity/SolutionConfigurations/qpwubemzmootxmtlxaerir"), + // Name: to.Ptr("qpwubemzmootxmtlxaerir"), + // Type: to.Ptr("uknrk"), + // SystemData: &armhybridconnectivity.SystemData{ + // CreatedBy: to.Ptr("rpxzkcrobprrdvuoqxz"), + // CreatedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // LastModifiedBy: to.Ptr("jidegyskxi"), + // LastModifiedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2024-12-01/SolutionConfigurations_List.json +func ExampleSolutionConfigurationsClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridconnectivity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewSolutionConfigurationsClient().NewListPager("ymuj", 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 = armhybridconnectivity.SolutionConfigurationsClientListResponse{ + // SolutionConfigurationListResult: armhybridconnectivity.SolutionConfigurationListResult{ + // Value: []*armhybridconnectivity.SolutionConfiguration{ + // { + // Properties: &armhybridconnectivity.SolutionConfigurationProperties{ + // SolutionType: to.Ptr("Microsoft.AssetManagement"), + // SolutionSettings: &armhybridconnectivity.SolutionSettings{ + // }, + // ProvisioningState: to.Ptr(armhybridconnectivity.ResourceProvisioningStateSucceeded), + // StatusDetails: to.Ptr("Aws authorization validation pending in Aws account"), + // LastSyncTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-20T03:24:15.820Z"); return t}()), + // }, + // ID: to.Ptr("/subscriptions/testSubcrptions/resourceGroups/testResourceGroup/providers/Microsoft.HybridConnectivity/SolutionConfigurations/solutionconfigurationtest"), + // Name: to.Ptr("solutionconfigurationtest"), + // Type: to.Ptr("microsoft.hybridconnectivity/solutionconfigurations"), + // SystemData: &armhybridconnectivity.SystemData{ + // CreatedBy: to.Ptr("rpxzkcrobprrdvuoqxz"), + // CreatedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // LastModifiedBy: to.Ptr("jidegyskxi"), + // LastModifiedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // }, + // }, + // { + // Properties: &armhybridconnectivity.SolutionConfigurationProperties{ + // SolutionType: to.Ptr("Microsoft.HybridCompute"), + // SolutionSettings: &armhybridconnectivity.SolutionSettings{ + // }, + // ProvisioningState: to.Ptr(armhybridconnectivity.ResourceProvisioningStateSucceeded), + // StatusDetails: to.Ptr("Aws authorization validation succeeded in Aws account"), + // LastSyncTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-20T03:24:15.820Z"); return t}()), + // }, + // ID: to.Ptr("/subscriptions/testSubcrptions/resourceGroups/testResourceGroup/providers/Microsoft.HybridConnectivity/SolutionConfigurations/solutionconfigurationtest2"), + // Name: to.Ptr("solutionconfigurationtest2"), + // Type: to.Ptr("microsoft.hybridconnectivity/solutionconfigurations"), + // SystemData: &armhybridconnectivity.SystemData{ + // CreatedBy: to.Ptr("rpxzkcrobprrdvuoqxz"), + // CreatedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // LastModifiedBy: to.Ptr("jidegyskxi"), + // LastModifiedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2024-12-01/SolutionConfigurations_SyncNow.json +func ExampleSolutionConfigurationsClient_BeginSyncNow() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridconnectivity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSolutionConfigurationsClient().BeginSyncNow(ctx, "ymuj", "tks", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %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 = armhybridconnectivity.SolutionConfigurationsClientSyncNowResponse{ + // OperationStatusResult: &armhybridconnectivity.OperationStatusResult{ + // ID: to.Ptr("/subscriptions/5ACC4579-DB34-4C2F-8F8C-25061168F342/providers/Microsoft.HybridConnectivity/PublicCloudConnectors/esixipkbydb"), + // Name: to.Ptr("svqtraeuwvyvblujlvqilypwpdrt"), + // Status: to.Ptr("bevmrejij"), + // PercentComplete: to.Ptr[float64](15), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-10-02T18:38:19.143Z"); return t}()), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-10-02T18:38:19.143Z"); return t}()), + // Operations: []*armhybridconnectivity.OperationStatusResult{ + // }, + // Error: &armhybridconnectivity.ErrorDetail{ + // Code: to.Ptr("ykzvluyqiftfsumgvwzdh"), + // Message: to.Ptr("krbjgtqkjgiux"), + // Target: to.Ptr("nsaucxt"), + // Details: []*armhybridconnectivity.ErrorDetail{ + // }, + // AdditionalInfo: []*armhybridconnectivity.ErrorAdditionalInfo{ + // { + // Type: to.Ptr("qivvrewsjvcildjgwwytgimwklh"), + // Info: &armhybridconnectivity.ErrorAdditionalInfoInfo{ + // }, + // }, + // }, + // }, + // }, + // } +} + +// Generated from example definition: 2024-12-01/SolutionConfigurations_Update.json +func ExampleSolutionConfigurationsClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridconnectivity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSolutionConfigurationsClient().Update(ctx, "ymuj", "dxt", armhybridconnectivity.SolutionConfiguration{ + Properties: &armhybridconnectivity.SolutionConfigurationProperties{ + SolutionType: to.Ptr("myzljlstvmgkp"), + SolutionSettings: &armhybridconnectivity.SolutionSettings{}, + }, + }, 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 = armhybridconnectivity.SolutionConfigurationsClientUpdateResponse{ + // SolutionConfiguration: &armhybridconnectivity.SolutionConfiguration{ + // Properties: &armhybridconnectivity.SolutionConfigurationProperties{ + // SolutionType: to.Ptr("nmtqllkyohwtsthxaimsye"), + // SolutionSettings: &armhybridconnectivity.SolutionSettings{ + // }, + // ProvisioningState: to.Ptr(armhybridconnectivity.ResourceProvisioningStateSucceeded), + // Status: to.Ptr(armhybridconnectivity.SolutionConfigurationStatusNew), + // StatusDetails: to.Ptr("rqbrzildwecankrpukkbjjqrczxboz"), + // LastSyncTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-20T03:24:15.820Z"); return t}()), + // }, + // ID: to.Ptr("/subscriptions/testSubcrptions/resourceGroups/testResourceGroup/providers/Microsoft.HybridConnectivity/SolutionConfigurations/qpwubemzmootxmtlxaerir"), + // Name: to.Ptr("qpwubemzmootxmtlxaerir"), + // Type: to.Ptr("uknrk"), + // SystemData: &armhybridconnectivity.SystemData{ + // CreatedBy: to.Ptr("rpxzkcrobprrdvuoqxz"), + // CreatedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // LastModifiedBy: to.Ptr("jidegyskxi"), + // LastModifiedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/solutiontypes_client.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/solutiontypes_client.go new file mode 100644 index 000000000000..41a56f3d87f7 --- /dev/null +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/solutiontypes_client.go @@ -0,0 +1,219 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armhybridconnectivity + +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" +) + +// SolutionTypesClient contains the methods for the SolutionTypes group. +// Don't use this type directly, use NewSolutionTypesClient() instead. +type SolutionTypesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSolutionTypesClient creates a new instance of SolutionTypesClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewSolutionTypesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SolutionTypesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SolutionTypesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get a SolutionTypeResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-12-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - solutionType - Solution Type resource +// - options - SolutionTypesClientGetOptions contains the optional parameters for the SolutionTypesClient.Get method. +func (client *SolutionTypesClient) Get(ctx context.Context, resourceGroupName string, solutionType string, options *SolutionTypesClientGetOptions) (SolutionTypesClientGetResponse, error) { + var err error + const operationName = "SolutionTypesClient.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, solutionType, options) + if err != nil { + return SolutionTypesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SolutionTypesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SolutionTypesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *SolutionTypesClient) getCreateRequest(ctx context.Context, resourceGroupName string, solutionType string, _ *SolutionTypesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/solutionTypes/{solutionType}" + 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 solutionType == "" { + return nil, errors.New("parameter solutionType cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{solutionType}", url.PathEscape(solutionType)) + 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", "2024-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SolutionTypesClient) getHandleResponse(resp *http.Response) (SolutionTypesClientGetResponse, error) { + result := SolutionTypesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SolutionTypeResource); err != nil { + return SolutionTypesClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List SolutionTypeResource resources by resource group +// +// Generated from API version 2024-12-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - SolutionTypesClientListByResourceGroupOptions contains the optional parameters for the SolutionTypesClient.NewListByResourceGroupPager +// method. +func (client *SolutionTypesClient) NewListByResourceGroupPager(resourceGroupName string, options *SolutionTypesClientListByResourceGroupOptions) *runtime.Pager[SolutionTypesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[SolutionTypesClientListByResourceGroupResponse]{ + More: func(page SolutionTypesClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SolutionTypesClientListByResourceGroupResponse) (SolutionTypesClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SolutionTypesClient.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 SolutionTypesClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *SolutionTypesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *SolutionTypesClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/solutionTypes" + 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", "2024-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *SolutionTypesClient) listByResourceGroupHandleResponse(resp *http.Response) (SolutionTypesClientListByResourceGroupResponse, error) { + result := SolutionTypesClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SolutionTypeResourceListResult); err != nil { + return SolutionTypesClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List SolutionTypeResource resources by subscription ID +// +// Generated from API version 2024-12-01 +// - options - SolutionTypesClientListBySubscriptionOptions contains the optional parameters for the SolutionTypesClient.NewListBySubscriptionPager +// method. +func (client *SolutionTypesClient) NewListBySubscriptionPager(options *SolutionTypesClientListBySubscriptionOptions) *runtime.Pager[SolutionTypesClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[SolutionTypesClientListBySubscriptionResponse]{ + More: func(page SolutionTypesClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SolutionTypesClientListBySubscriptionResponse) (SolutionTypesClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SolutionTypesClient.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 SolutionTypesClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *SolutionTypesClient) listBySubscriptionCreateRequest(ctx context.Context, _ *SolutionTypesClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HybridConnectivity/solutionTypes" + 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", "2024-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *SolutionTypesClient) listBySubscriptionHandleResponse(resp *http.Response) (SolutionTypesClientListBySubscriptionResponse, error) { + result := SolutionTypesClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SolutionTypeResourceListResult); err != nil { + return SolutionTypesClientListBySubscriptionResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/solutiontypes_client_example_test.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/solutiontypes_client_example_test.go new file mode 100644 index 000000000000..6624be46c314 --- /dev/null +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/solutiontypes_client_example_test.go @@ -0,0 +1,194 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armhybridconnectivity_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/v2" + "log" +) + +// Generated from example definition: 2024-12-01/SolutionTypes_Get.json +func ExampleSolutionTypesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridconnectivity.NewClientFactory("5ACC4579-DB34-4C2F-8F8C-25061168F342", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSolutionTypesClient().Get(ctx, "rgpublicCloud", "lulzqllpu", 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 = armhybridconnectivity.SolutionTypesClientGetResponse{ + // SolutionTypeResource: &armhybridconnectivity.SolutionTypeResource{ + // Properties: &armhybridconnectivity.SolutionTypeProperties{ + // SolutionType: to.Ptr("tjtoeycxhyqxtgd"), + // Description: to.Ptr("wxyxcvtzuxgodtlanjevedwfdwnznc"), + // SupportedAzureRegions: []*string{ + // to.Ptr("cimocdh"), + // }, + // SolutionSettings: []*armhybridconnectivity.SolutionTypeSettingsProperties{ + // { + // Name: to.Ptr("tepghdgbefujhnnue"), + // DisplayName: to.Ptr("mwlzepoin"), + // Type: to.Ptr("je"), + // Description: to.Ptr("soq"), + // AllowedValues: []*string{ + // to.Ptr("pwizyngpkpxsllpluffjspx"), + // }, + // DefaultValue: to.Ptr("laekyetgapdpxyqervqaqfscfwagek"), + // }, + // }, + // }, + // ID: to.Ptr("/subscriptions/testSubcrptions/resourceGroups/testResourceGroup/providers/Microsoft.HybridConnectivity/solutionTypes/j"), + // Name: to.Ptr("xczyyxuphhacyyj"), + // Type: to.Ptr("mf"), + // SystemData: &armhybridconnectivity.SystemData{ + // CreatedBy: to.Ptr("rpxzkcrobprrdvuoqxz"), + // CreatedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // LastModifiedBy: to.Ptr("jidegyskxi"), + // LastModifiedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2024-12-01/SolutionTypes_ListByResourceGroup.json +func ExampleSolutionTypesClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridconnectivity.NewClientFactory("5ACC4579-DB34-4C2F-8F8C-25061168F342", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewSolutionTypesClient().NewListByResourceGroupPager("rgpublicCloud", 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 = armhybridconnectivity.SolutionTypesClientListByResourceGroupResponse{ + // SolutionTypeResourceListResult: armhybridconnectivity.SolutionTypeResourceListResult{ + // Value: []*armhybridconnectivity.SolutionTypeResource{ + // { + // Properties: &armhybridconnectivity.SolutionTypeProperties{ + // SolutionType: to.Ptr("j"), + // Description: to.Ptr("mhasmuazxsr"), + // SupportedAzureRegions: []*string{ + // to.Ptr("jfvkgljymtuzfwbumgabpdpjjnxit"), + // }, + // SolutionSettings: []*armhybridconnectivity.SolutionTypeSettingsProperties{ + // { + // Name: to.Ptr("eepvybtmsjwgcpf"), + // DisplayName: to.Ptr("npxunbwkjrklbjsvdryzsjtecm"), + // Type: to.Ptr("fngmzlffmwmrglepeyce"), + // Description: to.Ptr("vdtvoysdagvae"), + // AllowedValues: []*string{ + // to.Ptr("cgbkgbmsgsfofmcrjerg"), + // }, + // DefaultValue: to.Ptr("knshmo"), + // }, + // }, + // }, + // ID: to.Ptr("/subscriptions/testSubcrptions/resourceGroups/testResourceGroup/providers/Microsoft.HybridConnectivity/solutionTypes/j"), + // Name: to.Ptr("yzgpvbtzwvijawjgfvnhgbqefqq"), + // Type: to.Ptr("vamwfnqqpjosjnomwbkwnlnrg"), + // SystemData: &armhybridconnectivity.SystemData{ + // CreatedBy: to.Ptr("rpxzkcrobprrdvuoqxz"), + // CreatedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // LastModifiedBy: to.Ptr("jidegyskxi"), + // LastModifiedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2024-12-01/SolutionTypes_ListBySubscription.json +func ExampleSolutionTypesClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridconnectivity.NewClientFactory("5ACC4579-DB34-4C2F-8F8C-25061168F342", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewSolutionTypesClient().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 = armhybridconnectivity.SolutionTypesClientListBySubscriptionResponse{ + // SolutionTypeResourceListResult: armhybridconnectivity.SolutionTypeResourceListResult{ + // Value: []*armhybridconnectivity.SolutionTypeResource{ + // { + // Properties: &armhybridconnectivity.SolutionTypeProperties{ + // SolutionType: to.Ptr("dembhpcydwoiyszmjtniletpy"), + // Description: to.Ptr("fkegiumpjdwgkde"), + // SupportedAzureRegions: []*string{ + // to.Ptr("ujawbfint"), + // }, + // SolutionSettings: []*armhybridconnectivity.SolutionTypeSettingsProperties{ + // { + // Name: to.Ptr("i"), + // DisplayName: to.Ptr("forzmqskffaub"), + // Type: to.Ptr("d"), + // Description: to.Ptr("cbyxsxfsaye"), + // AllowedValues: []*string{ + // to.Ptr("uecqnmmssdeusxejcxrtkskfugvl"), + // }, + // DefaultValue: to.Ptr("uzwiymoxrummkoowwvzjhyazeavzr"), + // }, + // }, + // }, + // ID: to.Ptr("/subscriptions/testSubcrptions/resourceGroups/testResourceGroup/providers/Microsoft.HybridConnectivity/solutionTypes/i"), + // Name: to.Ptr("jtlxwihbuftmaobxfmfjojalhpwrv"), + // Type: to.Ptr("zditfautattfhnffvjw"), + // SystemData: &armhybridconnectivity.SystemData{ + // CreatedBy: to.Ptr("rpxzkcrobprrdvuoqxz"), + // CreatedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // LastModifiedBy: to.Ptr("jidegyskxi"), + // LastModifiedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/time_rfc3339.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/time_rfc3339.go index 6bb38b46697d..a973c25378da 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/time_rfc3339.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/time_rfc3339.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armhybridconnectivity @@ -19,12 +15,16 @@ import ( ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) type dateTimeRFC3339 time.Time @@ -40,17 +40,36 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) { } func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { + if len(data) == 0 { + return nil + } + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } @@ -61,6 +80,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error { return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return @@ -74,7 +97,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC3339 diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/tsp-location.yaml b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/tsp-location.yaml new file mode 100644 index 000000000000..a45607609641 --- /dev/null +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/hybridconnectivity/PublicCloud.Management +commit: df55cd8178ddd870dbd0c3b1e25c80e3ff48826c +repo: Azure/azure-rest-api-specs +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/CHANGELOG.md b/sdk/resourcemanager/iotoperations/armiotoperations/CHANGELOG.md index d68fe58cc2ef..3d837a0f1f1e 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/CHANGELOG.md +++ b/sdk/resourcemanager/iotoperations/armiotoperations/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 1.0.0 (2024-11-19) +### Breaking Changes + +- `ManagedServiceIdentityTypeSystemAndUserAssigned` from enum `ManagedServiceIdentityType` has been removed + +### Features Added + +- New value `ManagedServiceIdentityTypeSystemAssignedUserAssigned` added to enum type `ManagedServiceIdentityType` + + ## 0.1.0 (2024-10-24) ### Other Changes diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/constants.go b/sdk/resourcemanager/iotoperations/armiotoperations/constants.go index 016557525542..1cf40a4b83ed 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/constants.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/constants.go @@ -6,7 +6,7 @@ package armiotoperations const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iotoperations/armiotoperations" - moduleVersion = "v0.1.0" + moduleVersion = "v1.0.0" ) // ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. @@ -454,10 +454,10 @@ type ManagedServiceIdentityType string const ( // ManagedServiceIdentityTypeNone - No managed identity. ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" - // ManagedServiceIdentityTypeSystemAndUserAssigned - System and user assigned managed identity. - ManagedServiceIdentityTypeSystemAndUserAssigned ManagedServiceIdentityType = "SystemAssigned,UserAssigned" // ManagedServiceIdentityTypeSystemAssigned - System assigned managed identity. ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned" + // ManagedServiceIdentityTypeSystemAssignedUserAssigned - System and user assigned managed identity. + ManagedServiceIdentityTypeSystemAssignedUserAssigned ManagedServiceIdentityType = "SystemAssigned,UserAssigned" // ManagedServiceIdentityTypeUserAssigned - User assigned managed identity. ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" ) @@ -466,8 +466,8 @@ const ( func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { return []ManagedServiceIdentityType{ ManagedServiceIdentityTypeNone, - ManagedServiceIdentityTypeSystemAndUserAssigned, ManagedServiceIdentityTypeSystemAssigned, + ManagedServiceIdentityTypeSystemAssignedUserAssigned, ManagedServiceIdentityTypeUserAssigned, } } diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/dataflowendpoint_client_example_test.go b/sdk/resourcemanager/iotoperations/armiotoperations/dataflowendpoint_client_example_test.go index 804413411bf4..3bd088772c39 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/dataflowendpoint_client_example_test.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/dataflowendpoint_client_example_test.go @@ -646,6 +646,99 @@ func ExampleDataflowEndpointClient_BeginCreateOrUpdate_dataflowEndpointCreateOrU // } } +// Generated from example definition: 2024-11-01/DataflowEndpoint_CreateOrUpdate_MQTT.json +func ExampleDataflowEndpointClient_BeginCreateOrUpdate_dataflowEndpointCreateOrUpdateMqtt() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armiotoperations.NewClientFactory("F8C729F9-DF9C-4743-848F-96EE433D8E53", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewDataflowEndpointClient().BeginCreateOrUpdate(ctx, "rgiotoperations", "resource-name123", "generic-mqtt-broker-endpoint", armiotoperations.DataflowEndpointResource{ + Properties: &armiotoperations.DataflowEndpointProperties{ + EndpointType: to.Ptr(armiotoperations.EndpointTypeMqtt), + MqttSettings: &armiotoperations.DataflowEndpointMqtt{ + Host: to.Ptr("example.broker.local:1883"), + Authentication: &armiotoperations.DataflowEndpointMqttAuthentication{ + Method: to.Ptr(armiotoperations.MqttAuthMethodX509Certificate), + X509CertificateSettings: &armiotoperations.DataflowEndpointAuthenticationX509{ + SecretRef: to.Ptr("example-secret"), + }, + }, + TLS: &armiotoperations.TLSProperties{ + Mode: to.Ptr(armiotoperations.OperationalModeDisabled), + }, + ClientIDPrefix: to.Ptr("factory-gateway"), + Retain: to.Ptr(armiotoperations.MqttRetainTypeKeep), + SessionExpirySeconds: to.Ptr[int32](3600), + Qos: to.Ptr[int32](1), + Protocol: to.Ptr(armiotoperations.BrokerProtocolTypeWebSockets), + MaxInflightMessages: to.Ptr[int32](100), + KeepAliveSeconds: to.Ptr[int32](60), + }, + }, + ExtendedLocation: &armiotoperations.ExtendedLocation{ + Name: to.Ptr("qmbrfwcpwwhggszhrdjv"), + Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %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 = armiotoperations.DataflowEndpointClientCreateOrUpdateResponse{ + // DataflowEndpointResource: &armiotoperations.DataflowEndpointResource{ + // Properties: &armiotoperations.DataflowEndpointProperties{ + // EndpointType: to.Ptr(armiotoperations.EndpointTypeMqtt), + // MqttSettings: &armiotoperations.DataflowEndpointMqtt{ + // Host: to.Ptr("example.broker.local:1883"), + // Authentication: &armiotoperations.DataflowEndpointMqttAuthentication{ + // Method: to.Ptr(armiotoperations.MqttAuthMethodX509Certificate), + // X509CertificateSettings: &armiotoperations.DataflowEndpointAuthenticationX509{ + // SecretRef: to.Ptr("example-secret"), + // }, + // }, + // TLS: &armiotoperations.TLSProperties{ + // Mode: to.Ptr(armiotoperations.OperationalModeDisabled), + // }, + // ClientIDPrefix: to.Ptr("factory-gateway"), + // Retain: to.Ptr(armiotoperations.MqttRetainTypeKeep), + // SessionExpirySeconds: to.Ptr[int32](3600), + // Qos: to.Ptr[int32](1), + // Protocol: to.Ptr(armiotoperations.BrokerProtocolTypeWebSockets), + // MaxInflightMessages: to.Ptr[int32](100), + // KeepAliveSeconds: to.Ptr[int32](60), + // }, + // ProvisioningState: to.Ptr(armiotoperations.ProvisioningStateSucceeded), + // }, + // ExtendedLocation: &armiotoperations.ExtendedLocation{ + // Name: to.Ptr("qmbrfwcpwwhggszhrdjv"), + // Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation), + // }, + // ID: to.Ptr("/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/dataflowEndpoints/resource-name123"), + // Name: to.Ptr("zyhxscudobzfacetvgyjiav"), + // Type: to.Ptr("iay"), + // SystemData: &armiotoperations.SystemData{ + // CreatedBy: to.Ptr("ssvaslsmudloholronopqyxjcu"), + // CreatedByType: to.Ptr(armiotoperations.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()), + // LastModifiedBy: to.Ptr("gnicpuszwd"), + // LastModifiedByType: to.Ptr(armiotoperations.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()), + // }, + // }, + // } +} + // Generated from example definition: 2024-11-01/DataflowEndpoint_CreateOrUpdate_MaximumSet_Gen.json func ExampleDataflowEndpointClient_BeginCreateOrUpdate_dataflowEndpointCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) @@ -967,99 +1060,6 @@ func ExampleDataflowEndpointClient_BeginCreateOrUpdate_dataflowEndpointCreateOrU // } } -// Generated from example definition: 2024-11-01/DataflowEndpoint_CreateOrUpdate_MQTT.json -func ExampleDataflowEndpointClient_BeginCreateOrUpdate_dataflowEndpointCreateOrUpdateMqtt() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armiotoperations.NewClientFactory("F8C729F9-DF9C-4743-848F-96EE433D8E53", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDataflowEndpointClient().BeginCreateOrUpdate(ctx, "rgiotoperations", "resource-name123", "generic-mqtt-broker-endpoint", armiotoperations.DataflowEndpointResource{ - Properties: &armiotoperations.DataflowEndpointProperties{ - EndpointType: to.Ptr(armiotoperations.EndpointTypeMqtt), - MqttSettings: &armiotoperations.DataflowEndpointMqtt{ - Host: to.Ptr("example.broker.local:1883"), - Authentication: &armiotoperations.DataflowEndpointMqttAuthentication{ - Method: to.Ptr(armiotoperations.MqttAuthMethodX509Certificate), - X509CertificateSettings: &armiotoperations.DataflowEndpointAuthenticationX509{ - SecretRef: to.Ptr("example-secret"), - }, - }, - TLS: &armiotoperations.TLSProperties{ - Mode: to.Ptr(armiotoperations.OperationalModeDisabled), - }, - ClientIDPrefix: to.Ptr("factory-gateway"), - Retain: to.Ptr(armiotoperations.MqttRetainTypeKeep), - SessionExpirySeconds: to.Ptr[int32](3600), - Qos: to.Ptr[int32](1), - Protocol: to.Ptr(armiotoperations.BrokerProtocolTypeWebSockets), - MaxInflightMessages: to.Ptr[int32](100), - KeepAliveSeconds: to.Ptr[int32](60), - }, - }, - ExtendedLocation: &armiotoperations.ExtendedLocation{ - Name: to.Ptr("qmbrfwcpwwhggszhrdjv"), - Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %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 = armiotoperations.DataflowEndpointClientCreateOrUpdateResponse{ - // DataflowEndpointResource: &armiotoperations.DataflowEndpointResource{ - // Properties: &armiotoperations.DataflowEndpointProperties{ - // EndpointType: to.Ptr(armiotoperations.EndpointTypeMqtt), - // MqttSettings: &armiotoperations.DataflowEndpointMqtt{ - // Host: to.Ptr("example.broker.local:1883"), - // Authentication: &armiotoperations.DataflowEndpointMqttAuthentication{ - // Method: to.Ptr(armiotoperations.MqttAuthMethodX509Certificate), - // X509CertificateSettings: &armiotoperations.DataflowEndpointAuthenticationX509{ - // SecretRef: to.Ptr("example-secret"), - // }, - // }, - // TLS: &armiotoperations.TLSProperties{ - // Mode: to.Ptr(armiotoperations.OperationalModeDisabled), - // }, - // ClientIDPrefix: to.Ptr("factory-gateway"), - // Retain: to.Ptr(armiotoperations.MqttRetainTypeKeep), - // SessionExpirySeconds: to.Ptr[int32](3600), - // Qos: to.Ptr[int32](1), - // Protocol: to.Ptr(armiotoperations.BrokerProtocolTypeWebSockets), - // MaxInflightMessages: to.Ptr[int32](100), - // KeepAliveSeconds: to.Ptr[int32](60), - // }, - // ProvisioningState: to.Ptr(armiotoperations.ProvisioningStateSucceeded), - // }, - // ExtendedLocation: &armiotoperations.ExtendedLocation{ - // Name: to.Ptr("qmbrfwcpwwhggszhrdjv"), - // Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation), - // }, - // ID: to.Ptr("/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/dataflowEndpoints/resource-name123"), - // Name: to.Ptr("zyhxscudobzfacetvgyjiav"), - // Type: to.Ptr("iay"), - // SystemData: &armiotoperations.SystemData{ - // CreatedBy: to.Ptr("ssvaslsmudloholronopqyxjcu"), - // CreatedByType: to.Ptr(armiotoperations.CreatedByTypeUser), - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()), - // LastModifiedBy: to.Ptr("gnicpuszwd"), - // LastModifiedByType: to.Ptr(armiotoperations.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()), - // }, - // }, - // } -} - // Generated from example definition: 2024-11-01/DataflowEndpoint_Delete_MaximumSet_Gen.json func ExampleDataflowEndpointClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/fake/broker_server.go b/sdk/resourcemanager/iotoperations/armiotoperations/fake/broker_server.go index dffe57a392ac..67b5ac3a9a4e 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/fake/broker_server.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/fake/broker_server.go @@ -25,7 +25,7 @@ type BrokerServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, resource armiotoperations.BrokerResource, options *armiotoperations.BrokerClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armiotoperations.BrokerClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method BrokerClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, options *armiotoperations.BrokerClientBeginDeleteOptions) (resp azfake.PollerResponder[armiotoperations.BrokerClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method BrokerClient.Get @@ -70,23 +70,42 @@ func (b *BrokerServerTransport) Do(req *http.Request) (*http.Response, error) { } func (b *BrokerServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "BrokerClient.BeginCreateOrUpdate": - resp, err = b.dispatchBeginCreateOrUpdate(req) - case "BrokerClient.BeginDelete": - resp, err = b.dispatchBeginDelete(req) - case "BrokerClient.Get": - resp, err = b.dispatchGet(req) - case "BrokerClient.NewListByResourceGroupPager": - resp, err = b.dispatchNewListByResourceGroupPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if brokerServerTransportInterceptor != nil { + res.resp, res.err, intercepted = brokerServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "BrokerClient.BeginCreateOrUpdate": + res.resp, res.err = b.dispatchBeginCreateOrUpdate(req) + case "BrokerClient.BeginDelete": + res.resp, res.err = b.dispatchBeginDelete(req) + case "BrokerClient.Get": + res.resp, res.err = b.dispatchGet(req) + case "BrokerClient.NewListByResourceGroupPager": + res.resp, res.err = b.dispatchNewListByResourceGroupPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (b *BrokerServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -178,9 +197,9 @@ func (b *BrokerServerTransport) dispatchBeginDelete(req *http.Request) (*http.Re return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { b.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { b.beginDelete.remove(req) @@ -266,3 +285,9 @@ func (b *BrokerServerTransport) dispatchNewListByResourceGroupPager(req *http.Re } return resp, nil } + +// set this to conditionally intercept incoming requests to BrokerServerTransport +var brokerServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/fake/brokerauthentication_server.go b/sdk/resourcemanager/iotoperations/armiotoperations/fake/brokerauthentication_server.go index c5cead819a84..41db4c63b617 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/fake/brokerauthentication_server.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/fake/brokerauthentication_server.go @@ -25,7 +25,7 @@ type BrokerAuthenticationServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, authenticationName string, resource armiotoperations.BrokerAuthenticationResource, options *armiotoperations.BrokerAuthenticationClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armiotoperations.BrokerAuthenticationClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method BrokerAuthenticationClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, authenticationName string, options *armiotoperations.BrokerAuthenticationClientBeginDeleteOptions) (resp azfake.PollerResponder[armiotoperations.BrokerAuthenticationClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method BrokerAuthenticationClient.Get @@ -70,23 +70,42 @@ func (b *BrokerAuthenticationServerTransport) Do(req *http.Request) (*http.Respo } func (b *BrokerAuthenticationServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "BrokerAuthenticationClient.BeginCreateOrUpdate": - resp, err = b.dispatchBeginCreateOrUpdate(req) - case "BrokerAuthenticationClient.BeginDelete": - resp, err = b.dispatchBeginDelete(req) - case "BrokerAuthenticationClient.Get": - resp, err = b.dispatchGet(req) - case "BrokerAuthenticationClient.NewListByResourceGroupPager": - resp, err = b.dispatchNewListByResourceGroupPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if brokerAuthenticationServerTransportInterceptor != nil { + res.resp, res.err, intercepted = brokerAuthenticationServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "BrokerAuthenticationClient.BeginCreateOrUpdate": + res.resp, res.err = b.dispatchBeginCreateOrUpdate(req) + case "BrokerAuthenticationClient.BeginDelete": + res.resp, res.err = b.dispatchBeginDelete(req) + case "BrokerAuthenticationClient.Get": + res.resp, res.err = b.dispatchGet(req) + case "BrokerAuthenticationClient.NewListByResourceGroupPager": + res.resp, res.err = b.dispatchNewListByResourceGroupPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (b *BrokerAuthenticationServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -186,9 +205,9 @@ func (b *BrokerAuthenticationServerTransport) dispatchBeginDelete(req *http.Requ return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { b.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { b.beginDelete.remove(req) @@ -282,3 +301,9 @@ func (b *BrokerAuthenticationServerTransport) dispatchNewListByResourceGroupPage } return resp, nil } + +// set this to conditionally intercept incoming requests to BrokerAuthenticationServerTransport +var brokerAuthenticationServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/fake/brokerauthorization_server.go b/sdk/resourcemanager/iotoperations/armiotoperations/fake/brokerauthorization_server.go index 1ffe027e54a3..c7ab5780363d 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/fake/brokerauthorization_server.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/fake/brokerauthorization_server.go @@ -25,7 +25,7 @@ type BrokerAuthorizationServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, authorizationName string, resource armiotoperations.BrokerAuthorizationResource, options *armiotoperations.BrokerAuthorizationClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armiotoperations.BrokerAuthorizationClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method BrokerAuthorizationClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, authorizationName string, options *armiotoperations.BrokerAuthorizationClientBeginDeleteOptions) (resp azfake.PollerResponder[armiotoperations.BrokerAuthorizationClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method BrokerAuthorizationClient.Get @@ -70,23 +70,42 @@ func (b *BrokerAuthorizationServerTransport) Do(req *http.Request) (*http.Respon } func (b *BrokerAuthorizationServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "BrokerAuthorizationClient.BeginCreateOrUpdate": - resp, err = b.dispatchBeginCreateOrUpdate(req) - case "BrokerAuthorizationClient.BeginDelete": - resp, err = b.dispatchBeginDelete(req) - case "BrokerAuthorizationClient.Get": - resp, err = b.dispatchGet(req) - case "BrokerAuthorizationClient.NewListByResourceGroupPager": - resp, err = b.dispatchNewListByResourceGroupPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if brokerAuthorizationServerTransportInterceptor != nil { + res.resp, res.err, intercepted = brokerAuthorizationServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "BrokerAuthorizationClient.BeginCreateOrUpdate": + res.resp, res.err = b.dispatchBeginCreateOrUpdate(req) + case "BrokerAuthorizationClient.BeginDelete": + res.resp, res.err = b.dispatchBeginDelete(req) + case "BrokerAuthorizationClient.Get": + res.resp, res.err = b.dispatchGet(req) + case "BrokerAuthorizationClient.NewListByResourceGroupPager": + res.resp, res.err = b.dispatchNewListByResourceGroupPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (b *BrokerAuthorizationServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -186,9 +205,9 @@ func (b *BrokerAuthorizationServerTransport) dispatchBeginDelete(req *http.Reque return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { b.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { b.beginDelete.remove(req) @@ -282,3 +301,9 @@ func (b *BrokerAuthorizationServerTransport) dispatchNewListByResourceGroupPager } return resp, nil } + +// set this to conditionally intercept incoming requests to BrokerAuthorizationServerTransport +var brokerAuthorizationServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/fake/brokerlistener_server.go b/sdk/resourcemanager/iotoperations/armiotoperations/fake/brokerlistener_server.go index 7b627b35d6bd..3d1143862494 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/fake/brokerlistener_server.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/fake/brokerlistener_server.go @@ -25,7 +25,7 @@ type BrokerListenerServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, listenerName string, resource armiotoperations.BrokerListenerResource, options *armiotoperations.BrokerListenerClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armiotoperations.BrokerListenerClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method BrokerListenerClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, listenerName string, options *armiotoperations.BrokerListenerClientBeginDeleteOptions) (resp azfake.PollerResponder[armiotoperations.BrokerListenerClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method BrokerListenerClient.Get @@ -70,23 +70,42 @@ func (b *BrokerListenerServerTransport) Do(req *http.Request) (*http.Response, e } func (b *BrokerListenerServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "BrokerListenerClient.BeginCreateOrUpdate": - resp, err = b.dispatchBeginCreateOrUpdate(req) - case "BrokerListenerClient.BeginDelete": - resp, err = b.dispatchBeginDelete(req) - case "BrokerListenerClient.Get": - resp, err = b.dispatchGet(req) - case "BrokerListenerClient.NewListByResourceGroupPager": - resp, err = b.dispatchNewListByResourceGroupPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if brokerListenerServerTransportInterceptor != nil { + res.resp, res.err, intercepted = brokerListenerServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "BrokerListenerClient.BeginCreateOrUpdate": + res.resp, res.err = b.dispatchBeginCreateOrUpdate(req) + case "BrokerListenerClient.BeginDelete": + res.resp, res.err = b.dispatchBeginDelete(req) + case "BrokerListenerClient.Get": + res.resp, res.err = b.dispatchGet(req) + case "BrokerListenerClient.NewListByResourceGroupPager": + res.resp, res.err = b.dispatchNewListByResourceGroupPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (b *BrokerListenerServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -186,9 +205,9 @@ func (b *BrokerListenerServerTransport) dispatchBeginDelete(req *http.Request) ( return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { b.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { b.beginDelete.remove(req) @@ -282,3 +301,9 @@ func (b *BrokerListenerServerTransport) dispatchNewListByResourceGroupPager(req } return resp, nil } + +// set this to conditionally intercept incoming requests to BrokerListenerServerTransport +var brokerListenerServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/fake/dataflow_server.go b/sdk/resourcemanager/iotoperations/armiotoperations/fake/dataflow_server.go index 83806513fcd8..59cb0f102922 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/fake/dataflow_server.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/fake/dataflow_server.go @@ -25,7 +25,7 @@ type DataflowServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, instanceName string, dataflowProfileName string, dataflowName string, resource armiotoperations.DataflowResource, options *armiotoperations.DataflowClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armiotoperations.DataflowClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method DataflowClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, instanceName string, dataflowProfileName string, dataflowName string, options *armiotoperations.DataflowClientBeginDeleteOptions) (resp azfake.PollerResponder[armiotoperations.DataflowClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method DataflowClient.Get @@ -70,23 +70,42 @@ func (d *DataflowServerTransport) Do(req *http.Request) (*http.Response, error) } func (d *DataflowServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "DataflowClient.BeginCreateOrUpdate": - resp, err = d.dispatchBeginCreateOrUpdate(req) - case "DataflowClient.BeginDelete": - resp, err = d.dispatchBeginDelete(req) - case "DataflowClient.Get": - resp, err = d.dispatchGet(req) - case "DataflowClient.NewListByResourceGroupPager": - resp, err = d.dispatchNewListByResourceGroupPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if dataflowServerTransportInterceptor != nil { + res.resp, res.err, intercepted = dataflowServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "DataflowClient.BeginCreateOrUpdate": + res.resp, res.err = d.dispatchBeginCreateOrUpdate(req) + case "DataflowClient.BeginDelete": + res.resp, res.err = d.dispatchBeginDelete(req) + case "DataflowClient.Get": + res.resp, res.err = d.dispatchGet(req) + case "DataflowClient.NewListByResourceGroupPager": + res.resp, res.err = d.dispatchNewListByResourceGroupPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (d *DataflowServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -186,9 +205,9 @@ func (d *DataflowServerTransport) dispatchBeginDelete(req *http.Request) (*http. return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { d.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { d.beginDelete.remove(req) @@ -282,3 +301,9 @@ func (d *DataflowServerTransport) dispatchNewListByResourceGroupPager(req *http. } return resp, nil } + +// set this to conditionally intercept incoming requests to DataflowServerTransport +var dataflowServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/fake/dataflowendpoint_server.go b/sdk/resourcemanager/iotoperations/armiotoperations/fake/dataflowendpoint_server.go index d7494bf232d3..85e95d3fee3d 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/fake/dataflowendpoint_server.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/fake/dataflowendpoint_server.go @@ -25,7 +25,7 @@ type DataflowEndpointServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, instanceName string, dataflowEndpointName string, resource armiotoperations.DataflowEndpointResource, options *armiotoperations.DataflowEndpointClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armiotoperations.DataflowEndpointClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method DataflowEndpointClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, instanceName string, dataflowEndpointName string, options *armiotoperations.DataflowEndpointClientBeginDeleteOptions) (resp azfake.PollerResponder[armiotoperations.DataflowEndpointClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method DataflowEndpointClient.Get @@ -70,23 +70,42 @@ func (d *DataflowEndpointServerTransport) Do(req *http.Request) (*http.Response, } func (d *DataflowEndpointServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "DataflowEndpointClient.BeginCreateOrUpdate": - resp, err = d.dispatchBeginCreateOrUpdate(req) - case "DataflowEndpointClient.BeginDelete": - resp, err = d.dispatchBeginDelete(req) - case "DataflowEndpointClient.Get": - resp, err = d.dispatchGet(req) - case "DataflowEndpointClient.NewListByResourceGroupPager": - resp, err = d.dispatchNewListByResourceGroupPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if dataflowEndpointServerTransportInterceptor != nil { + res.resp, res.err, intercepted = dataflowEndpointServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "DataflowEndpointClient.BeginCreateOrUpdate": + res.resp, res.err = d.dispatchBeginCreateOrUpdate(req) + case "DataflowEndpointClient.BeginDelete": + res.resp, res.err = d.dispatchBeginDelete(req) + case "DataflowEndpointClient.Get": + res.resp, res.err = d.dispatchGet(req) + case "DataflowEndpointClient.NewListByResourceGroupPager": + res.resp, res.err = d.dispatchNewListByResourceGroupPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (d *DataflowEndpointServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -178,9 +197,9 @@ func (d *DataflowEndpointServerTransport) dispatchBeginDelete(req *http.Request) return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { d.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { d.beginDelete.remove(req) @@ -266,3 +285,9 @@ func (d *DataflowEndpointServerTransport) dispatchNewListByResourceGroupPager(re } return resp, nil } + +// set this to conditionally intercept incoming requests to DataflowEndpointServerTransport +var dataflowEndpointServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/fake/dataflowprofile_server.go b/sdk/resourcemanager/iotoperations/armiotoperations/fake/dataflowprofile_server.go index 429d7d167583..6d0d4c67b302 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/fake/dataflowprofile_server.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/fake/dataflowprofile_server.go @@ -25,7 +25,7 @@ type DataflowProfileServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, instanceName string, dataflowProfileName string, resource armiotoperations.DataflowProfileResource, options *armiotoperations.DataflowProfileClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armiotoperations.DataflowProfileClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method DataflowProfileClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, instanceName string, dataflowProfileName string, options *armiotoperations.DataflowProfileClientBeginDeleteOptions) (resp azfake.PollerResponder[armiotoperations.DataflowProfileClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method DataflowProfileClient.Get @@ -70,23 +70,42 @@ func (d *DataflowProfileServerTransport) Do(req *http.Request) (*http.Response, } func (d *DataflowProfileServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "DataflowProfileClient.BeginCreateOrUpdate": - resp, err = d.dispatchBeginCreateOrUpdate(req) - case "DataflowProfileClient.BeginDelete": - resp, err = d.dispatchBeginDelete(req) - case "DataflowProfileClient.Get": - resp, err = d.dispatchGet(req) - case "DataflowProfileClient.NewListByResourceGroupPager": - resp, err = d.dispatchNewListByResourceGroupPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if dataflowProfileServerTransportInterceptor != nil { + res.resp, res.err, intercepted = dataflowProfileServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "DataflowProfileClient.BeginCreateOrUpdate": + res.resp, res.err = d.dispatchBeginCreateOrUpdate(req) + case "DataflowProfileClient.BeginDelete": + res.resp, res.err = d.dispatchBeginDelete(req) + case "DataflowProfileClient.Get": + res.resp, res.err = d.dispatchGet(req) + case "DataflowProfileClient.NewListByResourceGroupPager": + res.resp, res.err = d.dispatchNewListByResourceGroupPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (d *DataflowProfileServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -178,9 +197,9 @@ func (d *DataflowProfileServerTransport) dispatchBeginDelete(req *http.Request) return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { d.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { d.beginDelete.remove(req) @@ -266,3 +285,9 @@ func (d *DataflowProfileServerTransport) dispatchNewListByResourceGroupPager(req } return resp, nil } + +// set this to conditionally intercept incoming requests to DataflowProfileServerTransport +var dataflowProfileServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/fake/instance_server.go b/sdk/resourcemanager/iotoperations/armiotoperations/fake/instance_server.go index ed9ccd09a6d9..8f398c784034 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/fake/instance_server.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/fake/instance_server.go @@ -25,7 +25,7 @@ type InstanceServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, instanceName string, resource armiotoperations.InstanceResource, options *armiotoperations.InstanceClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armiotoperations.InstanceClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method InstanceClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, instanceName string, options *armiotoperations.InstanceClientBeginDeleteOptions) (resp azfake.PollerResponder[armiotoperations.InstanceClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method InstanceClient.Get @@ -80,27 +80,46 @@ func (i *InstanceServerTransport) Do(req *http.Request) (*http.Response, error) } func (i *InstanceServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "InstanceClient.BeginCreateOrUpdate": - resp, err = i.dispatchBeginCreateOrUpdate(req) - case "InstanceClient.BeginDelete": - resp, err = i.dispatchBeginDelete(req) - case "InstanceClient.Get": - resp, err = i.dispatchGet(req) - case "InstanceClient.NewListByResourceGroupPager": - resp, err = i.dispatchNewListByResourceGroupPager(req) - case "InstanceClient.NewListBySubscriptionPager": - resp, err = i.dispatchNewListBySubscriptionPager(req) - case "InstanceClient.Update": - resp, err = i.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if instanceServerTransportInterceptor != nil { + res.resp, res.err, intercepted = instanceServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "InstanceClient.BeginCreateOrUpdate": + res.resp, res.err = i.dispatchBeginCreateOrUpdate(req) + case "InstanceClient.BeginDelete": + res.resp, res.err = i.dispatchBeginDelete(req) + case "InstanceClient.Get": + res.resp, res.err = i.dispatchGet(req) + case "InstanceClient.NewListByResourceGroupPager": + res.resp, res.err = i.dispatchNewListByResourceGroupPager(req) + case "InstanceClient.NewListBySubscriptionPager": + res.resp, res.err = i.dispatchNewListBySubscriptionPager(req) + case "InstanceClient.Update": + res.resp, res.err = i.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (i *InstanceServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -184,9 +203,9 @@ func (i *InstanceServerTransport) dispatchBeginDelete(req *http.Request) (*http. return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { i.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { i.beginDelete.remove(req) @@ -334,3 +353,9 @@ func (i *InstanceServerTransport) dispatchUpdate(req *http.Request) (*http.Respo } return resp, nil } + +// set this to conditionally intercept incoming requests to InstanceServerTransport +var instanceServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/fake/internal.go b/sdk/resourcemanager/iotoperations/armiotoperations/fake/internal.go index 56a8f624f5f3..7425b6a669e2 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/fake/internal.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/fake/internal.go @@ -10,6 +10,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/fake/operations_server.go b/sdk/resourcemanager/iotoperations/armiotoperations/fake/operations_server.go index efd9e8991369..af813699fd33 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/fake/operations_server.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/fake/operations_server.go @@ -51,17 +51,36 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error } func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -90,3 +109,9 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/go.mod b/sdk/resourcemanager/iotoperations/armiotoperations/go.mod index 92533fca7e43..13b9390b8b11 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/go.mod +++ b/sdk/resourcemanager/iotoperations/armiotoperations/go.mod @@ -3,7 +3,7 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iotoperations/armio go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 ) @@ -14,8 +14,8 @@ require ( github.com/google/uuid v1.6.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.25.0 // indirect - golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect - golang.org/x/text v0.16.0 // indirect + golang.org/x/crypto v0.27.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/text v0.18.0 // indirect ) diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/go.sum b/sdk/resourcemanager/iotoperations/armiotoperations/go.sum index 09d275cb9a37..cbddbbd9ecec 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/go.sum +++ b/sdk/resourcemanager/iotoperations/armiotoperations/go.sum @@ -1,5 +1,5 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 h1:JZg6HRh6W6U4OLl6lk7BZ7BLisIzM9dG1R50zUk9C/M= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0/go.mod h1:YL1xnZ6QejvQHWJrX/AvhFl4WW4rqHVoKspWNVwFk0M= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= @@ -17,13 +17,13 @@ github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmd github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= -golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= -golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/tsp-location.yaml b/sdk/resourcemanager/iotoperations/armiotoperations/tsp-location.yaml index 253771057f04..3bcceadb86a7 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/tsp-location.yaml +++ b/sdk/resourcemanager/iotoperations/armiotoperations/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/iotoperations/IoTOperations.Management -commit: 1ba188e3c1a7246ce6a7067adacd04d576fcfa24 +commit: df55cd8178ddd870dbd0c3b1e25c80e3ff48826c repo: Azure/azure-rest-api-specs -additionalDirectories: +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/CHANGELOG.md b/sdk/resourcemanager/mongocluster/armmongocluster/CHANGELOG.md index 47629dbbcb66..ed162c7250bc 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/CHANGELOG.md +++ b/sdk/resourcemanager/mongocluster/armmongocluster/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 1.0.2 (2024-11-19) +### Other Changes + + ## 1.0.1 (2024-10-14) ### Other Changes - Add examples diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/constants.go b/sdk/resourcemanager/mongocluster/armmongocluster/constants.go index 8ebb465edcce..e2bfad7caeb9 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/constants.go +++ b/sdk/resourcemanager/mongocluster/armmongocluster/constants.go @@ -6,7 +6,7 @@ package armmongocluster const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster" - moduleVersion = "v1.0.1" + moduleVersion = "v1.0.2" ) // ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/fake/firewallrules_server.go b/sdk/resourcemanager/mongocluster/armmongocluster/fake/firewallrules_server.go index 2fa0dba5139c..ca62e57c265e 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/fake/firewallrules_server.go +++ b/sdk/resourcemanager/mongocluster/armmongocluster/fake/firewallrules_server.go @@ -25,7 +25,7 @@ type FirewallRulesServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, mongoClusterName string, firewallRuleName string, resource armmongocluster.FirewallRule, options *armmongocluster.FirewallRulesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armmongocluster.FirewallRulesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method FirewallRulesClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, mongoClusterName string, firewallRuleName string, options *armmongocluster.FirewallRulesClientBeginDeleteOptions) (resp azfake.PollerResponder[armmongocluster.FirewallRulesClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method FirewallRulesClient.Get @@ -70,23 +70,42 @@ func (f *FirewallRulesServerTransport) Do(req *http.Request) (*http.Response, er } func (f *FirewallRulesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "FirewallRulesClient.BeginCreateOrUpdate": - resp, err = f.dispatchBeginCreateOrUpdate(req) - case "FirewallRulesClient.BeginDelete": - resp, err = f.dispatchBeginDelete(req) - case "FirewallRulesClient.Get": - resp, err = f.dispatchGet(req) - case "FirewallRulesClient.NewListByMongoClusterPager": - resp, err = f.dispatchNewListByMongoClusterPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if firewallRulesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = firewallRulesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "FirewallRulesClient.BeginCreateOrUpdate": + res.resp, res.err = f.dispatchBeginCreateOrUpdate(req) + case "FirewallRulesClient.BeginDelete": + res.resp, res.err = f.dispatchBeginDelete(req) + case "FirewallRulesClient.Get": + res.resp, res.err = f.dispatchGet(req) + case "FirewallRulesClient.NewListByMongoClusterPager": + res.resp, res.err = f.dispatchNewListByMongoClusterPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (f *FirewallRulesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -178,9 +197,9 @@ func (f *FirewallRulesServerTransport) dispatchBeginDelete(req *http.Request) (* return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { f.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { f.beginDelete.remove(req) @@ -266,3 +285,9 @@ func (f *FirewallRulesServerTransport) dispatchNewListByMongoClusterPager(req *h } return resp, nil } + +// set this to conditionally intercept incoming requests to FirewallRulesServerTransport +var firewallRulesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/fake/internal.go b/sdk/resourcemanager/mongocluster/armmongocluster/fake/internal.go index 56a8f624f5f3..7425b6a669e2 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/fake/internal.go +++ b/sdk/resourcemanager/mongocluster/armmongocluster/fake/internal.go @@ -10,6 +10,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/fake/mongoclusters_server.go b/sdk/resourcemanager/mongocluster/armmongocluster/fake/mongoclusters_server.go index 282e05f31b53..71e5c8df2b66 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/fake/mongoclusters_server.go +++ b/sdk/resourcemanager/mongocluster/armmongocluster/fake/mongoclusters_server.go @@ -29,7 +29,7 @@ type MongoClustersServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, mongoClusterName string, resource armmongocluster.MongoCluster, options *armmongocluster.MongoClustersClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armmongocluster.MongoClustersClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method MongoClustersClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, mongoClusterName string, options *armmongocluster.MongoClustersClientBeginDeleteOptions) (resp azfake.PollerResponder[armmongocluster.MongoClustersClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method MongoClustersClient.Get @@ -49,7 +49,7 @@ type MongoClustersServer struct { ListConnectionStrings func(ctx context.Context, resourceGroupName string, mongoClusterName string, options *armmongocluster.MongoClustersClientListConnectionStringsOptions) (resp azfake.Responder[armmongocluster.MongoClustersClientListConnectionStringsResponse], errResp azfake.ErrorResponder) // BeginPromote is the fake for method MongoClustersClient.BeginPromote - // HTTP status codes to indicate success: http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginPromote func(ctx context.Context, resourceGroupName string, mongoClusterName string, body armmongocluster.PromoteReplicaRequest, options *armmongocluster.MongoClustersClientBeginPromoteOptions) (resp azfake.PollerResponder[armmongocluster.MongoClustersClientPromoteResponse], errResp azfake.ErrorResponder) // BeginUpdate is the fake for method MongoClustersClient.BeginUpdate @@ -96,33 +96,52 @@ func (m *MongoClustersServerTransport) Do(req *http.Request) (*http.Response, er } func (m *MongoClustersServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error - - switch method { - case "MongoClustersClient.CheckNameAvailability": - resp, err = m.dispatchCheckNameAvailability(req) - case "MongoClustersClient.BeginCreateOrUpdate": - resp, err = m.dispatchBeginCreateOrUpdate(req) - case "MongoClustersClient.BeginDelete": - resp, err = m.dispatchBeginDelete(req) - case "MongoClustersClient.Get": - resp, err = m.dispatchGet(req) - case "MongoClustersClient.NewListPager": - resp, err = m.dispatchNewListPager(req) - case "MongoClustersClient.NewListByResourceGroupPager": - resp, err = m.dispatchNewListByResourceGroupPager(req) - case "MongoClustersClient.ListConnectionStrings": - resp, err = m.dispatchListConnectionStrings(req) - case "MongoClustersClient.BeginPromote": - resp, err = m.dispatchBeginPromote(req) - case "MongoClustersClient.BeginUpdate": - resp, err = m.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - return resp, err + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if mongoClustersServerTransportInterceptor != nil { + res.resp, res.err, intercepted = mongoClustersServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "MongoClustersClient.CheckNameAvailability": + res.resp, res.err = m.dispatchCheckNameAvailability(req) + case "MongoClustersClient.BeginCreateOrUpdate": + res.resp, res.err = m.dispatchBeginCreateOrUpdate(req) + case "MongoClustersClient.BeginDelete": + res.resp, res.err = m.dispatchBeginDelete(req) + case "MongoClustersClient.Get": + res.resp, res.err = m.dispatchGet(req) + case "MongoClustersClient.NewListPager": + res.resp, res.err = m.dispatchNewListPager(req) + case "MongoClustersClient.NewListByResourceGroupPager": + res.resp, res.err = m.dispatchNewListByResourceGroupPager(req) + case "MongoClustersClient.ListConnectionStrings": + res.resp, res.err = m.dispatchListConnectionStrings(req) + case "MongoClustersClient.BeginPromote": + res.resp, res.err = m.dispatchBeginPromote(req) + case "MongoClustersClient.BeginUpdate": + res.resp, res.err = m.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (m *MongoClustersServerTransport) dispatchCheckNameAvailability(req *http.Request) (*http.Response, error) { @@ -239,9 +258,9 @@ func (m *MongoClustersServerTransport) dispatchBeginDelete(req *http.Request) (* return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { m.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { m.beginDelete.remove(req) @@ -423,9 +442,9 @@ func (m *MongoClustersServerTransport) dispatchBeginPromote(req *http.Request) ( return nil, err } - if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { m.beginPromote.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginPromote) { m.beginPromote.remove(req) @@ -481,3 +500,9 @@ func (m *MongoClustersServerTransport) dispatchBeginUpdate(req *http.Request) (* return resp, nil } + +// set this to conditionally intercept incoming requests to MongoClustersServerTransport +var mongoClustersServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/fake/operations_server.go b/sdk/resourcemanager/mongocluster/armmongocluster/fake/operations_server.go index e03576da7bf7..f9b0ab327954 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/fake/operations_server.go +++ b/sdk/resourcemanager/mongocluster/armmongocluster/fake/operations_server.go @@ -51,17 +51,36 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error } func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -90,3 +109,9 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/fake/privateendpointconnections_server.go b/sdk/resourcemanager/mongocluster/armmongocluster/fake/privateendpointconnections_server.go index 1857e3b2d3a2..2ff521073ce8 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/fake/privateendpointconnections_server.go +++ b/sdk/resourcemanager/mongocluster/armmongocluster/fake/privateendpointconnections_server.go @@ -25,7 +25,7 @@ type PrivateEndpointConnectionsServer struct { BeginCreate func(ctx context.Context, resourceGroupName string, mongoClusterName string, privateEndpointConnectionName string, resource armmongocluster.PrivateEndpointConnectionResource, options *armmongocluster.PrivateEndpointConnectionsClientBeginCreateOptions) (resp azfake.PollerResponder[armmongocluster.PrivateEndpointConnectionsClientCreateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method PrivateEndpointConnectionsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, mongoClusterName string, privateEndpointConnectionName string, options *armmongocluster.PrivateEndpointConnectionsClientBeginDeleteOptions) (resp azfake.PollerResponder[armmongocluster.PrivateEndpointConnectionsClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method PrivateEndpointConnectionsClient.Get @@ -70,23 +70,42 @@ func (p *PrivateEndpointConnectionsServerTransport) Do(req *http.Request) (*http } func (p *PrivateEndpointConnectionsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "PrivateEndpointConnectionsClient.BeginCreate": - resp, err = p.dispatchBeginCreate(req) - case "PrivateEndpointConnectionsClient.BeginDelete": - resp, err = p.dispatchBeginDelete(req) - case "PrivateEndpointConnectionsClient.Get": - resp, err = p.dispatchGet(req) - case "PrivateEndpointConnectionsClient.NewListByMongoClusterPager": - resp, err = p.dispatchNewListByMongoClusterPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if privateEndpointConnectionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = privateEndpointConnectionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PrivateEndpointConnectionsClient.BeginCreate": + res.resp, res.err = p.dispatchBeginCreate(req) + case "PrivateEndpointConnectionsClient.BeginDelete": + res.resp, res.err = p.dispatchBeginDelete(req) + case "PrivateEndpointConnectionsClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "PrivateEndpointConnectionsClient.NewListByMongoClusterPager": + res.resp, res.err = p.dispatchNewListByMongoClusterPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { @@ -178,9 +197,9 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginDelete(req *htt return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { p.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { p.beginDelete.remove(req) @@ -266,3 +285,9 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchNewListByMongoCluste } return resp, nil } + +// set this to conditionally intercept incoming requests to PrivateEndpointConnectionsServerTransport +var privateEndpointConnectionsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/fake/privatelinks_server.go b/sdk/resourcemanager/mongocluster/armmongocluster/fake/privatelinks_server.go index c5c7f79a7086..e51c4ae7e0b3 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/fake/privatelinks_server.go +++ b/sdk/resourcemanager/mongocluster/armmongocluster/fake/privatelinks_server.go @@ -53,17 +53,36 @@ func (p *PrivateLinksServerTransport) Do(req *http.Request) (*http.Response, err } func (p *PrivateLinksServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "PrivateLinksClient.NewListByMongoClusterPager": - resp, err = p.dispatchNewListByMongoClusterPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if privateLinksServerTransportInterceptor != nil { + res.resp, res.err, intercepted = privateLinksServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PrivateLinksClient.NewListByMongoClusterPager": + res.resp, res.err = p.dispatchNewListByMongoClusterPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (p *PrivateLinksServerTransport) dispatchNewListByMongoClusterPager(req *http.Request) (*http.Response, error) { @@ -106,3 +125,9 @@ func (p *PrivateLinksServerTransport) dispatchNewListByMongoClusterPager(req *ht } return resp, nil } + +// set this to conditionally intercept incoming requests to PrivateLinksServerTransport +var privateLinksServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/fake/replicas_server.go b/sdk/resourcemanager/mongocluster/armmongocluster/fake/replicas_server.go index 380cc5823b3d..fe07670b3590 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/fake/replicas_server.go +++ b/sdk/resourcemanager/mongocluster/armmongocluster/fake/replicas_server.go @@ -53,17 +53,36 @@ func (r *ReplicasServerTransport) Do(req *http.Request) (*http.Response, error) } func (r *ReplicasServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "ReplicasClient.NewListByParentPager": - resp, err = r.dispatchNewListByParentPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if replicasServerTransportInterceptor != nil { + res.resp, res.err, intercepted = replicasServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ReplicasClient.NewListByParentPager": + res.resp, res.err = r.dispatchNewListByParentPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (r *ReplicasServerTransport) dispatchNewListByParentPager(req *http.Request) (*http.Response, error) { @@ -106,3 +125,9 @@ func (r *ReplicasServerTransport) dispatchNewListByParentPager(req *http.Request } return resp, nil } + +// set this to conditionally intercept incoming requests to ReplicasServerTransport +var replicasServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/firewallrules_client_example_test.go b/sdk/resourcemanager/mongocluster/armmongocluster/firewallrules_client_example_test.go index 46b9b0d8cb32..a9bb46cb506b 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/firewallrules_client_example_test.go +++ b/sdk/resourcemanager/mongocluster/armmongocluster/firewallrules_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_FirewallRuleCreate.json +// Generated from example definition: 2024-07-01/MongoClusters_FirewallRuleCreate.json func ExampleFirewallRulesClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -61,7 +61,7 @@ func ExampleFirewallRulesClient_BeginCreateOrUpdate() { // } } -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_FirewallRuleDelete.json +// Generated from example definition: 2024-07-01/MongoClusters_FirewallRuleDelete.json func ExampleFirewallRulesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -82,7 +82,7 @@ func ExampleFirewallRulesClient_BeginDelete() { } } -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_FirewallRuleGet.json +// Generated from example definition: 2024-07-01/MongoClusters_FirewallRuleGet.json func ExampleFirewallRulesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -122,7 +122,7 @@ func ExampleFirewallRulesClient_Get() { // } } -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_FirewallRuleList.json +// Generated from example definition: 2024-07-01/MongoClusters_FirewallRuleList.json func ExampleFirewallRulesClient_NewListByMongoClusterPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/go.mod b/sdk/resourcemanager/mongocluster/armmongocluster/go.mod index 48b9c03c5485..540f28dfa774 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/go.mod +++ b/sdk/resourcemanager/mongocluster/armmongocluster/go.mod @@ -3,7 +3,7 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmon go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3 v3.1.0 ) @@ -16,8 +16,8 @@ require ( github.com/google/uuid v1.6.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.25.0 // indirect - golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect - golang.org/x/text v0.16.0 // indirect + golang.org/x/crypto v0.27.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/text v0.18.0 // indirect ) diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/go.sum b/sdk/resourcemanager/mongocluster/armmongocluster/go.sum index d7d2cf1b6883..e7ef42f307a8 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/go.sum +++ b/sdk/resourcemanager/mongocluster/armmongocluster/go.sum @@ -1,5 +1,5 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 h1:JZg6HRh6W6U4OLl6lk7BZ7BLisIzM9dG1R50zUk9C/M= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0/go.mod h1:YL1xnZ6QejvQHWJrX/AvhFl4WW4rqHVoKspWNVwFk0M= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= @@ -23,13 +23,13 @@ github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmd github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= -golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= -golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/mongoclusters_client.go b/sdk/resourcemanager/mongocluster/armmongocluster/mongoclusters_client.go index 14410d6a7eab..38f009b987a7 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/mongoclusters_client.go +++ b/sdk/resourcemanager/mongocluster/armmongocluster/mongoclusters_client.go @@ -43,7 +43,7 @@ func NewMongoClustersClient(subscriptionID string, credential azcore.TokenCreden // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2024-07-01 -// - location - The location name. +// - location - The name of the Azure region. // - body - The CheckAvailability request // - options - MongoClustersClientCheckNameAvailabilityOptions contains the optional parameters for the MongoClustersClient.CheckNameAvailability // method. diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/mongoclusters_client_example_test.go b/sdk/resourcemanager/mongocluster/armmongocluster/mongoclusters_client_example_test.go index 5e7f6481eb99..da42c112c3ba 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/mongoclusters_client_example_test.go +++ b/sdk/resourcemanager/mongocluster/armmongocluster/mongoclusters_client_example_test.go @@ -13,7 +13,7 @@ import ( "time" ) -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_NameAvailability.json +// Generated from example definition: 2024-07-01/MongoClusters_NameAvailability.json func ExampleMongoClustersClient_CheckNameAvailability_checksAndConfirmsTheMongoClusterNameIsAvailabilityForUse() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -41,7 +41,7 @@ func ExampleMongoClustersClient_CheckNameAvailability_checksAndConfirmsTheMongoC // } } -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_NameAvailability_AlreadyExists.json +// Generated from example definition: 2024-07-01/MongoClusters_NameAvailability_AlreadyExists.json func ExampleMongoClustersClient_CheckNameAvailability_checksAndReturnsThatTheMongoClusterNameIsAlreadyInUse() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -71,7 +71,7 @@ func ExampleMongoClustersClient_CheckNameAvailability_checksAndReturnsThatTheMon // } } -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_Create.json +// Generated from example definition: 2024-07-01/MongoClusters_Create.json func ExampleMongoClustersClient_BeginCreateOrUpdate_createsANewMongoClusterResource() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -162,7 +162,7 @@ func ExampleMongoClustersClient_BeginCreateOrUpdate_createsANewMongoClusterResou // } } -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_CreateGeoReplica.json +// Generated from example definition: 2024-07-01/MongoClusters_CreateGeoReplica.json func ExampleMongoClustersClient_BeginCreateOrUpdate_createsAReplicaMongoClusterResourceFromASourceResource() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -236,7 +236,7 @@ func ExampleMongoClustersClient_BeginCreateOrUpdate_createsAReplicaMongoClusterR // } } -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_CreatePITR.json +// Generated from example definition: 2024-07-01/MongoClusters_CreatePITR.json func ExampleMongoClustersClient_BeginCreateOrUpdate_createsAMongoClusterResourceFromAPointInTimeRestore() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -307,7 +307,7 @@ func ExampleMongoClustersClient_BeginCreateOrUpdate_createsAMongoClusterResource // } } -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_Delete.json +// Generated from example definition: 2024-07-01/MongoClusters_Delete.json func ExampleMongoClustersClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -328,7 +328,7 @@ func ExampleMongoClustersClient_BeginDelete() { } } -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_Get.json +// Generated from example definition: 2024-07-01/MongoClusters_Get.json func ExampleMongoClustersClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -400,7 +400,7 @@ func ExampleMongoClustersClient_Get() { // } } -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_List.json +// Generated from example definition: 2024-07-01/MongoClusters_List.json func ExampleMongoClustersClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -529,7 +529,7 @@ func ExampleMongoClustersClient_NewListPager() { } } -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_ListByResourceGroup.json +// Generated from example definition: 2024-07-01/MongoClusters_ListByResourceGroup.json func ExampleMongoClustersClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -658,7 +658,7 @@ func ExampleMongoClustersClient_NewListByResourceGroupPager() { } } -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_ListConnectionStrings.json +// Generated from example definition: 2024-07-01/MongoClusters_ListConnectionStrings.json func ExampleMongoClustersClient_ListConnectionStrings() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -688,7 +688,7 @@ func ExampleMongoClustersClient_ListConnectionStrings() { // } } -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_ForcePromoteReplica.json +// Generated from example definition: 2024-07-01/MongoClusters_ForcePromoteReplica.json func ExampleMongoClustersClient_BeginPromote() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -712,7 +712,7 @@ func ExampleMongoClustersClient_BeginPromote() { } } -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_PatchDiskSize.json +// Generated from example definition: 2024-07-01/MongoClusters_PatchDiskSize.json func ExampleMongoClustersClient_BeginUpdate_updatesTheDiskSizeOnAMongoClusterResource() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -788,7 +788,7 @@ func ExampleMongoClustersClient_BeginUpdate_updatesTheDiskSizeOnAMongoClusterRes // } } -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_PatchPrivateNetworkAccess.json +// Generated from example definition: 2024-07-01/MongoClusters_PatchPrivateNetworkAccess.json func ExampleMongoClustersClient_BeginUpdate_disablesPublicNetworkAccessOnAMongoClusterResourceWithAPrivateEndpointConnection() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -888,7 +888,7 @@ func ExampleMongoClustersClient_BeginUpdate_disablesPublicNetworkAccessOnAMongoC // } } -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_ResetPassword.json +// Generated from example definition: 2024-07-01/MongoClusters_ResetPassword.json func ExampleMongoClustersClient_BeginUpdate_resetsTheAdministratorLoginPassword() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -965,7 +965,7 @@ func ExampleMongoClustersClient_BeginUpdate_resetsTheAdministratorLoginPassword( // } } -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_Update.json +// Generated from example definition: 2024-07-01/MongoClusters_Update.json func ExampleMongoClustersClient_BeginUpdate_updatesAMongoClusterResource() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/operations_client_example_test.go b/sdk/resourcemanager/mongocluster/armmongocluster/operations_client_example_test.go index 560fc23c093a..bd03c838daf1 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/operations_client_example_test.go +++ b/sdk/resourcemanager/mongocluster/armmongocluster/operations_client_example_test.go @@ -11,7 +11,7 @@ import ( "log" ) -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/Operations_List.json +// Generated from example definition: 2024-07-01/Operations_List.json func ExampleOperationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/mongocluster/armmongocluster/privateendpointconnections_client_example_test.go index 9f27e134b3ee..96d66b289c48 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/privateendpointconnections_client_example_test.go +++ b/sdk/resourcemanager/mongocluster/armmongocluster/privateendpointconnections_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_PrivateEndpointConnectionPut.json +// Generated from example definition: 2024-07-01/MongoClusters_PrivateEndpointConnectionPut.json func ExamplePrivateEndpointConnectionsClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -72,7 +72,7 @@ func ExamplePrivateEndpointConnectionsClient_BeginCreate() { // } } -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_PrivateEndpointConnectionDelete.json +// Generated from example definition: 2024-07-01/MongoClusters_PrivateEndpointConnectionDelete.json func ExamplePrivateEndpointConnectionsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -93,7 +93,7 @@ func ExamplePrivateEndpointConnectionsClient_BeginDelete() { } } -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_PrivateEndpointConnectionGet.json +// Generated from example definition: 2024-07-01/MongoClusters_PrivateEndpointConnectionGet.json func ExamplePrivateEndpointConnectionsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -142,7 +142,7 @@ func ExamplePrivateEndpointConnectionsClient_Get() { // } } -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_PrivateEndpointConnectionList.json +// Generated from example definition: 2024-07-01/MongoClusters_PrivateEndpointConnectionList.json func ExamplePrivateEndpointConnectionsClient_NewListByMongoClusterPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/privatelinks_client_example_test.go b/sdk/resourcemanager/mongocluster/armmongocluster/privatelinks_client_example_test.go index 70399d79c0ad..03b8153acd1e 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/privatelinks_client_example_test.go +++ b/sdk/resourcemanager/mongocluster/armmongocluster/privatelinks_client_example_test.go @@ -11,7 +11,7 @@ import ( "log" ) -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_PrivateLinkResourceList.json +// Generated from example definition: 2024-07-01/MongoClusters_PrivateLinkResourceList.json func ExamplePrivateLinksClient_NewListByMongoClusterPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/replicas_client_example_test.go b/sdk/resourcemanager/mongocluster/armmongocluster/replicas_client_example_test.go index 30c3f632e55f..4ccb2c200387 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/replicas_client_example_test.go +++ b/sdk/resourcemanager/mongocluster/armmongocluster/replicas_client_example_test.go @@ -11,7 +11,7 @@ import ( "log" ) -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_ReplicaList.json +// Generated from example definition: 2024-07-01/MongoClusters_ReplicaList.json func ExampleReplicasClient_NewListByParentPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/tsp-location.yaml b/sdk/resourcemanager/mongocluster/armmongocluster/tsp-location.yaml index efed7142ec15..63cb21feaef5 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/tsp-location.yaml +++ b/sdk/resourcemanager/mongocluster/armmongocluster/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/mongocluster/DocumentDB.MongoCluster.Management -commit: 02ff8f08a132a5a68fcdd48da118e36e5ececc3d +commit: df55cd8178ddd870dbd0c3b1e25c80e3ff48826c repo: Azure/azure-rest-api-specs -additionalDirectories: +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/CHANGELOG.md b/sdk/resourcemanager/neonpostgres/armneonpostgres/CHANGELOG.md new file mode 100644 index 000000000000..15ea626c90bd --- /dev/null +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 0.1.0 (2024-11-19) +### Other Changes + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt). \ No newline at end of file diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/LICENSE.txt b/sdk/resourcemanager/neonpostgres/armneonpostgres/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/README.md b/sdk/resourcemanager/neonpostgres/armneonpostgres/README.md new file mode 100644 index 000000000000..9e006053e828 --- /dev/null +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/README.md @@ -0,0 +1,92 @@ +# Azure Neonpostgres Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres) + +The `armneonpostgres` module provides operations for working with Azure Neonpostgres. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/neonpostgres/armneonpostgres) + +# Getting started + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.18 or above (You could download and install the latest version of Go from [here](https://go.dev/doc/install). It will replace the existing Go on your machine. If you want to install multiple Go versions on the same machine, you could refer this [doc](https://go.dev/doc/manage-install).) + +## Install the package + +This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management. + +Install the Azure Neonpostgres module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Neonpostgres. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more. + +```go +cred, err := azidentity.NewDefaultAzureCredential(nil) +``` + +For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). + +## Client Factory + +Azure Neonpostgres module consists of one or more clients. We provide a client factory which could be used to create any client in this module. + +```go +clientFactory, err := armneonpostgres.NewClientFactory(, cred, nil) +``` + +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). + +```go +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, +} +clientFactory, err := armneonpostgres.NewClientFactory(, cred, &options) +``` + +## Clients + +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.NewOrganizationsClient() +``` + +## Fakes + +The fake package contains types used for constructing in-memory fake servers used in unit tests. +This allows writing tests to cover various success/error conditions without the need for connecting to a live service. + +Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes. + +## Provide Feedback + +If you encounter bugs or have suggestions, please +[open an issue](https://github.com/Azure/azure-sdk-for-go/issues) and assign the `Neonpostgres` label. + +# Contributing + +This project welcomes contributions and suggestions. Most contributions require +you to agree to a Contributor License Agreement (CLA) declaring that you have +the right to, and actually do, grant us the rights to use your contribution. +For details, visit [https://cla.microsoft.com](https://cla.microsoft.com). + +When you submit a pull request, a CLA-bot will automatically determine whether +you need to provide a CLA and decorate the PR appropriately (e.g., label, +comment). Simply follow the instructions provided by the bot. You will only +need to do this once across all repos using our CLA. + +This project has adopted the +[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information, see the +[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any +additional questions or comments. \ No newline at end of file diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/ci.yml b/sdk/resourcemanager/neonpostgres/armneonpostgres/ci.yml new file mode 100644 index 000000000000..5c7817a545e6 --- /dev/null +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/ci.yml @@ -0,0 +1,28 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/neonpostgres/armneonpostgres/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/neonpostgres/armneonpostgres/ + +extends: + template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/neonpostgres/armneonpostgres' diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/client_factory.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/client_factory.go new file mode 100644 index 000000000000..9952282e6d03 --- /dev/null +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/client_factory.go @@ -0,0 +1,48 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armneonpostgres + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" +) + +// ClientFactory is a client factory used to create any client in this module. +// Don't use this type directly, use NewClientFactory instead. +type ClientFactory struct { + subscriptionID string + internal *arm.Client +} + +// 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 - The ID of the target subscription. The value must be an UUID. +// - 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) { + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, + internal: internal, + }, nil +} + +// NewOperationsClient creates a new instance of OperationsClient. +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + return &OperationsClient{ + internal: c.internal, + } +} + +// NewOrganizationsClient creates a new instance of OrganizationsClient. +func (c *ClientFactory) NewOrganizationsClient() *OrganizationsClient { + return &OrganizationsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/constants.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/constants.go new file mode 100644 index 000000000000..471985f693d9 --- /dev/null +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/constants.go @@ -0,0 +1,138 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armneonpostgres + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres" + moduleVersion = "v0.1.0" +) + +// ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +type ActionType string + +const ( + // ActionTypeInternal - Actions are for internal-only APIs. + ActionTypeInternal ActionType = "Internal" +) + +// PossibleActionTypeValues returns the possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ + ActionTypeInternal, + } +} + +// CreatedByType - The kind of entity that created the resource. +type CreatedByType string + +const ( + // CreatedByTypeApplication - The entity was created by an application. + CreatedByTypeApplication CreatedByType = "Application" + // CreatedByTypeKey - The entity was created by a key. + CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeManagedIdentity - The entity was created by a managed identity. + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + // CreatedByTypeUser - The entity was created by a user. + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + +// MarketplaceSubscriptionStatus - Marketplace subscription status of a resource. +type MarketplaceSubscriptionStatus string + +const ( + // MarketplaceSubscriptionStatusPendingFulfillmentStart - Purchased but not yet activated + MarketplaceSubscriptionStatusPendingFulfillmentStart MarketplaceSubscriptionStatus = "PendingFulfillmentStart" + // MarketplaceSubscriptionStatusSubscribed - Marketplace subscription is activated + MarketplaceSubscriptionStatusSubscribed MarketplaceSubscriptionStatus = "Subscribed" + // MarketplaceSubscriptionStatusSuspended - This state indicates that a customer's payment for the Marketplace service was + // not received + MarketplaceSubscriptionStatusSuspended MarketplaceSubscriptionStatus = "Suspended" + // MarketplaceSubscriptionStatusUnsubscribed - Customer has cancelled the subscription + MarketplaceSubscriptionStatusUnsubscribed MarketplaceSubscriptionStatus = "Unsubscribed" +) + +// PossibleMarketplaceSubscriptionStatusValues returns the possible values for the MarketplaceSubscriptionStatus const type. +func PossibleMarketplaceSubscriptionStatusValues() []MarketplaceSubscriptionStatus { + return []MarketplaceSubscriptionStatus{ + MarketplaceSubscriptionStatusPendingFulfillmentStart, + MarketplaceSubscriptionStatusSubscribed, + MarketplaceSubscriptionStatusSuspended, + MarketplaceSubscriptionStatusUnsubscribed, + } +} + +// 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 ( + // OriginSystem - Indicates the operation is initiated by a system. + OriginSystem Origin = "system" + // OriginUser - Indicates the operation is initiated by a user. + OriginUser Origin = "user" + // OriginUserSystem - Indicates the operation is initiated by a user or system. + OriginUserSystem Origin = "user,system" +) + +// PossibleOriginValues returns the possible values for the Origin const type. +func PossibleOriginValues() []Origin { + return []Origin{ + OriginSystem, + OriginUser, + OriginUserSystem, + } +} + +// ResourceProvisioningState - The provisioning state of a resource type. +type ResourceProvisioningState string + +const ( + // ResourceProvisioningStateCanceled - Resource creation was canceled. + ResourceProvisioningStateCanceled ResourceProvisioningState = "Canceled" + // ResourceProvisioningStateFailed - Resource creation failed. + ResourceProvisioningStateFailed ResourceProvisioningState = "Failed" + // ResourceProvisioningStateSucceeded - Resource has been created. + ResourceProvisioningStateSucceeded ResourceProvisioningState = "Succeeded" +) + +// PossibleResourceProvisioningStateValues returns the possible values for the ResourceProvisioningState const type. +func PossibleResourceProvisioningStateValues() []ResourceProvisioningState { + return []ResourceProvisioningState{ + ResourceProvisioningStateCanceled, + ResourceProvisioningStateFailed, + ResourceProvisioningStateSucceeded, + } +} + +// SingleSignOnStates - Various states of the SSO resource +type SingleSignOnStates string + +const ( + // SingleSignOnStatesDisable - SSO is disabled for the organization + SingleSignOnStatesDisable SingleSignOnStates = "Disable" + // SingleSignOnStatesEnable - SSO is enabled for the organization + SingleSignOnStatesEnable SingleSignOnStates = "Enable" + // SingleSignOnStatesInitial - Initial state of the SSO resource + SingleSignOnStatesInitial SingleSignOnStates = "Initial" +) + +// PossibleSingleSignOnStatesValues returns the possible values for the SingleSignOnStates const type. +func PossibleSingleSignOnStatesValues() []SingleSignOnStates { + return []SingleSignOnStates{ + SingleSignOnStatesDisable, + SingleSignOnStatesEnable, + SingleSignOnStatesInitial, + } +} diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/internal.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/internal.go new file mode 100644 index 000000000000..7425b6a669e2 --- /dev/null +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/internal.go @@ -0,0 +1,65 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "net/http" + "sync" +) + +type result struct { + resp *http.Response + err error +} + +type nonRetriableError struct { + error +} + +func (nonRetriableError) NonRetriable() { + // marker method +} + +func contains[T comparable](s []T, v T) bool { + for _, vv := range s { + if vv == v { + return true + } + } + return false +} + +func newTracker[T any]() *tracker[T] { + return &tracker[T]{ + items: map[string]*T{}, + } +} + +type tracker[T any] struct { + items map[string]*T + mu sync.Mutex +} + +func (p *tracker[T]) get(req *http.Request) *T { + p.mu.Lock() + defer p.mu.Unlock() + if item, ok := p.items[server.SanitizePagerPollerPath(req.URL.Path)]; ok { + return item + } + return nil +} + +func (p *tracker[T]) add(req *http.Request, item *T) { + p.mu.Lock() + defer p.mu.Unlock() + p.items[server.SanitizePagerPollerPath(req.URL.Path)] = item +} + +func (p *tracker[T]) remove(req *http.Request) { + p.mu.Lock() + defer p.mu.Unlock() + delete(p.items, server.SanitizePagerPollerPath(req.URL.Path)) +} diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/operations_server.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/operations_server.go new file mode 100644 index 000000000000..c30b0623a4d2 --- /dev/null +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/operations_server.go @@ -0,0 +1,117 @@ +// 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) Go Code Generator. DO NOT EDIT. + +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/neonpostgres/armneonpostgres" + "net/http" +) + +// OperationsServer is a fake server for instances of the armneonpostgres.OperationsClient type. +type OperationsServer struct { + // NewListPager is the fake for method OperationsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *armneonpostgres.OperationsClientListOptions) (resp azfake.PagerResponder[armneonpostgres.OperationsClientListResponse]) +} + +// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. +// The returned OperationsServerTransport instance is connected to an instance of armneonpostgres.OperationsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewOperationsServerTransport(srv *OperationsServer) *OperationsServerTransport { + return &OperationsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armneonpostgres.OperationsClientListResponse]](), + } +} + +// OperationsServerTransport connects instances of armneonpostgres.OperationsClient to instances of OperationsServer. +// Don't use this type directly, use NewOperationsServerTransport instead. +type OperationsServerTransport struct { + srv *OperationsServer + newListPager *tracker[azfake.PagerResponder[armneonpostgres.OperationsClientListResponse]] +} + +// Do implements the policy.Transporter interface for OperationsServerTransport. +func (o *OperationsServerTransport) 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")} + } + + return o.dispatchToMethodFake(req, method) +} + +func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if o.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := o.newListPager.get(req) + if newListPager == nil { + resp := o.srv.NewListPager(nil) + newListPager = &resp + o.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armneonpostgres.OperationsClientListResponse, 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) { + o.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + o.newListPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/organizations_server.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/organizations_server.go new file mode 100644 index 000000000000..10e568444f2e --- /dev/null +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/organizations_server.go @@ -0,0 +1,374 @@ +// 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) Go Code Generator. DO NOT EDIT. + +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/neonpostgres/armneonpostgres" + "net/http" + "net/url" + "regexp" +) + +// OrganizationsServer is a fake server for instances of the armneonpostgres.OrganizationsClient type. +type OrganizationsServer struct { + // BeginCreateOrUpdate is the fake for method OrganizationsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, organizationName string, resource armneonpostgres.OrganizationResource, options *armneonpostgres.OrganizationsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armneonpostgres.OrganizationsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method OrganizationsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, organizationName string, options *armneonpostgres.OrganizationsClientBeginDeleteOptions) (resp azfake.PollerResponder[armneonpostgres.OrganizationsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method OrganizationsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, organizationName string, options *armneonpostgres.OrganizationsClientGetOptions) (resp azfake.Responder[armneonpostgres.OrganizationsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method OrganizationsClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armneonpostgres.OrganizationsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armneonpostgres.OrganizationsClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method OrganizationsClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armneonpostgres.OrganizationsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armneonpostgres.OrganizationsClientListBySubscriptionResponse]) + + // BeginUpdate is the fake for method OrganizationsClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, organizationName string, properties armneonpostgres.OrganizationResource, options *armneonpostgres.OrganizationsClientBeginUpdateOptions) (resp azfake.PollerResponder[armneonpostgres.OrganizationsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewOrganizationsServerTransport creates a new instance of OrganizationsServerTransport with the provided implementation. +// The returned OrganizationsServerTransport instance is connected to an instance of armneonpostgres.OrganizationsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewOrganizationsServerTransport(srv *OrganizationsServer) *OrganizationsServerTransport { + return &OrganizationsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armneonpostgres.OrganizationsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armneonpostgres.OrganizationsClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armneonpostgres.OrganizationsClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armneonpostgres.OrganizationsClientListBySubscriptionResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armneonpostgres.OrganizationsClientUpdateResponse]](), + } +} + +// OrganizationsServerTransport connects instances of armneonpostgres.OrganizationsClient to instances of OrganizationsServer. +// Don't use this type directly, use NewOrganizationsServerTransport instead. +type OrganizationsServerTransport struct { + srv *OrganizationsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armneonpostgres.OrganizationsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armneonpostgres.OrganizationsClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armneonpostgres.OrganizationsClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armneonpostgres.OrganizationsClientListBySubscriptionResponse]] + beginUpdate *tracker[azfake.PollerResponder[armneonpostgres.OrganizationsClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for OrganizationsServerTransport. +func (o *OrganizationsServerTransport) 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")} + } + + return o.dispatchToMethodFake(req, method) +} + +func (o *OrganizationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if organizationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = organizationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OrganizationsClient.BeginCreateOrUpdate": + res.resp, res.err = o.dispatchBeginCreateOrUpdate(req) + case "OrganizationsClient.BeginDelete": + res.resp, res.err = o.dispatchBeginDelete(req) + case "OrganizationsClient.Get": + res.resp, res.err = o.dispatchGet(req) + case "OrganizationsClient.NewListByResourceGroupPager": + res.resp, res.err = o.dispatchNewListByResourceGroupPager(req) + case "OrganizationsClient.NewListBySubscriptionPager": + res.resp, res.err = o.dispatchNewListBySubscriptionPager(req) + case "OrganizationsClient.BeginUpdate": + res.resp, res.err = o.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (o *OrganizationsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if o.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := o.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?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[armneonpostgres.OrganizationResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) + if err != nil { + return nil, err + } + respr, errRespr := o.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, organizationNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + o.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + o.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + o.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (o *OrganizationsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if o.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := o.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?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 + } + organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) + if err != nil { + return nil, err + } + respr, errRespr := o.srv.BeginDelete(req.Context(), resourceGroupNameParam, organizationNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + o.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) { + o.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) { + o.beginDelete.remove(req) + } + + return resp, nil +} + +func (o *OrganizationsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if o.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/Neon\.Postgres/organizations/(?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 + } + organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) + if err != nil { + return nil, err + } + respr, errRespr := o.srv.Get(req.Context(), resourceGroupNameParam, organizationNameParam, 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).OrganizationResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (o *OrganizationsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if o.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := o.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations` + 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 := o.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + o.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armneonpostgres.OrganizationsClientListByResourceGroupResponse, 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) { + o.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + o.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (o *OrganizationsServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if o.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := o.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations` + 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 := o.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + o.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armneonpostgres.OrganizationsClientListBySubscriptionResponse, 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) { + o.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + o.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (o *OrganizationsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if o.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := o.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?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[armneonpostgres.OrganizationResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) + if err != nil { + return nil, err + } + respr, errRespr := o.srv.BeginUpdate(req.Context(), resourceGroupNameParam, organizationNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + o.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) { + o.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) { + o.beginUpdate.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to OrganizationsServerTransport +var organizationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/server_factory.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/server_factory.go new file mode 100644 index 000000000000..556d0757b464 --- /dev/null +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/server_factory.go @@ -0,0 +1,81 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" + "sync" +) + +// ServerFactory is a fake server for instances of the armneonpostgres.ClientFactory type. +type ServerFactory struct { + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer + + // OrganizationsServer contains the fakes for client OrganizationsClient + OrganizationsServer OrganizationsServer +} + +// NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. +// The returned ServerFactoryTransport instance is connected to an instance of armneonpostgres.ClientFactory via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { + return &ServerFactoryTransport{ + srv: srv, + } +} + +// ServerFactoryTransport connects instances of armneonpostgres.ClientFactory to instances of ServerFactory. +// Don't use this type directly, use NewServerFactoryTransport instead. +type ServerFactoryTransport struct { + srv *ServerFactory + trMu sync.Mutex + trOperationsServer *OperationsServerTransport + trOrganizationsServer *OrganizationsServerTransport +} + +// Do implements the policy.Transporter interface for ServerFactoryTransport. +func (s *ServerFactoryTransport) 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")} + } + + client := method[:strings.Index(method, ".")] + var resp *http.Response + var err error + + switch client { + case "OperationsClient": + initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) + resp, err = s.trOperationsServer.Do(req) + case "OrganizationsClient": + initServer(s, &s.trOrganizationsServer, func() *OrganizationsServerTransport { + return NewOrganizationsServerTransport(&s.srv.OrganizationsServer) + }) + resp, err = s.trOrganizationsServer.Do(req) + default: + err = fmt.Errorf("unhandled client %s", client) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func initServer[T any](s *ServerFactoryTransport, dst **T, src func() *T) { + s.trMu.Lock() + if *dst == nil { + *dst = src() + } + s.trMu.Unlock() +} diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/time_rfc3339.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/time_rfc3339.go new file mode 100644 index 000000000000..87ee11e83b32 --- /dev/null +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/time_rfc3339.go @@ -0,0 +1,109 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) + +const ( + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` +) + +type dateTimeRFC3339 time.Time + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + return err +} + +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + +func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { + return nil + } + var aux dateTimeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/go.mod b/sdk/resourcemanager/neonpostgres/armneonpostgres/go.mod new file mode 100644 index 000000000000..153029e47ec0 --- /dev/null +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/go.mod @@ -0,0 +1,21 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres + +go 1.18 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 +) + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect + github.com/golang-jwt/jwt/v5 v5.2.1 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect + github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect + golang.org/x/crypto v0.27.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/text v0.18.0 // indirect +) diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/go.sum b/sdk/resourcemanager/neonpostgres/armneonpostgres/go.sum new file mode 100644 index 000000000000..cbddbbd9ecec --- /dev/null +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/go.sum @@ -0,0 +1,29 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 h1:JZg6HRh6W6U4OLl6lk7BZ7BLisIzM9dG1R50zUk9C/M= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0/go.mod h1:YL1xnZ6QejvQHWJrX/AvhFl4WW4rqHVoKspWNVwFk0M= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= +github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/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-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/models.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/models.go new file mode 100644 index 000000000000..c2f676abe180 --- /dev/null +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/models.go @@ -0,0 +1,227 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armneonpostgres + +import "time" + +// CompanyDetails - Company details for an organization +type CompanyDetails struct { + // Business phone number of the company + BusinessPhone *string + + // Company name + CompanyName *string + + // Country name of the company + Country *string + + // Domain of the user + Domain *string + + // Number of employees in the company + NumberOfEmployees *int64 + + // Office address of the company + OfficeAddress *string +} + +// MarketplaceDetails - Marketplace details for an organization +type MarketplaceDetails struct { + // REQUIRED; Offer details for the marketplace that is selected by the user + OfferDetails *OfferDetails + + // SaaS subscription id for the the marketplace offer + SubscriptionID *string + + // Marketplace subscription status + SubscriptionStatus *MarketplaceSubscriptionStatus +} + +// OfferDetails - Offer details for the marketplace that is selected by the user +type OfferDetails struct { + // REQUIRED; Offer Id for the marketplace offer + OfferID *string + + // REQUIRED; Plan Id for the marketplace offer + PlanID *string + + // REQUIRED; Publisher Id for the marketplace offer + PublisherID *string + + // Plan Name for the marketplace offer + PlanName *string + + // Term Id for the marketplace offer + TermID *string + + // Term Name for the marketplace offer + TermUnit *string +} + +// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +type Operation struct { + // Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + ActionType *ActionType + + // READ-ONLY; Localized display information for this particular operation. + Display *OperationDisplay + + // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure + // Resource Manager/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 and 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 { + // REQUIRED; The Operation items on this page + Value []*Operation + + // The link to the next page of items + NextLink *string +} + +// OrganizationProperties - Properties specific to Data Organization resource +type OrganizationProperties struct { + // REQUIRED; Details of the company. + CompanyDetails *CompanyDetails + + // REQUIRED; Marketplace details of the resource. + MarketplaceDetails *MarketplaceDetails + + // REQUIRED; Details of the user. + UserDetails *UserDetails + + // Organization properties + PartnerOrganizationProperties *PartnerOrganizationProperties + + // READ-ONLY; Provisioning state of the resource. + ProvisioningState *ResourceProvisioningState +} + +// OrganizationResource - Organization Resource by Neon +type OrganizationResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *OrganizationProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Name of the Neon Organizations resource + Name *string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *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 +} + +// OrganizationResourceListResult - The response of a OrganizationResource list operation. +type OrganizationResourceListResult struct { + // REQUIRED; The OrganizationResource items on this page + Value []*OrganizationResource + + // The link to the next page of items + NextLink *string +} + +// PartnerOrganizationProperties - Properties specific to Partner's organization +type PartnerOrganizationProperties struct { + // REQUIRED; Organization name in partner's system + OrganizationName *string + + // Organization Id in partner's system + OrganizationID *string + + // Single Sign On properties for the organization + SingleSignOnProperties *SingleSignOnProperties +} + +// SingleSignOnProperties - Properties specific to Single Sign On Resource +type SingleSignOnProperties struct { + // List of AAD domains fetched from Microsoft Graph for user. + AADDomains []*string + + // AAD enterprise application Id used to setup SSO + EnterpriseAppID *string + + // State of the Single Sign On for the organization + SingleSignOnState *SingleSignOnStates + + // URL for SSO to be used by the partner to redirect the user to their system + SingleSignOnURL *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 +} + +// UserDetails - User details for an organization +type UserDetails struct { + // Email address of the user + EmailAddress *string + + // First name of the user + FirstName *string + + // Last name of the user + LastName *string + + // User's phone number + PhoneNumber *string + + // User's principal name + Upn *string +} diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/models_serde.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/models_serde.go new file mode 100644 index 000000000000..717b61c582bb --- /dev/null +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/models_serde.go @@ -0,0 +1,563 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armneonpostgres + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type CompanyDetails. +func (c CompanyDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "businessPhone", c.BusinessPhone) + populate(objectMap, "companyName", c.CompanyName) + populate(objectMap, "country", c.Country) + populate(objectMap, "domain", c.Domain) + populate(objectMap, "numberOfEmployees", c.NumberOfEmployees) + populate(objectMap, "officeAddress", c.OfficeAddress) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CompanyDetails. +func (c *CompanyDetails) UnmarshalJSON(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) + } + for key, val := range rawMsg { + var err error + switch key { + case "businessPhone": + err = unpopulate(val, "BusinessPhone", &c.BusinessPhone) + delete(rawMsg, key) + case "companyName": + err = unpopulate(val, "CompanyName", &c.CompanyName) + delete(rawMsg, key) + case "country": + err = unpopulate(val, "Country", &c.Country) + delete(rawMsg, key) + case "domain": + err = unpopulate(val, "Domain", &c.Domain) + delete(rawMsg, key) + case "numberOfEmployees": + err = unpopulate(val, "NumberOfEmployees", &c.NumberOfEmployees) + delete(rawMsg, key) + case "officeAddress": + err = unpopulate(val, "OfficeAddress", &c.OfficeAddress) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MarketplaceDetails. +func (m MarketplaceDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "offerDetails", m.OfferDetails) + populate(objectMap, "subscriptionId", m.SubscriptionID) + populate(objectMap, "subscriptionStatus", m.SubscriptionStatus) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MarketplaceDetails. +func (m *MarketplaceDetails) UnmarshalJSON(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 "offerDetails": + err = unpopulate(val, "OfferDetails", &m.OfferDetails) + delete(rawMsg, key) + case "subscriptionId": + err = unpopulate(val, "SubscriptionID", &m.SubscriptionID) + delete(rawMsg, key) + case "subscriptionStatus": + err = unpopulate(val, "SubscriptionStatus", &m.SubscriptionStatus) + 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 OfferDetails. +func (o OfferDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "offerId", o.OfferID) + populate(objectMap, "planId", o.PlanID) + populate(objectMap, "planName", o.PlanName) + populate(objectMap, "publisherId", o.PublisherID) + populate(objectMap, "termId", o.TermID) + populate(objectMap, "termUnit", o.TermUnit) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OfferDetails. +func (o *OfferDetails) UnmarshalJSON(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 "offerId": + err = unpopulate(val, "OfferID", &o.OfferID) + delete(rawMsg, key) + case "planId": + err = unpopulate(val, "PlanID", &o.PlanID) + delete(rawMsg, key) + case "planName": + err = unpopulate(val, "PlanName", &o.PlanName) + delete(rawMsg, key) + case "publisherId": + err = unpopulate(val, "PublisherID", &o.PublisherID) + delete(rawMsg, key) + case "termId": + err = unpopulate(val, "TermID", &o.TermID) + delete(rawMsg, key) + case "termUnit": + err = unpopulate(val, "TermUnit", &o.TermUnit) + 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 OrganizationProperties. +func (o OrganizationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "companyDetails", o.CompanyDetails) + populate(objectMap, "marketplaceDetails", o.MarketplaceDetails) + populate(objectMap, "partnerOrganizationProperties", o.PartnerOrganizationProperties) + populate(objectMap, "provisioningState", o.ProvisioningState) + populate(objectMap, "userDetails", o.UserDetails) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OrganizationProperties. +func (o *OrganizationProperties) UnmarshalJSON(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 "companyDetails": + err = unpopulate(val, "CompanyDetails", &o.CompanyDetails) + delete(rawMsg, key) + case "marketplaceDetails": + err = unpopulate(val, "MarketplaceDetails", &o.MarketplaceDetails) + delete(rawMsg, key) + case "partnerOrganizationProperties": + err = unpopulate(val, "PartnerOrganizationProperties", &o.PartnerOrganizationProperties) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &o.ProvisioningState) + delete(rawMsg, key) + case "userDetails": + err = unpopulate(val, "UserDetails", &o.UserDetails) + 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 OrganizationResource. +func (o OrganizationResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", o.ID) + populate(objectMap, "location", o.Location) + populate(objectMap, "name", o.Name) + populate(objectMap, "properties", o.Properties) + populate(objectMap, "systemData", o.SystemData) + populate(objectMap, "tags", o.Tags) + populate(objectMap, "type", o.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OrganizationResource. +func (o *OrganizationResource) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &o.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &o.Location) + 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 "systemData": + err = unpopulate(val, "SystemData", &o.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &o.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &o.Type) + 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 OrganizationResourceListResult. +func (o OrganizationResourceListResult) 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 OrganizationResourceListResult. +func (o *OrganizationResourceListResult) UnmarshalJSON(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 PartnerOrganizationProperties. +func (p PartnerOrganizationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "organizationId", p.OrganizationID) + populate(objectMap, "organizationName", p.OrganizationName) + populate(objectMap, "singleSignOnProperties", p.SingleSignOnProperties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerOrganizationProperties. +func (p *PartnerOrganizationProperties) UnmarshalJSON(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 "organizationId": + err = unpopulate(val, "OrganizationID", &p.OrganizationID) + delete(rawMsg, key) + case "organizationName": + err = unpopulate(val, "OrganizationName", &p.OrganizationName) + delete(rawMsg, key) + case "singleSignOnProperties": + err = unpopulate(val, "SingleSignOnProperties", &p.SingleSignOnProperties) + 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 SingleSignOnProperties. +func (s SingleSignOnProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "aadDomains", s.AADDomains) + populate(objectMap, "enterpriseAppId", s.EnterpriseAppID) + populate(objectMap, "singleSignOnState", s.SingleSignOnState) + populate(objectMap, "singleSignOnUrl", s.SingleSignOnURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SingleSignOnProperties. +func (s *SingleSignOnProperties) UnmarshalJSON(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 "aadDomains": + err = unpopulate(val, "AADDomains", &s.AADDomains) + delete(rawMsg, key) + case "enterpriseAppId": + err = unpopulate(val, "EnterpriseAppID", &s.EnterpriseAppID) + delete(rawMsg, key) + case "singleSignOnState": + err = unpopulate(val, "SingleSignOnState", &s.SingleSignOnState) + delete(rawMsg, key) + case "singleSignOnUrl": + err = unpopulate(val, "SingleSignOnURL", &s.SingleSignOnURL) + 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 UserDetails. +func (u UserDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "emailAddress", u.EmailAddress) + populate(objectMap, "firstName", u.FirstName) + populate(objectMap, "lastName", u.LastName) + populate(objectMap, "phoneNumber", u.PhoneNumber) + populate(objectMap, "upn", u.Upn) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserDetails. +func (u *UserDetails) UnmarshalJSON(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 "emailAddress": + err = unpopulate(val, "EmailAddress", &u.EmailAddress) + delete(rawMsg, key) + case "firstName": + err = unpopulate(val, "FirstName", &u.FirstName) + delete(rawMsg, key) + case "lastName": + err = unpopulate(val, "LastName", &u.LastName) + delete(rawMsg, key) + case "phoneNumber": + err = unpopulate(val, "PhoneNumber", &u.PhoneNumber) + delete(rawMsg, key) + case "upn": + err = unpopulate(val, "Upn", &u.Upn) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v any) error { + if data == nil || string(data) == "null" { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/operations_client.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/operations_client.go new file mode 100644 index 000000000000..d4de494eccb2 --- /dev/null +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/operations_client.go @@ -0,0 +1,84 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armneonpostgres + +import ( + "context" + "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" +) + +// OperationsClient contains the methods for the Operations group. +// Don't use this type directly, use NewOperationsClient() instead. +type OperationsClient struct { + internal *arm.Client +} + +// NewOperationsClient creates a new instance of OperationsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &OperationsClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - List the operations for the provider +// +// Generated from API version 2024-08-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 page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.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, options) + }, nil) + if err != nil { + return OperationsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Neon.Postgres/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", "2024-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { + result := OperationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { + return OperationsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/operations_client_example_test.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/operations_client_example_test.go new file mode 100644 index 000000000000..88e995b751b9 --- /dev/null +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/operations_client_example_test.go @@ -0,0 +1,56 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armneonpostgres_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres" + "log" +) + +// Generated from example definition: 2024-08-01-preview/Operations_List_MaximumSet_Gen.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 := armneonpostgres.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 = armneonpostgres.OperationsClientListResponse{ + // OperationListResult: armneonpostgres.OperationListResult{ + // Value: []*armneonpostgres.Operation{ + // { + // Name: to.Ptr("ekvuojrpbuyogrikfuzyghio"), + // IsDataAction: to.Ptr(true), + // Display: &armneonpostgres.OperationDisplay{ + // Provider: to.Ptr("lvppuskqcdcoejwuvsqrloczvnouy"), + // Resource: to.Ptr("rvvd"), + // Operation: to.Ptr("odjjqnodcgszczpsdrhrpwmqssrybr"), + // Description: to.Ptr("bwmstukaiaoisiu"), + // }, + // Origin: to.Ptr(armneonpostgres.OriginUser), + // ActionType: to.Ptr(armneonpostgres.ActionTypeInternal), + // }, + // }, + // NextLink: to.Ptr("https://contoso.com/nextlink"), + // }, + // } + } +} diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/options.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/options.go new file mode 100644 index 000000000000..bfccbb6f8dfa --- /dev/null +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/options.go @@ -0,0 +1,46 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armneonpostgres + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// OrganizationsClientBeginCreateOrUpdateOptions contains the optional parameters for the OrganizationsClient.BeginCreateOrUpdate +// method. +type OrganizationsClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// OrganizationsClientBeginDeleteOptions contains the optional parameters for the OrganizationsClient.BeginDelete method. +type OrganizationsClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// OrganizationsClientBeginUpdateOptions contains the optional parameters for the OrganizationsClient.BeginUpdate method. +type OrganizationsClientBeginUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// OrganizationsClientGetOptions contains the optional parameters for the OrganizationsClient.Get method. +type OrganizationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// OrganizationsClientListByResourceGroupOptions contains the optional parameters for the OrganizationsClient.NewListByResourceGroupPager +// method. +type OrganizationsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// OrganizationsClientListBySubscriptionOptions contains the optional parameters for the OrganizationsClient.NewListBySubscriptionPager +// method. +type OrganizationsClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/organizations_client.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/organizations_client.go new file mode 100644 index 000000000000..81c23c12b462 --- /dev/null +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/organizations_client.go @@ -0,0 +1,457 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armneonpostgres + +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" +) + +// OrganizationsClient contains the methods for the Organizations group. +// Don't use this type directly, use NewOrganizationsClient() instead. +type OrganizationsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewOrganizationsClient creates a new instance of OrganizationsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewOrganizationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OrganizationsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &OrganizationsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a OrganizationResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - organizationName - Name of the Neon Organizations resource +// - resource - Resource create parameters. +// - options - OrganizationsClientBeginCreateOrUpdateOptions contains the optional parameters for the OrganizationsClient.BeginCreateOrUpdate +// method. +func (client *OrganizationsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, organizationName string, resource OrganizationResource, options *OrganizationsClientBeginCreateOrUpdateOptions) (*runtime.Poller[OrganizationsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, organizationName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[OrganizationsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[OrganizationsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a OrganizationResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-01-preview +func (client *OrganizationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, organizationName string, resource OrganizationResource, options *OrganizationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "OrganizationsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, organizationName, resource, 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 +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *OrganizationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, resource OrganizationResource, _ *OrganizationsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}" + 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 organizationName == "" { + return nil, errors.New("parameter organizationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{organizationName}", url.PathEscape(organizationName)) + 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", "2024-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Delete a OrganizationResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - organizationName - Name of the Neon Organizations resource +// - options - OrganizationsClientBeginDeleteOptions contains the optional parameters for the OrganizationsClient.BeginDelete +// method. +func (client *OrganizationsClient) BeginDelete(ctx context.Context, resourceGroupName string, organizationName string, options *OrganizationsClientBeginDeleteOptions) (*runtime.Poller[OrganizationsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, organizationName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[OrganizationsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[OrganizationsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a OrganizationResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-01-preview +func (client *OrganizationsClient) deleteOperation(ctx context.Context, resourceGroupName string, organizationName string, options *OrganizationsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "OrganizationsClient.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, organizationName, 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.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *OrganizationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, _ *OrganizationsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}" + 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 organizationName == "" { + return nil, errors.New("parameter organizationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{organizationName}", url.PathEscape(organizationName)) + 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", "2024-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a OrganizationResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - organizationName - Name of the Neon Organizations resource +// - options - OrganizationsClientGetOptions contains the optional parameters for the OrganizationsClient.Get method. +func (client *OrganizationsClient) Get(ctx context.Context, resourceGroupName string, organizationName string, options *OrganizationsClientGetOptions) (OrganizationsClientGetResponse, error) { + var err error + const operationName = "OrganizationsClient.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, organizationName, options) + if err != nil { + return OrganizationsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return OrganizationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return OrganizationsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *OrganizationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, _ *OrganizationsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}" + 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 organizationName == "" { + return nil, errors.New("parameter organizationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{organizationName}", url.PathEscape(organizationName)) + 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", "2024-08-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 *OrganizationsClient) getHandleResponse(resp *http.Response) (OrganizationsClientGetResponse, error) { + result := OrganizationsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OrganizationResource); err != nil { + return OrganizationsClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List OrganizationResource resources by resource group +// +// Generated from API version 2024-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - OrganizationsClientListByResourceGroupOptions contains the optional parameters for the OrganizationsClient.NewListByResourceGroupPager +// method. +func (client *OrganizationsClient) NewListByResourceGroupPager(resourceGroupName string, options *OrganizationsClientListByResourceGroupOptions) *runtime.Pager[OrganizationsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[OrganizationsClientListByResourceGroupResponse]{ + More: func(page OrganizationsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OrganizationsClientListByResourceGroupResponse) (OrganizationsClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OrganizationsClient.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 OrganizationsClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *OrganizationsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *OrganizationsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations" + 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", "2024-08-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 *OrganizationsClient) listByResourceGroupHandleResponse(resp *http.Response) (OrganizationsClientListByResourceGroupResponse, error) { + result := OrganizationsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OrganizationResourceListResult); err != nil { + return OrganizationsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List OrganizationResource resources by subscription ID +// +// Generated from API version 2024-08-01-preview +// - options - OrganizationsClientListBySubscriptionOptions contains the optional parameters for the OrganizationsClient.NewListBySubscriptionPager +// method. +func (client *OrganizationsClient) NewListBySubscriptionPager(options *OrganizationsClientListBySubscriptionOptions) *runtime.Pager[OrganizationsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[OrganizationsClientListBySubscriptionResponse]{ + More: func(page OrganizationsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OrganizationsClientListBySubscriptionResponse) (OrganizationsClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OrganizationsClient.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 OrganizationsClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *OrganizationsClient) listBySubscriptionCreateRequest(ctx context.Context, _ *OrganizationsClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Neon.Postgres/organizations" + 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", "2024-08-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 *OrganizationsClient) listBySubscriptionHandleResponse(resp *http.Response) (OrganizationsClientListBySubscriptionResponse, error) { + result := OrganizationsClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OrganizationResourceListResult); err != nil { + return OrganizationsClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// BeginUpdate - Update a OrganizationResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - organizationName - Name of the Neon Organizations resource +// - properties - The resource properties to be updated. +// - options - OrganizationsClientBeginUpdateOptions contains the optional parameters for the OrganizationsClient.BeginUpdate +// method. +func (client *OrganizationsClient) BeginUpdate(ctx context.Context, resourceGroupName string, organizationName string, properties OrganizationResource, options *OrganizationsClientBeginUpdateOptions) (*runtime.Poller[OrganizationsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, organizationName, properties, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[OrganizationsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[OrganizationsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Update a OrganizationResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-01-preview +func (client *OrganizationsClient) update(ctx context.Context, resourceGroupName string, organizationName string, properties OrganizationResource, options *OrganizationsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "OrganizationsClient.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, organizationName, 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 *OrganizationsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, properties OrganizationResource, _ *OrganizationsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}" + 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 organizationName == "" { + return nil, errors.New("parameter organizationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{organizationName}", url.PathEscape(organizationName)) + 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", "2024-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/organizations_client_example_test.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/organizations_client_example_test.go new file mode 100644 index 000000000000..8c1b36426b1d --- /dev/null +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/organizations_client_example_test.go @@ -0,0 +1,546 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armneonpostgres_test + +import ( + "context" + "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/neonpostgres/armneonpostgres" + "log" +) + +// Generated from example definition: 2024-08-01-preview/Organizations_CreateOrUpdate_MaximumSet_Gen.json +func ExampleOrganizationsClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armneonpostgres.NewClientFactory("1178323D-8270-4757-B639-D528B6266487", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewOrganizationsClient().BeginCreateOrUpdate(ctx, "rgneon", "XB-.:", armneonpostgres.OrganizationResource{ + Properties: &armneonpostgres.OrganizationProperties{ + MarketplaceDetails: &armneonpostgres.MarketplaceDetails{ + SubscriptionID: to.Ptr("yxmkfivp"), + SubscriptionStatus: to.Ptr(armneonpostgres.MarketplaceSubscriptionStatusPendingFulfillmentStart), + OfferDetails: &armneonpostgres.OfferDetails{ + PublisherID: to.Ptr("hporaxnopmolttlnkbarw"), + OfferID: to.Ptr("bunyeeupoedueofwrzej"), + PlanID: to.Ptr("nlbfiwtslenfwek"), + PlanName: to.Ptr("ljbmgpkfqklaufacbpml"), + TermUnit: to.Ptr("qbcq"), + TermID: to.Ptr("aedlchikwqckuploswthvshe"), + }, + }, + UserDetails: &armneonpostgres.UserDetails{ + FirstName: to.Ptr("buwwe"), + LastName: to.Ptr("escynjpynkoox"), + EmailAddress: to.Ptr("3i_%@w8-y.H-p.tvj.dG"), + Upn: to.Ptr("fwedjamgwwrotcjaucuzdwycfjdqn"), + PhoneNumber: to.Ptr("dlrqoowumy"), + }, + CompanyDetails: &armneonpostgres.CompanyDetails{ + CompanyName: to.Ptr("uxn"), + Country: to.Ptr("lpajqzptqchuko"), + OfficeAddress: to.Ptr("chpkrlpmfslmawgunjxdllzcrctykq"), + BusinessPhone: to.Ptr("hbeb"), + Domain: to.Ptr("krjldeakhwiepvs"), + NumberOfEmployees: to.Ptr[int64](23), + }, + PartnerOrganizationProperties: &armneonpostgres.PartnerOrganizationProperties{ + OrganizationID: to.Ptr("nrhvoqzulowcunhmvwfgjcaibvwcl"), + OrganizationName: to.Ptr("2__.-"), + SingleSignOnProperties: &armneonpostgres.SingleSignOnProperties{ + SingleSignOnState: to.Ptr(armneonpostgres.SingleSignOnStatesInitial), + EnterpriseAppID: to.Ptr("fpibacregjfncfdsojs"), + SingleSignOnURL: to.Ptr("tmojh"), + AADDomains: []*string{ + to.Ptr("kndszgrwzbvvlssvkej"), + }, + }, + }, + }, + Tags: map[string]*string{ + "key2099": to.Ptr("omjjymaqtrqzksxszhzgyl"), + }, + Location: to.Ptr("upxxgikyqrbnv"), + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %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 = armneonpostgres.OrganizationsClientCreateOrUpdateResponse{ + // OrganizationResource: &armneonpostgres.OrganizationResource{ + // Properties: &armneonpostgres.OrganizationProperties{ + // MarketplaceDetails: &armneonpostgres.MarketplaceDetails{ + // SubscriptionID: to.Ptr("yxmkfivp"), + // SubscriptionStatus: to.Ptr(armneonpostgres.MarketplaceSubscriptionStatusPendingFulfillmentStart), + // OfferDetails: &armneonpostgres.OfferDetails{ + // PublisherID: to.Ptr("hporaxnopmolttlnkbarw"), + // OfferID: to.Ptr("bunyeeupoedueofwrzej"), + // PlanID: to.Ptr("nlbfiwtslenfwek"), + // PlanName: to.Ptr("ljbmgpkfqklaufacbpml"), + // TermUnit: to.Ptr("qbcq"), + // TermID: to.Ptr("aedlchikwqckuploswthvshe"), + // }, + // }, + // UserDetails: &armneonpostgres.UserDetails{ + // FirstName: to.Ptr("buwwe"), + // LastName: to.Ptr("escynjpynkoox"), + // EmailAddress: to.Ptr("3i_%@w8-y.H-p.tvj.dG"), + // Upn: to.Ptr("fwedjamgwwrotcjaucuzdwycfjdqn"), + // PhoneNumber: to.Ptr("dlrqoowumy"), + // }, + // CompanyDetails: &armneonpostgres.CompanyDetails{ + // CompanyName: to.Ptr("uxn"), + // Country: to.Ptr("lpajqzptqchuko"), + // OfficeAddress: to.Ptr("chpkrlpmfslmawgunjxdllzcrctykq"), + // BusinessPhone: to.Ptr("hbeb"), + // Domain: to.Ptr("krjldeakhwiepvs"), + // NumberOfEmployees: to.Ptr[int64](23), + // }, + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), + // PartnerOrganizationProperties: &armneonpostgres.PartnerOrganizationProperties{ + // OrganizationID: to.Ptr("nrhvoqzulowcunhmvwfgjcaibvwcl"), + // OrganizationName: to.Ptr("2__.-"), + // SingleSignOnProperties: &armneonpostgres.SingleSignOnProperties{ + // SingleSignOnState: to.Ptr(armneonpostgres.SingleSignOnStatesInitial), + // EnterpriseAppID: to.Ptr("fpibacregjfncfdsojs"), + // SingleSignOnURL: to.Ptr("tmojh"), + // AADDomains: []*string{ + // to.Ptr("kndszgrwzbvvlssvkej"), + // }, + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key2099": to.Ptr("omjjymaqtrqzksxszhzgyl"), + // }, + // Location: to.Ptr("upxxgikyqrbnv"), + // ID: to.Ptr("/subscriptions/1178323D-8270-4757-B639-D528B6266487/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/2__.-"), + // Name: to.Ptr("grhdqtqnkqmu"), + // Type: to.Ptr("gapeymltyvlqlvpgdgfxidkkd"), + // SystemData: &armneonpostgres.SystemData{ + // CreatedBy: to.Ptr("qfhekdgpvdtqcohjhvlyhzd"), + // CreatedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-30T15:12:24.902Z"); return t}()), + // LastModifiedBy: to.Ptr("dqsjroejrtucfjyqcoonpdopfaa"), + // LastModifiedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-30T15:12:24.902Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2024-08-01-preview/Organizations_Delete_MaximumSet_Gen.json +func ExampleOrganizationsClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armneonpostgres.NewClientFactory("1178323D-8270-4757-B639-D528B6266487", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewOrganizationsClient().BeginDelete(ctx, "rgneon", "2_3", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: 2024-08-01-preview/Organizations_Get_MaximumSet_Gen.json +func ExampleOrganizationsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armneonpostgres.NewClientFactory("1178323D-8270-4757-B639-D528B6266487", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewOrganizationsClient().Get(ctx, "rgneon", "5", 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 = armneonpostgres.OrganizationsClientGetResponse{ + // OrganizationResource: &armneonpostgres.OrganizationResource{ + // Properties: &armneonpostgres.OrganizationProperties{ + // MarketplaceDetails: &armneonpostgres.MarketplaceDetails{ + // SubscriptionID: to.Ptr("yxmkfivp"), + // SubscriptionStatus: to.Ptr(armneonpostgres.MarketplaceSubscriptionStatusPendingFulfillmentStart), + // OfferDetails: &armneonpostgres.OfferDetails{ + // PublisherID: to.Ptr("hporaxnopmolttlnkbarw"), + // OfferID: to.Ptr("bunyeeupoedueofwrzej"), + // PlanID: to.Ptr("nlbfiwtslenfwek"), + // PlanName: to.Ptr("ljbmgpkfqklaufacbpml"), + // TermUnit: to.Ptr("qbcq"), + // TermID: to.Ptr("aedlchikwqckuploswthvshe"), + // }, + // }, + // UserDetails: &armneonpostgres.UserDetails{ + // FirstName: to.Ptr("buwwe"), + // LastName: to.Ptr("escynjpynkoox"), + // EmailAddress: to.Ptr("3i_%@w8-y.H-p.tvj.dG"), + // Upn: to.Ptr("fwedjamgwwrotcjaucuzdwycfjdqn"), + // PhoneNumber: to.Ptr("dlrqoowumy"), + // }, + // CompanyDetails: &armneonpostgres.CompanyDetails{ + // CompanyName: to.Ptr("uxn"), + // Country: to.Ptr("lpajqzptqchuko"), + // OfficeAddress: to.Ptr("chpkrlpmfslmawgunjxdllzcrctykq"), + // BusinessPhone: to.Ptr("hbeb"), + // Domain: to.Ptr("krjldeakhwiepvs"), + // NumberOfEmployees: to.Ptr[int64](23), + // }, + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), + // PartnerOrganizationProperties: &armneonpostgres.PartnerOrganizationProperties{ + // OrganizationID: to.Ptr("nrhvoqzulowcunhmvwfgjcaibvwcl"), + // OrganizationName: to.Ptr("2__.-"), + // SingleSignOnProperties: &armneonpostgres.SingleSignOnProperties{ + // SingleSignOnState: to.Ptr(armneonpostgres.SingleSignOnStatesInitial), + // EnterpriseAppID: to.Ptr("fpibacregjfncfdsojs"), + // SingleSignOnURL: to.Ptr("tmojh"), + // AADDomains: []*string{ + // to.Ptr("kndszgrwzbvvlssvkej"), + // }, + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key2099": to.Ptr("omjjymaqtrqzksxszhzgyl"), + // }, + // Location: to.Ptr("upxxgikyqrbnv"), + // ID: to.Ptr("/subscriptions/1178323D-8270-4757-B639-D528B6266487/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/2__.-"), + // Name: to.Ptr("grhdqtqnkqmu"), + // Type: to.Ptr("gapeymltyvlqlvpgdgfxidkkd"), + // SystemData: &armneonpostgres.SystemData{ + // CreatedBy: to.Ptr("qfhekdgpvdtqcohjhvlyhzd"), + // CreatedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-30T15:12:24.902Z"); return t}()), + // LastModifiedBy: to.Ptr("dqsjroejrtucfjyqcoonpdopfaa"), + // LastModifiedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-30T15:12:24.902Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2024-08-01-preview/Organizations_ListByResourceGroup_MaximumSet_Gen.json +func ExampleOrganizationsClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armneonpostgres.NewClientFactory("1178323D-8270-4757-B639-D528B6266487", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewOrganizationsClient().NewListByResourceGroupPager("rgneon", 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 = armneonpostgres.OrganizationsClientListByResourceGroupResponse{ + // OrganizationResourceListResult: armneonpostgres.OrganizationResourceListResult{ + // Value: []*armneonpostgres.OrganizationResource{ + // { + // Properties: &armneonpostgres.OrganizationProperties{ + // MarketplaceDetails: &armneonpostgres.MarketplaceDetails{ + // SubscriptionID: to.Ptr("yxmkfivp"), + // SubscriptionStatus: to.Ptr(armneonpostgres.MarketplaceSubscriptionStatusPendingFulfillmentStart), + // OfferDetails: &armneonpostgres.OfferDetails{ + // PublisherID: to.Ptr("hporaxnopmolttlnkbarw"), + // OfferID: to.Ptr("bunyeeupoedueofwrzej"), + // PlanID: to.Ptr("nlbfiwtslenfwek"), + // PlanName: to.Ptr("ljbmgpkfqklaufacbpml"), + // TermUnit: to.Ptr("qbcq"), + // TermID: to.Ptr("aedlchikwqckuploswthvshe"), + // }, + // }, + // UserDetails: &armneonpostgres.UserDetails{ + // FirstName: to.Ptr("buwwe"), + // LastName: to.Ptr("escynjpynkoox"), + // EmailAddress: to.Ptr("3i_%@w8-y.H-p.tvj.dG"), + // Upn: to.Ptr("fwedjamgwwrotcjaucuzdwycfjdqn"), + // PhoneNumber: to.Ptr("dlrqoowumy"), + // }, + // CompanyDetails: &armneonpostgres.CompanyDetails{ + // CompanyName: to.Ptr("uxn"), + // Country: to.Ptr("lpajqzptqchuko"), + // OfficeAddress: to.Ptr("chpkrlpmfslmawgunjxdllzcrctykq"), + // BusinessPhone: to.Ptr("hbeb"), + // Domain: to.Ptr("krjldeakhwiepvs"), + // NumberOfEmployees: to.Ptr[int64](23), + // }, + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), + // PartnerOrganizationProperties: &armneonpostgres.PartnerOrganizationProperties{ + // OrganizationID: to.Ptr("nrhvoqzulowcunhmvwfgjcaibvwcl"), + // OrganizationName: to.Ptr("2__.-"), + // SingleSignOnProperties: &armneonpostgres.SingleSignOnProperties{ + // SingleSignOnState: to.Ptr(armneonpostgres.SingleSignOnStatesInitial), + // EnterpriseAppID: to.Ptr("fpibacregjfncfdsojs"), + // SingleSignOnURL: to.Ptr("tmojh"), + // AADDomains: []*string{ + // to.Ptr("kndszgrwzbvvlssvkej"), + // }, + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key2099": to.Ptr("omjjymaqtrqzksxszhzgyl"), + // }, + // Location: to.Ptr("upxxgikyqrbnv"), + // ID: to.Ptr("/subscriptions/1178323D-8270-4757-B639-D528B6266487/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/2__.-"), + // Name: to.Ptr("grhdqtqnkqmu"), + // Type: to.Ptr("gapeymltyvlqlvpgdgfxidkkd"), + // SystemData: &armneonpostgres.SystemData{ + // CreatedBy: to.Ptr("qfhekdgpvdtqcohjhvlyhzd"), + // CreatedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-30T15:12:24.902Z"); return t}()), + // LastModifiedBy: to.Ptr("dqsjroejrtucfjyqcoonpdopfaa"), + // LastModifiedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-30T15:12:24.902Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2024-08-01-preview/Organizations_ListBySubscription_MaximumSet_Gen.json +func ExampleOrganizationsClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armneonpostgres.NewClientFactory("1178323D-8270-4757-B639-D528B6266487", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewOrganizationsClient().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 = armneonpostgres.OrganizationsClientListBySubscriptionResponse{ + // OrganizationResourceListResult: armneonpostgres.OrganizationResourceListResult{ + // Value: []*armneonpostgres.OrganizationResource{ + // { + // Properties: &armneonpostgres.OrganizationProperties{ + // MarketplaceDetails: &armneonpostgres.MarketplaceDetails{ + // SubscriptionID: to.Ptr("yxmkfivp"), + // SubscriptionStatus: to.Ptr(armneonpostgres.MarketplaceSubscriptionStatusPendingFulfillmentStart), + // OfferDetails: &armneonpostgres.OfferDetails{ + // PublisherID: to.Ptr("hporaxnopmolttlnkbarw"), + // OfferID: to.Ptr("bunyeeupoedueofwrzej"), + // PlanID: to.Ptr("nlbfiwtslenfwek"), + // PlanName: to.Ptr("ljbmgpkfqklaufacbpml"), + // TermUnit: to.Ptr("qbcq"), + // TermID: to.Ptr("aedlchikwqckuploswthvshe"), + // }, + // }, + // UserDetails: &armneonpostgres.UserDetails{ + // FirstName: to.Ptr("buwwe"), + // LastName: to.Ptr("escynjpynkoox"), + // EmailAddress: to.Ptr("3i_%@w8-y.H-p.tvj.dG"), + // Upn: to.Ptr("fwedjamgwwrotcjaucuzdwycfjdqn"), + // PhoneNumber: to.Ptr("dlrqoowumy"), + // }, + // CompanyDetails: &armneonpostgres.CompanyDetails{ + // CompanyName: to.Ptr("uxn"), + // Country: to.Ptr("lpajqzptqchuko"), + // OfficeAddress: to.Ptr("chpkrlpmfslmawgunjxdllzcrctykq"), + // BusinessPhone: to.Ptr("hbeb"), + // Domain: to.Ptr("krjldeakhwiepvs"), + // NumberOfEmployees: to.Ptr[int64](23), + // }, + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), + // PartnerOrganizationProperties: &armneonpostgres.PartnerOrganizationProperties{ + // OrganizationID: to.Ptr("nrhvoqzulowcunhmvwfgjcaibvwcl"), + // OrganizationName: to.Ptr("2__.-"), + // SingleSignOnProperties: &armneonpostgres.SingleSignOnProperties{ + // SingleSignOnState: to.Ptr(armneonpostgres.SingleSignOnStatesInitial), + // EnterpriseAppID: to.Ptr("fpibacregjfncfdsojs"), + // SingleSignOnURL: to.Ptr("tmojh"), + // AADDomains: []*string{ + // to.Ptr("kndszgrwzbvvlssvkej"), + // }, + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key2099": to.Ptr("omjjymaqtrqzksxszhzgyl"), + // }, + // Location: to.Ptr("upxxgikyqrbnv"), + // ID: to.Ptr("/subscriptions/1178323D-8270-4757-B639-D528B6266487/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/2__.-"), + // Name: to.Ptr("grhdqtqnkqmu"), + // Type: to.Ptr("gapeymltyvlqlvpgdgfxidkkd"), + // SystemData: &armneonpostgres.SystemData{ + // CreatedBy: to.Ptr("qfhekdgpvdtqcohjhvlyhzd"), + // CreatedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-30T15:12:24.902Z"); return t}()), + // LastModifiedBy: to.Ptr("dqsjroejrtucfjyqcoonpdopfaa"), + // LastModifiedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-30T15:12:24.902Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2024-08-01-preview/Organizations_Update_MaximumSet_Gen.json +func ExampleOrganizationsClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armneonpostgres.NewClientFactory("1178323D-8270-4757-B639-D528B6266487", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewOrganizationsClient().BeginUpdate(ctx, "rgneon", "eRY-J_:", armneonpostgres.OrganizationResource{ + Properties: &armneonpostgres.OrganizationProperties{ + UserDetails: &armneonpostgres.UserDetails{ + FirstName: to.Ptr("buwwe"), + LastName: to.Ptr("escynjpynkoox"), + EmailAddress: to.Ptr("3i_%@w8-y.H-p.tvj.dG"), + Upn: to.Ptr("fwedjamgwwrotcjaucuzdwycfjdqn"), + PhoneNumber: to.Ptr("dlrqoowumy"), + }, + CompanyDetails: &armneonpostgres.CompanyDetails{ + CompanyName: to.Ptr("uxn"), + Country: to.Ptr("lpajqzptqchuko"), + OfficeAddress: to.Ptr("chpkrlpmfslmawgunjxdllzcrctykq"), + BusinessPhone: to.Ptr("hbeb"), + Domain: to.Ptr("krjldeakhwiepvs"), + NumberOfEmployees: to.Ptr[int64](23), + }, + PartnerOrganizationProperties: &armneonpostgres.PartnerOrganizationProperties{ + OrganizationID: to.Ptr("njyoqflcmfwzfsqe"), + OrganizationName: to.Ptr("J:.._3P"), + SingleSignOnProperties: &armneonpostgres.SingleSignOnProperties{ + SingleSignOnState: to.Ptr(armneonpostgres.SingleSignOnStatesInitial), + EnterpriseAppID: to.Ptr("fpibacregjfncfdsojs"), + SingleSignOnURL: to.Ptr("tmojh"), + AADDomains: []*string{ + to.Ptr("kndszgrwzbvvlssvkej"), + }, + }, + }, + }, + Tags: map[string]*string{ + "key8990": to.Ptr("wuvaontoqyttxtikvvahdegcfdfkz"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %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 = armneonpostgres.OrganizationsClientUpdateResponse{ + // OrganizationResource: &armneonpostgres.OrganizationResource{ + // Properties: &armneonpostgres.OrganizationProperties{ + // MarketplaceDetails: &armneonpostgres.MarketplaceDetails{ + // SubscriptionID: to.Ptr("yxmkfivp"), + // SubscriptionStatus: to.Ptr(armneonpostgres.MarketplaceSubscriptionStatusPendingFulfillmentStart), + // OfferDetails: &armneonpostgres.OfferDetails{ + // PublisherID: to.Ptr("hporaxnopmolttlnkbarw"), + // OfferID: to.Ptr("bunyeeupoedueofwrzej"), + // PlanID: to.Ptr("nlbfiwtslenfwek"), + // PlanName: to.Ptr("ljbmgpkfqklaufacbpml"), + // TermUnit: to.Ptr("qbcq"), + // TermID: to.Ptr("aedlchikwqckuploswthvshe"), + // }, + // }, + // UserDetails: &armneonpostgres.UserDetails{ + // FirstName: to.Ptr("buwwe"), + // LastName: to.Ptr("escynjpynkoox"), + // EmailAddress: to.Ptr("3i_%@w8-y.H-p.tvj.dG"), + // Upn: to.Ptr("fwedjamgwwrotcjaucuzdwycfjdqn"), + // PhoneNumber: to.Ptr("dlrqoowumy"), + // }, + // CompanyDetails: &armneonpostgres.CompanyDetails{ + // CompanyName: to.Ptr("uxn"), + // Country: to.Ptr("lpajqzptqchuko"), + // OfficeAddress: to.Ptr("chpkrlpmfslmawgunjxdllzcrctykq"), + // BusinessPhone: to.Ptr("hbeb"), + // Domain: to.Ptr("krjldeakhwiepvs"), + // NumberOfEmployees: to.Ptr[int64](23), + // }, + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), + // PartnerOrganizationProperties: &armneonpostgres.PartnerOrganizationProperties{ + // OrganizationID: to.Ptr("njyoqflcmfwzfsqe"), + // OrganizationName: to.Ptr("J:.._3P"), + // SingleSignOnProperties: &armneonpostgres.SingleSignOnProperties{ + // SingleSignOnState: to.Ptr(armneonpostgres.SingleSignOnStatesInitial), + // EnterpriseAppID: to.Ptr("fpibacregjfncfdsojs"), + // SingleSignOnURL: to.Ptr("tmojh"), + // AADDomains: []*string{ + // to.Ptr("kndszgrwzbvvlssvkej"), + // }, + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key2099": to.Ptr("omjjymaqtrqzksxszhzgyl"), + // }, + // Location: to.Ptr("upxxgikyqrbnv"), + // ID: to.Ptr("/subscriptions/1178323D-8270-4757-B639-D528B6266487/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/eRY-J_:"), + // Name: to.Ptr("grhdqtqnkqmu"), + // Type: to.Ptr("gapeymltyvlqlvpgdgfxidkkd"), + // SystemData: &armneonpostgres.SystemData{ + // CreatedBy: to.Ptr("qfhekdgpvdtqcohjhvlyhzd"), + // CreatedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-30T15:12:24.902Z"); return t}()), + // LastModifiedBy: to.Ptr("dqsjroejrtucfjyqcoonpdopfaa"), + // LastModifiedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-30T15:12:24.902Z"); return t}()), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/responses.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/responses.go new file mode 100644 index 000000000000..1eacfafa5069 --- /dev/null +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/responses.go @@ -0,0 +1,46 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armneonpostgres + +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. +type OperationsClientListResponse struct { + // 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 +} + +// OrganizationsClientCreateOrUpdateResponse contains the response from method OrganizationsClient.BeginCreateOrUpdate. +type OrganizationsClientCreateOrUpdateResponse struct { + // Organization Resource by Neon + OrganizationResource +} + +// OrganizationsClientDeleteResponse contains the response from method OrganizationsClient.BeginDelete. +type OrganizationsClientDeleteResponse struct { + // placeholder for future response values +} + +// OrganizationsClientGetResponse contains the response from method OrganizationsClient.Get. +type OrganizationsClientGetResponse struct { + // Organization Resource by Neon + OrganizationResource +} + +// OrganizationsClientListByResourceGroupResponse contains the response from method OrganizationsClient.NewListByResourceGroupPager. +type OrganizationsClientListByResourceGroupResponse struct { + // The response of a OrganizationResource list operation. + OrganizationResourceListResult +} + +// OrganizationsClientListBySubscriptionResponse contains the response from method OrganizationsClient.NewListBySubscriptionPager. +type OrganizationsClientListBySubscriptionResponse struct { + // The response of a OrganizationResource list operation. + OrganizationResourceListResult +} + +// OrganizationsClientUpdateResponse contains the response from method OrganizationsClient.BeginUpdate. +type OrganizationsClientUpdateResponse struct { + // Organization Resource by Neon + OrganizationResource +} diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/time_rfc3339.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/time_rfc3339.go new file mode 100644 index 000000000000..302675535299 --- /dev/null +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/time_rfc3339.go @@ -0,0 +1,109 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armneonpostgres + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) + +const ( + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` +) + +type dateTimeRFC3339 time.Time + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + return err +} + +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + +func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { + return nil + } + var aux dateTimeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/tsp-location.yaml b/sdk/resourcemanager/neonpostgres/armneonpostgres/tsp-location.yaml new file mode 100644 index 000000000000..e9bd8e4b493f --- /dev/null +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/liftrneon/Neon.Postgres.Management +commit: df55cd8178ddd870dbd0c3b1e25c80e3ff48826c +repo: Azure/azure-rest-api-specs +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/CHANGELOG.md b/sdk/resourcemanager/sitemanager/armsitemanager/CHANGELOG.md new file mode 100644 index 000000000000..e6f6dc809ffb --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 0.1.0 (2024-11-19) +### Other Changes + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sitemanager/armsitemanager` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt). \ No newline at end of file diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/LICENSE.txt b/sdk/resourcemanager/sitemanager/armsitemanager/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/README.md b/sdk/resourcemanager/sitemanager/armsitemanager/README.md new file mode 100644 index 000000000000..ff156458e8f2 --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/README.md @@ -0,0 +1,92 @@ +# Azure Sitemanager Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sitemanager/armsitemanager)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sitemanager/armsitemanager) + +The `armsitemanager` module provides operations for working with Azure Sitemanager. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/sitemanager/armsitemanager) + +# Getting started + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.18 or above (You could download and install the latest version of Go from [here](https://go.dev/doc/install). It will replace the existing Go on your machine. If you want to install multiple Go versions on the same machine, you could refer this [doc](https://go.dev/doc/manage-install).) + +## Install the package + +This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management. + +Install the Azure Sitemanager module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sitemanager/armsitemanager +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Sitemanager. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more. + +```go +cred, err := azidentity.NewDefaultAzureCredential(nil) +``` + +For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). + +## Client Factory + +Azure Sitemanager module consists of one or more clients. We provide a client factory which could be used to create any client in this module. + +```go +clientFactory, err := armsitemanager.NewClientFactory(, cred, nil) +``` + +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). + +```go +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, +} +clientFactory, err := armsitemanager.NewClientFactory(, cred, &options) +``` + +## Clients + +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.NewSitesBySubscriptionClient() +``` + +## Fakes + +The fake package contains types used for constructing in-memory fake servers used in unit tests. +This allows writing tests to cover various success/error conditions without the need for connecting to a live service. + +Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes. + +## Provide Feedback + +If you encounter bugs or have suggestions, please +[open an issue](https://github.com/Azure/azure-sdk-for-go/issues) and assign the `Sitemanager` label. + +# Contributing + +This project welcomes contributions and suggestions. Most contributions require +you to agree to a Contributor License Agreement (CLA) declaring that you have +the right to, and actually do, grant us the rights to use your contribution. +For details, visit [https://cla.microsoft.com](https://cla.microsoft.com). + +When you submit a pull request, a CLA-bot will automatically determine whether +you need to provide a CLA and decorate the PR appropriately (e.g., label, +comment). Simply follow the instructions provided by the bot. You will only +need to do this once across all repos using our CLA. + +This project has adopted the +[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information, see the +[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any +additional questions or comments. \ No newline at end of file diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/ci.yml b/sdk/resourcemanager/sitemanager/armsitemanager/ci.yml new file mode 100644 index 000000000000..01788f4950a3 --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/ci.yml @@ -0,0 +1,28 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/sitemanager/armsitemanager/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/sitemanager/armsitemanager/ + +extends: + template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/sitemanager/armsitemanager' diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/client_factory.go b/sdk/resourcemanager/sitemanager/armsitemanager/client_factory.go new file mode 100644 index 000000000000..c32210938fb8 --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/client_factory.go @@ -0,0 +1,49 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armsitemanager + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" +) + +// ClientFactory is a client factory used to create any client in this module. +// Don't use this type directly, use NewClientFactory instead. +type ClientFactory struct { + subscriptionID string + internal *arm.Client +} + +// 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 - The ID of the target subscription. The value must be an UUID. +// - 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) { + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, + internal: internal, + }, nil +} + +// NewSitesBySubscriptionClient creates a new instance of SitesBySubscriptionClient. +func (c *ClientFactory) NewSitesBySubscriptionClient() *SitesBySubscriptionClient { + return &SitesBySubscriptionClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewSitesClient creates a new instance of SitesClient. +func (c *ClientFactory) NewSitesClient() *SitesClient { + return &SitesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/constants.go b/sdk/resourcemanager/sitemanager/armsitemanager/constants.go new file mode 100644 index 000000000000..938b4a1f6098 --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/constants.go @@ -0,0 +1,55 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armsitemanager + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sitemanager/armsitemanager" + moduleVersion = "v0.1.0" +) + +// CreatedByType - The kind of entity that created the resource. +type CreatedByType string + +const ( + // CreatedByTypeApplication - The entity was created by an application. + CreatedByTypeApplication CreatedByType = "Application" + // CreatedByTypeKey - The entity was created by a key. + CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeManagedIdentity - The entity was created by a managed identity. + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + // CreatedByTypeUser - The entity was created by a user. + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + +// ResourceProvisioningState - The provisioning state of a resource type. +type ResourceProvisioningState string + +const ( + // ResourceProvisioningStateCanceled - Resource creation was canceled. + ResourceProvisioningStateCanceled ResourceProvisioningState = "Canceled" + // ResourceProvisioningStateFailed - Resource creation failed. + ResourceProvisioningStateFailed ResourceProvisioningState = "Failed" + // ResourceProvisioningStateSucceeded - Resource has been created. + ResourceProvisioningStateSucceeded ResourceProvisioningState = "Succeeded" +) + +// PossibleResourceProvisioningStateValues returns the possible values for the ResourceProvisioningState const type. +func PossibleResourceProvisioningStateValues() []ResourceProvisioningState { + return []ResourceProvisioningState{ + ResourceProvisioningStateCanceled, + ResourceProvisioningStateFailed, + ResourceProvisioningStateSucceeded, + } +} diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/fake/internal.go b/sdk/resourcemanager/sitemanager/armsitemanager/fake/internal.go new file mode 100644 index 000000000000..7425b6a669e2 --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/fake/internal.go @@ -0,0 +1,65 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "net/http" + "sync" +) + +type result struct { + resp *http.Response + err error +} + +type nonRetriableError struct { + error +} + +func (nonRetriableError) NonRetriable() { + // marker method +} + +func contains[T comparable](s []T, v T) bool { + for _, vv := range s { + if vv == v { + return true + } + } + return false +} + +func newTracker[T any]() *tracker[T] { + return &tracker[T]{ + items: map[string]*T{}, + } +} + +type tracker[T any] struct { + items map[string]*T + mu sync.Mutex +} + +func (p *tracker[T]) get(req *http.Request) *T { + p.mu.Lock() + defer p.mu.Unlock() + if item, ok := p.items[server.SanitizePagerPollerPath(req.URL.Path)]; ok { + return item + } + return nil +} + +func (p *tracker[T]) add(req *http.Request, item *T) { + p.mu.Lock() + defer p.mu.Unlock() + p.items[server.SanitizePagerPollerPath(req.URL.Path)] = item +} + +func (p *tracker[T]) remove(req *http.Request) { + p.mu.Lock() + defer p.mu.Unlock() + delete(p.items, server.SanitizePagerPollerPath(req.URL.Path)) +} diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/fake/server_factory.go b/sdk/resourcemanager/sitemanager/armsitemanager/fake/server_factory.go new file mode 100644 index 000000000000..b0ca6984dca2 --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/fake/server_factory.go @@ -0,0 +1,81 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" + "sync" +) + +// ServerFactory is a fake server for instances of the armsitemanager.ClientFactory type. +type ServerFactory struct { + // SitesBySubscriptionServer contains the fakes for client SitesBySubscriptionClient + SitesBySubscriptionServer SitesBySubscriptionServer + + // SitesServer contains the fakes for client SitesClient + SitesServer SitesServer +} + +// NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. +// The returned ServerFactoryTransport instance is connected to an instance of armsitemanager.ClientFactory via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { + return &ServerFactoryTransport{ + srv: srv, + } +} + +// ServerFactoryTransport connects instances of armsitemanager.ClientFactory to instances of ServerFactory. +// Don't use this type directly, use NewServerFactoryTransport instead. +type ServerFactoryTransport struct { + srv *ServerFactory + trMu sync.Mutex + trSitesBySubscriptionServer *SitesBySubscriptionServerTransport + trSitesServer *SitesServerTransport +} + +// Do implements the policy.Transporter interface for ServerFactoryTransport. +func (s *ServerFactoryTransport) 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")} + } + + client := method[:strings.Index(method, ".")] + var resp *http.Response + var err error + + switch client { + case "SitesBySubscriptionClient": + initServer(s, &s.trSitesBySubscriptionServer, func() *SitesBySubscriptionServerTransport { + return NewSitesBySubscriptionServerTransport(&s.srv.SitesBySubscriptionServer) + }) + resp, err = s.trSitesBySubscriptionServer.Do(req) + case "SitesClient": + initServer(s, &s.trSitesServer, func() *SitesServerTransport { return NewSitesServerTransport(&s.srv.SitesServer) }) + resp, err = s.trSitesServer.Do(req) + default: + err = fmt.Errorf("unhandled client %s", client) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func initServer[T any](s *ServerFactoryTransport, dst **T, src func() *T) { + s.trMu.Lock() + if *dst == nil { + *dst = src() + } + s.trMu.Unlock() +} diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/fake/sites_server.go b/sdk/resourcemanager/sitemanager/armsitemanager/fake/sites_server.go new file mode 100644 index 000000000000..d76902de37a3 --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/fake/sites_server.go @@ -0,0 +1,307 @@ +// 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) Go Code Generator. DO NOT EDIT. + +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/sitemanager/armsitemanager" + "net/http" + "net/url" + "regexp" +) + +// SitesServer is a fake server for instances of the armsitemanager.SitesClient type. +type SitesServer struct { + // BeginCreateOrUpdate is the fake for method SitesClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, siteName string, resource armsitemanager.Site, options *armsitemanager.SitesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armsitemanager.SitesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method SitesClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, siteName string, options *armsitemanager.SitesClientDeleteOptions) (resp azfake.Responder[armsitemanager.SitesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method SitesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, siteName string, options *armsitemanager.SitesClientGetOptions) (resp azfake.Responder[armsitemanager.SitesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method SitesClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armsitemanager.SitesClientListByResourceGroupOptions) (resp azfake.PagerResponder[armsitemanager.SitesClientListByResourceGroupResponse]) + + // Update is the fake for method SitesClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, siteName string, properties armsitemanager.SiteUpdate, options *armsitemanager.SitesClientUpdateOptions) (resp azfake.Responder[armsitemanager.SitesClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewSitesServerTransport creates a new instance of SitesServerTransport with the provided implementation. +// The returned SitesServerTransport instance is connected to an instance of armsitemanager.SitesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSitesServerTransport(srv *SitesServer) *SitesServerTransport { + return &SitesServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armsitemanager.SitesClientCreateOrUpdateResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armsitemanager.SitesClientListByResourceGroupResponse]](), + } +} + +// SitesServerTransport connects instances of armsitemanager.SitesClient to instances of SitesServer. +// Don't use this type directly, use NewSitesServerTransport instead. +type SitesServerTransport struct { + srv *SitesServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armsitemanager.SitesClientCreateOrUpdateResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armsitemanager.SitesClientListByResourceGroupResponse]] +} + +// Do implements the policy.Transporter interface for SitesServerTransport. +func (s *SitesServerTransport) 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")} + } + + return s.dispatchToMethodFake(req, method) +} + +func (s *SitesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if sitesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = sitesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SitesClient.BeginCreateOrUpdate": + res.resp, res.err = s.dispatchBeginCreateOrUpdate(req) + case "SitesClient.Delete": + res.resp, res.err = s.dispatchDelete(req) + case "SitesClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "SitesClient.NewListByResourceGroupPager": + res.resp, res.err = s.dispatchNewListByResourceGroupPager(req) + case "SitesClient.Update": + res.resp, res.err = s.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (s *SitesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if s.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := s.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Edge/sites/(?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[armsitemanager.Site](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.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + s.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + s.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + s.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (s *SitesServerTransport) 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\.Edge/sites/(?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 *SitesServerTransport) 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\.Edge/sites/(?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).Site, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SitesServerTransport) 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\.Edge/sites` + 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 *armsitemanager.SitesClientListByResourceGroupResponse, 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 *SitesServerTransport) 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\.Edge/sites/(?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[armsitemanager.SiteUpdate](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).Site, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to SitesServerTransport +var sitesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/fake/sitesbysubscription_server.go b/sdk/resourcemanager/sitemanager/armsitemanager/fake/sitesbysubscription_server.go new file mode 100644 index 000000000000..4b36c82422df --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/fake/sitesbysubscription_server.go @@ -0,0 +1,287 @@ +// 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) Go Code Generator. DO NOT EDIT. + +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/sitemanager/armsitemanager" + "net/http" + "net/url" + "regexp" +) + +// SitesBySubscriptionServer is a fake server for instances of the armsitemanager.SitesBySubscriptionClient type. +type SitesBySubscriptionServer struct { + // BeginCreateOrUpdate is the fake for method SitesBySubscriptionClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, siteName string, resource armsitemanager.Site, options *armsitemanager.SitesBySubscriptionClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armsitemanager.SitesBySubscriptionClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method SitesBySubscriptionClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, siteName string, options *armsitemanager.SitesBySubscriptionClientDeleteOptions) (resp azfake.Responder[armsitemanager.SitesBySubscriptionClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method SitesBySubscriptionClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, siteName string, options *armsitemanager.SitesBySubscriptionClientGetOptions) (resp azfake.Responder[armsitemanager.SitesBySubscriptionClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method SitesBySubscriptionClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *armsitemanager.SitesBySubscriptionClientListOptions) (resp azfake.PagerResponder[armsitemanager.SitesBySubscriptionClientListResponse]) + + // Update is the fake for method SitesBySubscriptionClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, siteName string, properties armsitemanager.SiteUpdate, options *armsitemanager.SitesBySubscriptionClientUpdateOptions) (resp azfake.Responder[armsitemanager.SitesBySubscriptionClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewSitesBySubscriptionServerTransport creates a new instance of SitesBySubscriptionServerTransport with the provided implementation. +// The returned SitesBySubscriptionServerTransport instance is connected to an instance of armsitemanager.SitesBySubscriptionClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSitesBySubscriptionServerTransport(srv *SitesBySubscriptionServer) *SitesBySubscriptionServerTransport { + return &SitesBySubscriptionServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armsitemanager.SitesBySubscriptionClientCreateOrUpdateResponse]](), + newListPager: newTracker[azfake.PagerResponder[armsitemanager.SitesBySubscriptionClientListResponse]](), + } +} + +// SitesBySubscriptionServerTransport connects instances of armsitemanager.SitesBySubscriptionClient to instances of SitesBySubscriptionServer. +// Don't use this type directly, use NewSitesBySubscriptionServerTransport instead. +type SitesBySubscriptionServerTransport struct { + srv *SitesBySubscriptionServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armsitemanager.SitesBySubscriptionClientCreateOrUpdateResponse]] + newListPager *tracker[azfake.PagerResponder[armsitemanager.SitesBySubscriptionClientListResponse]] +} + +// Do implements the policy.Transporter interface for SitesBySubscriptionServerTransport. +func (s *SitesBySubscriptionServerTransport) 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")} + } + + return s.dispatchToMethodFake(req, method) +} + +func (s *SitesBySubscriptionServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if sitesBySubscriptionServerTransportInterceptor != nil { + res.resp, res.err, intercepted = sitesBySubscriptionServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SitesBySubscriptionClient.BeginCreateOrUpdate": + res.resp, res.err = s.dispatchBeginCreateOrUpdate(req) + case "SitesBySubscriptionClient.Delete": + res.resp, res.err = s.dispatchDelete(req) + case "SitesBySubscriptionClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "SitesBySubscriptionClient.NewListPager": + res.resp, res.err = s.dispatchNewListPager(req) + case "SitesBySubscriptionClient.Update": + res.resp, res.err = s.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (s *SitesBySubscriptionServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if s.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := s.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Edge/sites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[armsitemanager.Site](req) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginCreateOrUpdate(req.Context(), siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + s.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + s.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + s.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (s *SitesBySubscriptionServerTransport) 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~%@]+)/providers/Microsoft\.Edge/sites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Delete(req.Context(), 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 *SitesBySubscriptionServerTransport) 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~%@]+)/providers/Microsoft\.Edge/sites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), 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).Site, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SitesBySubscriptionServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := s.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Edge/sites` + 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.NewListPager(nil) + newListPager = &resp + s.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsitemanager.SitesBySubscriptionClientListResponse, 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) { + s.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + s.newListPager.remove(req) + } + return resp, nil +} + +func (s *SitesBySubscriptionServerTransport) 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~%@]+)/providers/Microsoft\.Edge/sites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[armsitemanager.SiteUpdate](req) + 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(), 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).Site, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to SitesBySubscriptionServerTransport +var sitesBySubscriptionServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/fake/time_rfc3339.go b/sdk/resourcemanager/sitemanager/armsitemanager/fake/time_rfc3339.go new file mode 100644 index 000000000000..87ee11e83b32 --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/fake/time_rfc3339.go @@ -0,0 +1,109 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) + +const ( + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` +) + +type dateTimeRFC3339 time.Time + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + return err +} + +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + +func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { + return nil + } + var aux dateTimeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/go.mod b/sdk/resourcemanager/sitemanager/armsitemanager/go.mod new file mode 100644 index 000000000000..7c28ad853f77 --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/go.mod @@ -0,0 +1,21 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sitemanager/armsitemanager + +go 1.18 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 +) + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect + github.com/golang-jwt/jwt/v5 v5.2.1 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect + github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect + golang.org/x/crypto v0.27.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/text v0.18.0 // indirect +) diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/go.sum b/sdk/resourcemanager/sitemanager/armsitemanager/go.sum new file mode 100644 index 000000000000..cbddbbd9ecec --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/go.sum @@ -0,0 +1,29 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 h1:JZg6HRh6W6U4OLl6lk7BZ7BLisIzM9dG1R50zUk9C/M= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0/go.mod h1:YL1xnZ6QejvQHWJrX/AvhFl4WW4rqHVoKspWNVwFk0M= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= +github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/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-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/models.go b/sdk/resourcemanager/sitemanager/armsitemanager/models.go new file mode 100644 index 000000000000..c766ac6d29a2 --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/models.go @@ -0,0 +1,88 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armsitemanager + +import "time" + +// Site as ARM Resource +type Site struct { + // The resource-specific properties for this resource. + Properties *SiteProperties + + // READ-ONLY; Name of Site resource + Name *string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *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 +} + +// SiteListResult - The response of a Site list operation. +type SiteListResult struct { + // REQUIRED; The Site items on this page + Value []*Site + + // The link to the next page of items + NextLink *string +} + +// SiteProperties - Site properties +type SiteProperties struct { + // AddressResource ArmId of Site resource + AddressResourceID *string + + // Description of Site resource + Description *string + + // displayName of Site resource + DisplayName *string + + // READ-ONLY; Provisioning state of last operation + ProvisioningState *ResourceProvisioningState +} + +// SiteUpdate - The type used for update operations of the Site. +type SiteUpdate struct { + // The updatable properties of the Site. + Properties *SiteUpdateProperties +} + +// SiteUpdateProperties - The updatable properties of the Site. +type SiteUpdateProperties struct { + // AddressResource ArmId of Site resource + AddressResourceID *string + + // Description of Site resource + Description *string + + // displayName of Site resource + DisplayName *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 +} diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/models_serde.go b/sdk/resourcemanager/sitemanager/armsitemanager/models_serde.go new file mode 100644 index 000000000000..50edcbd3f177 --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/models_serde.go @@ -0,0 +1,254 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armsitemanager + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type Site. +func (s Site) 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 Site. +func (s *Site) UnmarshalJSON(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 SiteListResult. +func (s SiteListResult) 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 SiteListResult. +func (s *SiteListResult) UnmarshalJSON(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, "addressResourceId", s.AddressResourceID) + populate(objectMap, "description", s.Description) + populate(objectMap, "displayName", s.DisplayName) + populate(objectMap, "provisioningState", s.ProvisioningState) + 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 "addressResourceId": + err = unpopulate(val, "AddressResourceID", &s.AddressResourceID) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &s.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &s.DisplayName) + 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 SiteUpdate. +func (s SiteUpdate) 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 SiteUpdate. +func (s *SiteUpdate) UnmarshalJSON(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 SiteUpdateProperties. +func (s SiteUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "addressResourceId", s.AddressResourceID) + populate(objectMap, "description", s.Description) + populate(objectMap, "displayName", s.DisplayName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SiteUpdateProperties. +func (s *SiteUpdateProperties) UnmarshalJSON(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 "addressResourceId": + err = unpopulate(val, "AddressResourceID", &s.AddressResourceID) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &s.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &s.DisplayName) + 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 +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v any) error { + if data == nil || string(data) == "null" { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/options.go b/sdk/resourcemanager/sitemanager/armsitemanager/options.go new file mode 100644 index 000000000000..c798e4b73cb5 --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/options.go @@ -0,0 +1,59 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armsitemanager + +// SitesBySubscriptionClientBeginCreateOrUpdateOptions contains the optional parameters for the SitesBySubscriptionClient.BeginCreateOrUpdate +// method. +type SitesBySubscriptionClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// SitesBySubscriptionClientDeleteOptions contains the optional parameters for the SitesBySubscriptionClient.Delete method. +type SitesBySubscriptionClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// SitesBySubscriptionClientGetOptions contains the optional parameters for the SitesBySubscriptionClient.Get method. +type SitesBySubscriptionClientGetOptions struct { + // placeholder for future optional parameters +} + +// SitesBySubscriptionClientListOptions contains the optional parameters for the SitesBySubscriptionClient.NewListPager method. +type SitesBySubscriptionClientListOptions struct { + // placeholder for future optional parameters +} + +// SitesBySubscriptionClientUpdateOptions contains the optional parameters for the SitesBySubscriptionClient.Update method. +type SitesBySubscriptionClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// SitesClientBeginCreateOrUpdateOptions contains the optional parameters for the SitesClient.BeginCreateOrUpdate method. +type SitesClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// SitesClientDeleteOptions contains the optional parameters for the SitesClient.Delete method. +type SitesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// SitesClientGetOptions contains the optional parameters for the SitesClient.Get method. +type SitesClientGetOptions struct { + // placeholder for future optional parameters +} + +// SitesClientListByResourceGroupOptions contains the optional parameters for the SitesClient.NewListByResourceGroupPager +// method. +type SitesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// SitesClientUpdateOptions contains the optional parameters for the SitesClient.Update method. +type SitesClientUpdateOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/responses.go b/sdk/resourcemanager/sitemanager/armsitemanager/responses.go new file mode 100644 index 000000000000..acb8b682c742 --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/responses.go @@ -0,0 +1,63 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armsitemanager + +// SitesBySubscriptionClientCreateOrUpdateResponse contains the response from method SitesBySubscriptionClient.BeginCreateOrUpdate. +type SitesBySubscriptionClientCreateOrUpdateResponse struct { + // Site as ARM Resource + Site +} + +// SitesBySubscriptionClientDeleteResponse contains the response from method SitesBySubscriptionClient.Delete. +type SitesBySubscriptionClientDeleteResponse struct { + // placeholder for future response values +} + +// SitesBySubscriptionClientGetResponse contains the response from method SitesBySubscriptionClient.Get. +type SitesBySubscriptionClientGetResponse struct { + // Site as ARM Resource + Site +} + +// SitesBySubscriptionClientListResponse contains the response from method SitesBySubscriptionClient.NewListPager. +type SitesBySubscriptionClientListResponse struct { + // The response of a Site list operation. + SiteListResult +} + +// SitesBySubscriptionClientUpdateResponse contains the response from method SitesBySubscriptionClient.Update. +type SitesBySubscriptionClientUpdateResponse struct { + // Site as ARM Resource + Site +} + +// SitesClientCreateOrUpdateResponse contains the response from method SitesClient.BeginCreateOrUpdate. +type SitesClientCreateOrUpdateResponse struct { + // Site as ARM Resource + Site +} + +// SitesClientDeleteResponse contains the response from method SitesClient.Delete. +type SitesClientDeleteResponse struct { + // placeholder for future response values +} + +// SitesClientGetResponse contains the response from method SitesClient.Get. +type SitesClientGetResponse struct { + // Site as ARM Resource + Site +} + +// SitesClientListByResourceGroupResponse contains the response from method SitesClient.NewListByResourceGroupPager. +type SitesClientListByResourceGroupResponse struct { + // The response of a Site list operation. + SiteListResult +} + +// SitesClientUpdateResponse contains the response from method SitesClient.Update. +type SitesClientUpdateResponse struct { + // Site as ARM Resource + Site +} diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/sites_client.go b/sdk/resourcemanager/sitemanager/armsitemanager/sites_client.go new file mode 100644 index 000000000000..49563f0564ce --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/sites_client.go @@ -0,0 +1,368 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armsitemanager + +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" +) + +// SitesClient contains the methods for the Sites group. +// Don't use this type directly, use NewSitesClient() instead. +type SitesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSitesClient creates a new instance of SitesClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewSitesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SitesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SitesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a Site +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Name of Site resource +// - resource - Resource create parameters. +// - options - SitesClientBeginCreateOrUpdateOptions contains the optional parameters for the SitesClient.BeginCreateOrUpdate +// method. +func (client *SitesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, siteName string, resource Site, options *SitesClientBeginCreateOrUpdateOptions) (*runtime.Poller[SitesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, siteName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SitesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SitesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a Site +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +func (client *SitesClient) createOrUpdate(ctx context.Context, resourceGroupName string, siteName string, resource Site, options *SitesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "SitesClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, siteName, resource, 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 +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *SitesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, siteName string, resource Site, _ *SitesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/sites/{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", "2024-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// Delete - Delete a Site +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Name of Site resource +// - options - SitesClientDeleteOptions contains the optional parameters for the SitesClient.Delete method. +func (client *SitesClient) Delete(ctx context.Context, resourceGroupName string, siteName string, options *SitesClientDeleteOptions) (SitesClientDeleteResponse, error) { + var err error + const operationName = "SitesClient.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 SitesClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SitesClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return SitesClientDeleteResponse{}, err + } + return SitesClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *SitesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, _ *SitesClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/sites/{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", "2024-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a Site +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Name of Site resource +// - options - SitesClientGetOptions contains the optional parameters for the SitesClient.Get method. +func (client *SitesClient) Get(ctx context.Context, resourceGroupName string, siteName string, options *SitesClientGetOptions) (SitesClientGetResponse, error) { + var err error + const operationName = "SitesClient.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 SitesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SitesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SitesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *SitesClient) getCreateRequest(ctx context.Context, resourceGroupName string, siteName string, _ *SitesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/sites/{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", "2024-02-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 *SitesClient) getHandleResponse(resp *http.Response) (SitesClientGetResponse, error) { + result := SitesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Site); err != nil { + return SitesClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List Site resources by resource group +// +// Generated from API version 2024-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - SitesClientListByResourceGroupOptions contains the optional parameters for the SitesClient.NewListByResourceGroupPager +// method. +func (client *SitesClient) NewListByResourceGroupPager(resourceGroupName string, options *SitesClientListByResourceGroupOptions) *runtime.Pager[SitesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[SitesClientListByResourceGroupResponse]{ + More: func(page SitesClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SitesClientListByResourceGroupResponse) (SitesClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SitesClient.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 SitesClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *SitesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *SitesClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/sites" + 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", "2024-02-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 *SitesClient) listByResourceGroupHandleResponse(resp *http.Response) (SitesClientListByResourceGroupResponse, error) { + result := SitesClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SiteListResult); err != nil { + return SitesClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// Update - Update a Site +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Name of Site resource +// - properties - The resource properties to be updated. +// - options - SitesClientUpdateOptions contains the optional parameters for the SitesClient.Update method. +func (client *SitesClient) Update(ctx context.Context, resourceGroupName string, siteName string, properties SiteUpdate, options *SitesClientUpdateOptions) (SitesClientUpdateResponse, error) { + var err error + const operationName = "SitesClient.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, properties, options) + if err != nil { + return SitesClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SitesClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SitesClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *SitesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, siteName string, properties SiteUpdate, _ *SitesClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/sites/{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", "2024-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *SitesClient) updateHandleResponse(resp *http.Response) (SitesClientUpdateResponse, error) { + result := SitesClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Site); err != nil { + return SitesClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/sites_client_example_test.go b/sdk/resourcemanager/sitemanager/armsitemanager/sites_client_example_test.go new file mode 100644 index 000000000000..fcd9ca928be2 --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/sites_client_example_test.go @@ -0,0 +1,188 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armsitemanager_test + +import ( + "context" + "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/sitemanager/armsitemanager" + "log" +) + +// Generated from example definition: 2024-02-01-preview/Sites_CreateOrUpdate.json +func ExampleSitesClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsitemanager.NewClientFactory("0154f7fe-df09-4981-bf82-7ad5c1f596eb", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSitesClient().BeginCreateOrUpdate(ctx, "string", "string", armsitemanager.Site{ + Properties: &armsitemanager.SiteProperties{ + DisplayName: to.Ptr("string"), + Description: to.Ptr("string"), + AddressResourceID: to.Ptr("/subscriptions/680d0dad-59aa-4464-3df3-b34b2b42738c/resourceGroups/us-site-rg/providers/Microsoft.EdgeOrder/addresses/12343213"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %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 = armsitemanager.SitesClientCreateOrUpdateResponse{ + // Site: &armsitemanager.Site{ + // ID: to.Ptr("/subscriptions/0154f7fe-df09-4981-bf82-7ad5c1f596eb/resourcegroups/EdgeSitesRG/providers/Microsoft.Edge/Sites/BellvueSite"), + // Type: to.Ptr("string"), + // Properties: &armsitemanager.SiteProperties{ + // DisplayName: to.Ptr("string"), + // Description: to.Ptr("string"), + // AddressResourceID: to.Ptr("/subscriptions/680d0dad-59aa-4464-3df3-b34b2b42738c/resourceGroups/us-site-rg/providers/Microsoft.EdgeOrder/addresses/12343213"), + // ProvisioningState: to.Ptr(armsitemanager.ResourceProvisioningStateSucceeded), + // }, + // }, + // } +} + +// Generated from example definition: 2024-02-01-preview/Sites_Delete.json +func ExampleSitesClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsitemanager.NewClientFactory("0154f7fe-df09-4981-bf82-7ad5c1f596eb", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSitesClient().Delete(ctx, "string", "string", 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 = armsitemanager.SitesClientDeleteResponse{ + // } +} + +// Generated from example definition: 2024-02-01-preview/Sites_Get.json +func ExampleSitesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsitemanager.NewClientFactory("0154f7fe-df09-4981-bf82-7ad5c1f596eb", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSitesClient().Get(ctx, "string", "string", 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 = armsitemanager.SitesClientGetResponse{ + // Site: &armsitemanager.Site{ + // ID: to.Ptr("/subscriptions/0154f7fe-df09-4981-bf82-7ad5c1f596eb/resourcegroups/EdgeSitesRG/providers/Microsoft.Edge/Sites/BellvueSite"), + // Type: to.Ptr("string"), + // Properties: &armsitemanager.SiteProperties{ + // DisplayName: to.Ptr("string"), + // Description: to.Ptr("string"), + // AddressResourceID: to.Ptr("/subscriptions/11111111-2222-3333-4444-55555555/resourceGroups/us-site-rg/providers/Microsoft.EdgeOrder/addresses/12343213"), + // ProvisioningState: to.Ptr(armsitemanager.ResourceProvisioningStateSucceeded), + // }, + // }, + // } +} + +// Generated from example definition: 2024-02-01-preview/Sites_ListByResourceGroup.json +func ExampleSitesClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsitemanager.NewClientFactory("0154f7fe-df09-4981-bf82-7ad5c1f596eb", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewSitesClient().NewListByResourceGroupPager("string", 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 = armsitemanager.SitesClientListByResourceGroupResponse{ + // SiteListResult: armsitemanager.SiteListResult{ + // Value: []*armsitemanager.Site{ + // { + // ID: to.Ptr("/subscriptions/0154f7fe-df09-4981-bf82-7ad5c1f596eb/resourcegroups/EdgeSitesRG/providers/Microsoft.Edge/Sites/BellvueSite"), + // Type: to.Ptr("string"), + // Properties: &armsitemanager.SiteProperties{ + // DisplayName: to.Ptr("string"), + // Description: to.Ptr("string"), + // AddressResourceID: to.Ptr("/subscriptions/11111111-2222-3333-4444-55555555/resourceGroups/us-site-rg/providers/Microsoft.EdgeOrder/addresses/12343213"), + // ProvisioningState: to.Ptr(armsitemanager.ResourceProvisioningStateSucceeded), + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2024-02-01-preview/Sites_Update.json +func ExampleSitesClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsitemanager.NewClientFactory("0154f7fe-df09-4981-bf82-7ad5c1f596eb", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSitesClient().Update(ctx, "string", "string", armsitemanager.SiteUpdate{ + Properties: &armsitemanager.SiteUpdateProperties{ + DisplayName: to.Ptr("string"), + Description: to.Ptr("string"), + AddressResourceID: to.Ptr("/subscriptions/11111111-2222-3333-4444-55555555/resourceGroups/us-site-rg/providers/Microsoft.EdgeOrder/addresses/12343213"), + }, + }, 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 = armsitemanager.SitesClientUpdateResponse{ + // Site: &armsitemanager.Site{ + // ID: to.Ptr("/subscriptions/0154f7fe-df09-4981-bf82-7ad5c1f596eb/resourcegroups/EdgeSitesRG/providers/Microsoft.Edge/Sites/BellvueSite"), + // Type: to.Ptr("string"), + // Properties: &armsitemanager.SiteProperties{ + // DisplayName: to.Ptr("string"), + // Description: to.Ptr("string"), + // AddressResourceID: to.Ptr("/subscriptions/11111111-2222-3333-4444-55555555/resourceGroups/us-site-rg/providers/Microsoft.EdgeOrder/addresses/12343213"), + // ProvisioningState: to.Ptr(armsitemanager.ResourceProvisioningStateSucceeded), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/sitesbysubscription_client.go b/sdk/resourcemanager/sitemanager/armsitemanager/sitesbysubscription_client.go new file mode 100644 index 000000000000..47677c70b4c6 --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/sitesbysubscription_client.go @@ -0,0 +1,345 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armsitemanager + +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" +) + +// SitesBySubscriptionClient contains the methods for the SitesBySubscription group. +// Don't use this type directly, use NewSitesBySubscriptionClient() instead. +type SitesBySubscriptionClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSitesBySubscriptionClient creates a new instance of SitesBySubscriptionClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewSitesBySubscriptionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SitesBySubscriptionClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SitesBySubscriptionClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a Site +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +// - siteName - Name of Site resource +// - resource - Resource create parameters. +// - options - SitesBySubscriptionClientBeginCreateOrUpdateOptions contains the optional parameters for the SitesBySubscriptionClient.BeginCreateOrUpdate +// method. +func (client *SitesBySubscriptionClient) BeginCreateOrUpdate(ctx context.Context, siteName string, resource Site, options *SitesBySubscriptionClientBeginCreateOrUpdateOptions) (*runtime.Poller[SitesBySubscriptionClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, siteName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SitesBySubscriptionClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SitesBySubscriptionClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a Site +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +func (client *SitesBySubscriptionClient) createOrUpdate(ctx context.Context, siteName string, resource Site, options *SitesBySubscriptionClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "SitesBySubscriptionClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, siteName, resource, 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 +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *SitesBySubscriptionClient) createOrUpdateCreateRequest(ctx context.Context, siteName string, resource Site, _ *SitesBySubscriptionClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Edge/sites/{siteName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + 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", "2024-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// Delete - Delete a Site +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +// - siteName - Name of Site resource +// - options - SitesBySubscriptionClientDeleteOptions contains the optional parameters for the SitesBySubscriptionClient.Delete +// method. +func (client *SitesBySubscriptionClient) Delete(ctx context.Context, siteName string, options *SitesBySubscriptionClientDeleteOptions) (SitesBySubscriptionClientDeleteResponse, error) { + var err error + const operationName = "SitesBySubscriptionClient.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, siteName, options) + if err != nil { + return SitesBySubscriptionClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SitesBySubscriptionClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return SitesBySubscriptionClientDeleteResponse{}, err + } + return SitesBySubscriptionClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *SitesBySubscriptionClient) deleteCreateRequest(ctx context.Context, siteName string, _ *SitesBySubscriptionClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Edge/sites/{siteName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + 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", "2024-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a Site +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +// - siteName - Name of Site resource +// - options - SitesBySubscriptionClientGetOptions contains the optional parameters for the SitesBySubscriptionClient.Get method. +func (client *SitesBySubscriptionClient) Get(ctx context.Context, siteName string, options *SitesBySubscriptionClientGetOptions) (SitesBySubscriptionClientGetResponse, error) { + var err error + const operationName = "SitesBySubscriptionClient.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, siteName, options) + if err != nil { + return SitesBySubscriptionClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SitesBySubscriptionClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SitesBySubscriptionClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *SitesBySubscriptionClient) getCreateRequest(ctx context.Context, siteName string, _ *SitesBySubscriptionClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Edge/sites/{siteName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + 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", "2024-02-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 *SitesBySubscriptionClient) getHandleResponse(resp *http.Response) (SitesBySubscriptionClientGetResponse, error) { + result := SitesBySubscriptionClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Site); err != nil { + return SitesBySubscriptionClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List Site resources by subscription ID +// +// Generated from API version 2024-02-01-preview +// - options - SitesBySubscriptionClientListOptions contains the optional parameters for the SitesBySubscriptionClient.NewListPager +// method. +func (client *SitesBySubscriptionClient) NewListPager(options *SitesBySubscriptionClientListOptions) *runtime.Pager[SitesBySubscriptionClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[SitesBySubscriptionClientListResponse]{ + More: func(page SitesBySubscriptionClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SitesBySubscriptionClientListResponse) (SitesBySubscriptionClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SitesBySubscriptionClient.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, options) + }, nil) + if err != nil { + return SitesBySubscriptionClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *SitesBySubscriptionClient) listCreateRequest(ctx context.Context, _ *SitesBySubscriptionClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Edge/sites" + 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", "2024-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *SitesBySubscriptionClient) listHandleResponse(resp *http.Response) (SitesBySubscriptionClientListResponse, error) { + result := SitesBySubscriptionClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SiteListResult); err != nil { + return SitesBySubscriptionClientListResponse{}, err + } + return result, nil +} + +// Update - Update a Site +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +// - siteName - Name of Site resource +// - properties - The resource properties to be updated. +// - options - SitesBySubscriptionClientUpdateOptions contains the optional parameters for the SitesBySubscriptionClient.Update +// method. +func (client *SitesBySubscriptionClient) Update(ctx context.Context, siteName string, properties SiteUpdate, options *SitesBySubscriptionClientUpdateOptions) (SitesBySubscriptionClientUpdateResponse, error) { + var err error + const operationName = "SitesBySubscriptionClient.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, siteName, properties, options) + if err != nil { + return SitesBySubscriptionClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SitesBySubscriptionClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SitesBySubscriptionClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *SitesBySubscriptionClient) updateCreateRequest(ctx context.Context, siteName string, properties SiteUpdate, _ *SitesBySubscriptionClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Edge/sites/{siteName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + 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", "2024-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *SitesBySubscriptionClient) updateHandleResponse(resp *http.Response) (SitesBySubscriptionClientUpdateResponse, error) { + result := SitesBySubscriptionClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Site); err != nil { + return SitesBySubscriptionClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/sitesbysubscription_client_example_test.go b/sdk/resourcemanager/sitemanager/armsitemanager/sitesbysubscription_client_example_test.go new file mode 100644 index 000000000000..735649fd32e7 --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/sitesbysubscription_client_example_test.go @@ -0,0 +1,188 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armsitemanager_test + +import ( + "context" + "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/sitemanager/armsitemanager" + "log" +) + +// Generated from example definition: 2024-02-01-preview/SitesBySubscription_CreateOrUpdate.json +func ExampleSitesBySubscriptionClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsitemanager.NewClientFactory("0154f7fe-df09-4981-bf82-7ad5c1f596eb", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSitesBySubscriptionClient().BeginCreateOrUpdate(ctx, "string", armsitemanager.Site{ + Properties: &armsitemanager.SiteProperties{ + Description: to.Ptr("string"), + AddressResourceID: to.Ptr("/subscriptions/680d0dad-59aa-4464-3df3-b34b2b42738c/resourceGroups/us-site-rg/providers/Microsoft.EdgeOrder/addresses/12343213"), + DisplayName: to.Ptr("string"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %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 = armsitemanager.SitesBySubscriptionClientCreateOrUpdateResponse{ + // Site: &armsitemanager.Site{ + // Type: to.Ptr("string"), + // ID: to.Ptr("/subscriptions/0154f7fe-df09-4981-bf82-7ad5c1f596eb/resourcegroups/EdgeSitesRG/providers/Microsoft.Edge/Sites/BellvueSite"), + // Properties: &armsitemanager.SiteProperties{ + // Description: to.Ptr("string"), + // AddressResourceID: to.Ptr("/subscriptions/680d0dad-59aa-4464-3df3-b34b2b42738c/resourceGroups/us-site-rg/providers/Microsoft.EdgeOrder/addresses/12343213"), + // DisplayName: to.Ptr("string"), + // ProvisioningState: to.Ptr(armsitemanager.ResourceProvisioningStateSucceeded), + // }, + // }, + // } +} + +// Generated from example definition: 2024-02-01-preview/SitesBySubscription_Delete.json +func ExampleSitesBySubscriptionClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsitemanager.NewClientFactory("0154f7fe-df09-4981-bf82-7ad5c1f596eb", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSitesBySubscriptionClient().Delete(ctx, "string", 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 = armsitemanager.SitesBySubscriptionClientDeleteResponse{ + // } +} + +// Generated from example definition: 2024-02-01-preview/SitesBySubscription_Get.json +func ExampleSitesBySubscriptionClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsitemanager.NewClientFactory("0154f7fe-df09-4981-bf82-7ad5c1f596eb", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSitesBySubscriptionClient().Get(ctx, "string", 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 = armsitemanager.SitesBySubscriptionClientGetResponse{ + // Site: &armsitemanager.Site{ + // Type: to.Ptr("string"), + // ID: to.Ptr("/subscriptions/0154f7fe-df09-4981-bf82-7ad5c1f596eb/resourcegroups/EdgeSitesRG/providers/Microsoft.Edge/Sites/BellvueSite"), + // Properties: &armsitemanager.SiteProperties{ + // Description: to.Ptr("string"), + // AddressResourceID: to.Ptr("/subscriptions/0154f7fe-df09-4981-bf82-7ad5c1f596eb/resourceGroups/us-site-rg/providers/Microsoft.EdgeOrder/addresses/12343213"), + // DisplayName: to.Ptr("string"), + // ProvisioningState: to.Ptr(armsitemanager.ResourceProvisioningStateSucceeded), + // }, + // }, + // } +} + +// Generated from example definition: 2024-02-01-preview/SitesBySubscription_List.json +func ExampleSitesBySubscriptionClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsitemanager.NewClientFactory("0154f7fe-df09-4981-bf82-7ad5c1f596eb", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewSitesBySubscriptionClient().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 = armsitemanager.SitesBySubscriptionClientListResponse{ + // SiteListResult: armsitemanager.SiteListResult{ + // Value: []*armsitemanager.Site{ + // { + // Type: to.Ptr("string"), + // ID: to.Ptr("/subscriptions/0154f7fe-df09-4981-bf82-7ad5c1f596eb/resourcegroups/EdgeSitesRG/providers/Microsoft.Edge/Sites/BellvueSite"), + // Properties: &armsitemanager.SiteProperties{ + // Description: to.Ptr("string"), + // AddressResourceID: to.Ptr("/subscriptions/0154f7fe-df09-4981-bf82-7ad5c1f596eb/resourceGroups/us-site-rg/providers/Microsoft.EdgeOrder/addresses/12343213"), + // DisplayName: to.Ptr("string"), + // ProvisioningState: to.Ptr(armsitemanager.ResourceProvisioningStateSucceeded), + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2024-02-01-preview/SitesBySubscription_Update.json +func ExampleSitesBySubscriptionClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsitemanager.NewClientFactory("0154f7fe-df09-4981-bf82-7ad5c1f596eb", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSitesBySubscriptionClient().Update(ctx, "string", armsitemanager.SiteUpdate{ + Properties: &armsitemanager.SiteUpdateProperties{ + Description: to.Ptr("string"), + AddressResourceID: to.Ptr("/subscriptions/0154f7fe-df09-4981-bf82-7ad5c1f596eb/resourceGroups/us-site-rg/providers/Microsoft.EdgeOrder/addresses/12343213"), + DisplayName: to.Ptr("string"), + }, + }, 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 = armsitemanager.SitesBySubscriptionClientUpdateResponse{ + // Site: &armsitemanager.Site{ + // Type: to.Ptr("string"), + // ID: to.Ptr("/subscriptions/0154f7fe-df09-4981-bf82-7ad5c1f596eb/resourcegroups/EdgeSitesRG/providers/Microsoft.Edge/Sites/BellvueSite"), + // Properties: &armsitemanager.SiteProperties{ + // Description: to.Ptr("string"), + // AddressResourceID: to.Ptr("/subscriptions/0154f7fe-df09-4981-bf82-7ad5c1f596eb/resourceGroups/us-site-rg/providers/Microsoft.EdgeOrder/addresses/12343213"), + // DisplayName: to.Ptr("string"), + // ProvisioningState: to.Ptr(armsitemanager.ResourceProvisioningStateSucceeded), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/time_rfc3339.go b/sdk/resourcemanager/sitemanager/armsitemanager/time_rfc3339.go new file mode 100644 index 000000000000..9bb638248dd2 --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/time_rfc3339.go @@ -0,0 +1,109 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armsitemanager + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) + +const ( + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` +) + +type dateTimeRFC3339 time.Time + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + return err +} + +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + +func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { + return nil + } + var aux dateTimeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/tsp-location.yaml b/sdk/resourcemanager/sitemanager/armsitemanager/tsp-location.yaml new file mode 100644 index 000000000000..b0cd26457bbb --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/edge/Microsoft.Edge.Sites.Management +commit: df55cd8178ddd870dbd0c3b1e25c80e3ff48826c +repo: Azure/azure-rest-api-specs +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/standbypool/armstandbypool/CHANGELOG.md b/sdk/resourcemanager/standbypool/armstandbypool/CHANGELOG.md index 715d2f53ffc1..48288efe9354 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/CHANGELOG.md +++ b/sdk/resourcemanager/standbypool/armstandbypool/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 1.0.1 (2024-11-19) +### Other Changes + + ## 1.0.0 (2024-09-26) ### Breaking Changes diff --git a/sdk/resourcemanager/standbypool/armstandbypool/constants.go b/sdk/resourcemanager/standbypool/armstandbypool/constants.go index 2eec7cc967ca..4a86ff6f7c41 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/constants.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/constants.go @@ -6,7 +6,7 @@ package armstandbypool const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/standbypool/armstandbypool" - moduleVersion = "v1.0.0" + moduleVersion = "v1.0.1" ) // ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/standbypool/armstandbypool/fake/internal.go b/sdk/resourcemanager/standbypool/armstandbypool/fake/internal.go index 56a8f624f5f3..7425b6a669e2 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/fake/internal.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/fake/internal.go @@ -10,6 +10,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } diff --git a/sdk/resourcemanager/standbypool/armstandbypool/fake/operations_server.go b/sdk/resourcemanager/standbypool/armstandbypool/fake/operations_server.go index 9a882bb6131f..afbf35a47ebf 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/fake/operations_server.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/fake/operations_server.go @@ -51,17 +51,36 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error } func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -90,3 +109,9 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/standbypool/armstandbypool/fake/standbycontainergrouppoolruntimeviews_server.go b/sdk/resourcemanager/standbypool/armstandbypool/fake/standbycontainergrouppoolruntimeviews_server.go index 70e38faf4686..4fde08fc0a5a 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/fake/standbycontainergrouppoolruntimeviews_server.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/fake/standbycontainergrouppoolruntimeviews_server.go @@ -58,19 +58,38 @@ func (s *StandbyContainerGroupPoolRuntimeViewsServerTransport) Do(req *http.Requ } func (s *StandbyContainerGroupPoolRuntimeViewsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "StandbyContainerGroupPoolRuntimeViewsClient.Get": - resp, err = s.dispatchGet(req) - case "StandbyContainerGroupPoolRuntimeViewsClient.NewListByStandbyPoolPager": - resp, err = s.dispatchNewListByStandbyPoolPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if standbyContainerGroupPoolRuntimeViewsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = standbyContainerGroupPoolRuntimeViewsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "StandbyContainerGroupPoolRuntimeViewsClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "StandbyContainerGroupPoolRuntimeViewsClient.NewListByStandbyPoolPager": + res.resp, res.err = s.dispatchNewListByStandbyPoolPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *StandbyContainerGroupPoolRuntimeViewsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -150,3 +169,9 @@ func (s *StandbyContainerGroupPoolRuntimeViewsServerTransport) dispatchNewListBy } return resp, nil } + +// set this to conditionally intercept incoming requests to StandbyContainerGroupPoolRuntimeViewsServerTransport +var standbyContainerGroupPoolRuntimeViewsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/standbypool/armstandbypool/fake/standbycontainergrouppools_server.go b/sdk/resourcemanager/standbypool/armstandbypool/fake/standbycontainergrouppools_server.go index 792826dc3f33..757d6865bc58 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/fake/standbycontainergrouppools_server.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/fake/standbycontainergrouppools_server.go @@ -25,7 +25,7 @@ type StandbyContainerGroupPoolsServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, standbyContainerGroupPoolName string, resource armstandbypool.StandbyContainerGroupPoolResource, options *armstandbypool.StandbyContainerGroupPoolsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armstandbypool.StandbyContainerGroupPoolsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method StandbyContainerGroupPoolsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, standbyContainerGroupPoolName string, options *armstandbypool.StandbyContainerGroupPoolsClientBeginDeleteOptions) (resp azfake.PollerResponder[armstandbypool.StandbyContainerGroupPoolsClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method StandbyContainerGroupPoolsClient.Get @@ -80,27 +80,46 @@ func (s *StandbyContainerGroupPoolsServerTransport) Do(req *http.Request) (*http } func (s *StandbyContainerGroupPoolsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "StandbyContainerGroupPoolsClient.BeginCreateOrUpdate": - resp, err = s.dispatchBeginCreateOrUpdate(req) - case "StandbyContainerGroupPoolsClient.BeginDelete": - resp, err = s.dispatchBeginDelete(req) - case "StandbyContainerGroupPoolsClient.Get": - resp, err = s.dispatchGet(req) - case "StandbyContainerGroupPoolsClient.NewListByResourceGroupPager": - resp, err = s.dispatchNewListByResourceGroupPager(req) - case "StandbyContainerGroupPoolsClient.NewListBySubscriptionPager": - resp, err = s.dispatchNewListBySubscriptionPager(req) - case "StandbyContainerGroupPoolsClient.Update": - resp, err = s.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if standbyContainerGroupPoolsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = standbyContainerGroupPoolsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "StandbyContainerGroupPoolsClient.BeginCreateOrUpdate": + res.resp, res.err = s.dispatchBeginCreateOrUpdate(req) + case "StandbyContainerGroupPoolsClient.BeginDelete": + res.resp, res.err = s.dispatchBeginDelete(req) + case "StandbyContainerGroupPoolsClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "StandbyContainerGroupPoolsClient.NewListByResourceGroupPager": + res.resp, res.err = s.dispatchNewListByResourceGroupPager(req) + case "StandbyContainerGroupPoolsClient.NewListBySubscriptionPager": + res.resp, res.err = s.dispatchNewListBySubscriptionPager(req) + case "StandbyContainerGroupPoolsClient.Update": + res.resp, res.err = s.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *StandbyContainerGroupPoolsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -184,9 +203,9 @@ func (s *StandbyContainerGroupPoolsServerTransport) dispatchBeginDelete(req *htt return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { s.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { s.beginDelete.remove(req) @@ -334,3 +353,9 @@ func (s *StandbyContainerGroupPoolsServerTransport) dispatchUpdate(req *http.Req } return resp, nil } + +// set this to conditionally intercept incoming requests to StandbyContainerGroupPoolsServerTransport +var standbyContainerGroupPoolsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachinepoolruntimeviews_server.go b/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachinepoolruntimeviews_server.go index 835b9bade3b5..a7bdb2f0521e 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachinepoolruntimeviews_server.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachinepoolruntimeviews_server.go @@ -58,19 +58,38 @@ func (s *StandbyVirtualMachinePoolRuntimeViewsServerTransport) Do(req *http.Requ } func (s *StandbyVirtualMachinePoolRuntimeViewsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "StandbyVirtualMachinePoolRuntimeViewsClient.Get": - resp, err = s.dispatchGet(req) - case "StandbyVirtualMachinePoolRuntimeViewsClient.NewListByStandbyPoolPager": - resp, err = s.dispatchNewListByStandbyPoolPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if standbyVirtualMachinePoolRuntimeViewsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = standbyVirtualMachinePoolRuntimeViewsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "StandbyVirtualMachinePoolRuntimeViewsClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "StandbyVirtualMachinePoolRuntimeViewsClient.NewListByStandbyPoolPager": + res.resp, res.err = s.dispatchNewListByStandbyPoolPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *StandbyVirtualMachinePoolRuntimeViewsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -150,3 +169,9 @@ func (s *StandbyVirtualMachinePoolRuntimeViewsServerTransport) dispatchNewListBy } return resp, nil } + +// set this to conditionally intercept incoming requests to StandbyVirtualMachinePoolRuntimeViewsServerTransport +var standbyVirtualMachinePoolRuntimeViewsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachinepools_server.go b/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachinepools_server.go index 49b3ac00dcf8..3f7a6bed5468 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachinepools_server.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachinepools_server.go @@ -25,7 +25,7 @@ type StandbyVirtualMachinePoolsServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, standbyVirtualMachinePoolName string, resource armstandbypool.StandbyVirtualMachinePoolResource, options *armstandbypool.StandbyVirtualMachinePoolsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armstandbypool.StandbyVirtualMachinePoolsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method StandbyVirtualMachinePoolsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, standbyVirtualMachinePoolName string, options *armstandbypool.StandbyVirtualMachinePoolsClientBeginDeleteOptions) (resp azfake.PollerResponder[armstandbypool.StandbyVirtualMachinePoolsClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method StandbyVirtualMachinePoolsClient.Get @@ -80,27 +80,46 @@ func (s *StandbyVirtualMachinePoolsServerTransport) Do(req *http.Request) (*http } func (s *StandbyVirtualMachinePoolsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "StandbyVirtualMachinePoolsClient.BeginCreateOrUpdate": - resp, err = s.dispatchBeginCreateOrUpdate(req) - case "StandbyVirtualMachinePoolsClient.BeginDelete": - resp, err = s.dispatchBeginDelete(req) - case "StandbyVirtualMachinePoolsClient.Get": - resp, err = s.dispatchGet(req) - case "StandbyVirtualMachinePoolsClient.NewListByResourceGroupPager": - resp, err = s.dispatchNewListByResourceGroupPager(req) - case "StandbyVirtualMachinePoolsClient.NewListBySubscriptionPager": - resp, err = s.dispatchNewListBySubscriptionPager(req) - case "StandbyVirtualMachinePoolsClient.Update": - resp, err = s.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if standbyVirtualMachinePoolsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = standbyVirtualMachinePoolsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "StandbyVirtualMachinePoolsClient.BeginCreateOrUpdate": + res.resp, res.err = s.dispatchBeginCreateOrUpdate(req) + case "StandbyVirtualMachinePoolsClient.BeginDelete": + res.resp, res.err = s.dispatchBeginDelete(req) + case "StandbyVirtualMachinePoolsClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "StandbyVirtualMachinePoolsClient.NewListByResourceGroupPager": + res.resp, res.err = s.dispatchNewListByResourceGroupPager(req) + case "StandbyVirtualMachinePoolsClient.NewListBySubscriptionPager": + res.resp, res.err = s.dispatchNewListBySubscriptionPager(req) + case "StandbyVirtualMachinePoolsClient.Update": + res.resp, res.err = s.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *StandbyVirtualMachinePoolsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -184,9 +203,9 @@ func (s *StandbyVirtualMachinePoolsServerTransport) dispatchBeginDelete(req *htt return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { s.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { s.beginDelete.remove(req) @@ -334,3 +353,9 @@ func (s *StandbyVirtualMachinePoolsServerTransport) dispatchUpdate(req *http.Req } return resp, nil } + +// set this to conditionally intercept incoming requests to StandbyVirtualMachinePoolsServerTransport +var standbyVirtualMachinePoolsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachines_server.go b/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachines_server.go index e6d922df6faa..27a23990a73c 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachines_server.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachines_server.go @@ -58,19 +58,38 @@ func (s *StandbyVirtualMachinesServerTransport) Do(req *http.Request) (*http.Res } func (s *StandbyVirtualMachinesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "StandbyVirtualMachinesClient.Get": - resp, err = s.dispatchGet(req) - case "StandbyVirtualMachinesClient.NewListByStandbyVirtualMachinePoolResourcePager": - resp, err = s.dispatchNewListByStandbyVirtualMachinePoolResourcePager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if standbyVirtualMachinesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = standbyVirtualMachinesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "StandbyVirtualMachinesClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "StandbyVirtualMachinesClient.NewListByStandbyVirtualMachinePoolResourcePager": + res.resp, res.err = s.dispatchNewListByStandbyVirtualMachinePoolResourcePager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *StandbyVirtualMachinesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -150,3 +169,9 @@ func (s *StandbyVirtualMachinesServerTransport) dispatchNewListByStandbyVirtualM } return resp, nil } + +// set this to conditionally intercept incoming requests to StandbyVirtualMachinesServerTransport +var standbyVirtualMachinesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/standbypool/armstandbypool/go.mod b/sdk/resourcemanager/standbypool/armstandbypool/go.mod index 240851bac176..2645c1ebcb84 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/go.mod +++ b/sdk/resourcemanager/standbypool/armstandbypool/go.mod @@ -3,7 +3,7 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/standbypool/armstan go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 ) @@ -14,8 +14,8 @@ require ( github.com/google/uuid v1.6.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.25.0 // indirect - golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect - golang.org/x/text v0.16.0 // indirect + golang.org/x/crypto v0.27.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/text v0.18.0 // indirect ) diff --git a/sdk/resourcemanager/standbypool/armstandbypool/go.sum b/sdk/resourcemanager/standbypool/armstandbypool/go.sum index 09d275cb9a37..cbddbbd9ecec 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/go.sum +++ b/sdk/resourcemanager/standbypool/armstandbypool/go.sum @@ -1,5 +1,5 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 h1:JZg6HRh6W6U4OLl6lk7BZ7BLisIzM9dG1R50zUk9C/M= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0/go.mod h1:YL1xnZ6QejvQHWJrX/AvhFl4WW4rqHVoKspWNVwFk0M= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= @@ -17,13 +17,13 @@ github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmd github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= -golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= -golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/standbypool/armstandbypool/tsp-location.yaml b/sdk/resourcemanager/standbypool/armstandbypool/tsp-location.yaml index 10840906cfb3..c5ba7adab431 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/tsp-location.yaml +++ b/sdk/resourcemanager/standbypool/armstandbypool/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/standbypool/StandbyPool.Management -commit: 3ca7edabc2edf1117b7d912ba34f2694721e3ff3 +commit: df55cd8178ddd870dbd0c3b1e25c80e3ff48826c repo: Azure/azure-rest-api-specs -additionalDirectories: +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/terraform/armterraform/CHANGELOG.md b/sdk/resourcemanager/terraform/armterraform/CHANGELOG.md new file mode 100644 index 000000000000..320bd2d8ef01 --- /dev/null +++ b/sdk/resourcemanager/terraform/armterraform/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 0.1.0 (2024-11-19) +### Other Changes + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/terraform/armterraform` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt). \ No newline at end of file diff --git a/sdk/resourcemanager/terraform/armterraform/LICENSE.txt b/sdk/resourcemanager/terraform/armterraform/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/terraform/armterraform/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/resourcemanager/terraform/armterraform/README.md b/sdk/resourcemanager/terraform/armterraform/README.md new file mode 100644 index 000000000000..9a59acbf0311 --- /dev/null +++ b/sdk/resourcemanager/terraform/armterraform/README.md @@ -0,0 +1,92 @@ +# Azure Terraform Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/terraform/armterraform)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/terraform/armterraform) + +The `armterraform` module provides operations for working with Azure Terraform. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/terraform/armterraform) + +# Getting started + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.18 or above (You could download and install the latest version of Go from [here](https://go.dev/doc/install). It will replace the existing Go on your machine. If you want to install multiple Go versions on the same machine, you could refer this [doc](https://go.dev/doc/manage-install).) + +## Install the package + +This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management. + +Install the Azure Terraform module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/terraform/armterraform +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Terraform. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more. + +```go +cred, err := azidentity.NewDefaultAzureCredential(nil) +``` + +For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). + +## Client Factory + +Azure Terraform module consists of one or more clients. We provide a client factory which could be used to create any client in this module. + +```go +clientFactory, err := armterraform.NewClientFactory(, cred, nil) +``` + +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). + +```go +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, +} +clientFactory, err := armterraform.NewClientFactory(, cred, &options) +``` + +## Clients + +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.NewTerraformClient() +``` + +## Fakes + +The fake package contains types used for constructing in-memory fake servers used in unit tests. +This allows writing tests to cover various success/error conditions without the need for connecting to a live service. + +Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes. + +## Provide Feedback + +If you encounter bugs or have suggestions, please +[open an issue](https://github.com/Azure/azure-sdk-for-go/issues) and assign the `Terraform` label. + +# Contributing + +This project welcomes contributions and suggestions. Most contributions require +you to agree to a Contributor License Agreement (CLA) declaring that you have +the right to, and actually do, grant us the rights to use your contribution. +For details, visit [https://cla.microsoft.com](https://cla.microsoft.com). + +When you submit a pull request, a CLA-bot will automatically determine whether +you need to provide a CLA and decorate the PR appropriately (e.g., label, +comment). Simply follow the instructions provided by the bot. You will only +need to do this once across all repos using our CLA. + +This project has adopted the +[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information, see the +[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any +additional questions or comments. \ No newline at end of file diff --git a/sdk/resourcemanager/terraform/armterraform/ci.yml b/sdk/resourcemanager/terraform/armterraform/ci.yml new file mode 100644 index 000000000000..1314869f6702 --- /dev/null +++ b/sdk/resourcemanager/terraform/armterraform/ci.yml @@ -0,0 +1,28 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/terraform/armterraform/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/terraform/armterraform/ + +extends: + template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/terraform/armterraform' diff --git a/sdk/resourcemanager/terraform/armterraform/client_factory.go b/sdk/resourcemanager/terraform/armterraform/client_factory.go new file mode 100644 index 000000000000..651f7e38a8cf --- /dev/null +++ b/sdk/resourcemanager/terraform/armterraform/client_factory.go @@ -0,0 +1,48 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armterraform + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" +) + +// ClientFactory is a client factory used to create any client in this module. +// Don't use this type directly, use NewClientFactory instead. +type ClientFactory struct { + subscriptionID string + internal *arm.Client +} + +// 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 - The ID of the target subscription. The value must be an UUID. +// - 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) { + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, + internal: internal, + }, nil +} + +// NewOperationsClient creates a new instance of OperationsClient. +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + return &OperationsClient{ + internal: c.internal, + } +} + +// NewTerraformClient creates a new instance of TerraformClient. +func (c *ClientFactory) NewTerraformClient() *TerraformClient { + return &TerraformClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} diff --git a/sdk/resourcemanager/terraform/armterraform/constants.go b/sdk/resourcemanager/terraform/armterraform/constants.go new file mode 100644 index 000000000000..d0c99ec10c13 --- /dev/null +++ b/sdk/resourcemanager/terraform/armterraform/constants.go @@ -0,0 +1,104 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armterraform + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/terraform/armterraform" + moduleVersion = "v0.1.0" +) + +// ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +type ActionType string + +const ( + // ActionTypeInternal - Actions are for internal-only APIs. + ActionTypeInternal ActionType = "Internal" +) + +// PossibleActionTypeValues returns the possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ + ActionTypeInternal, + } +} + +// 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 ( + // OriginSystem - Indicates the operation is initiated by a system. + OriginSystem Origin = "system" + // OriginUser - Indicates the operation is initiated by a user. + OriginUser Origin = "user" + // OriginUserSystem - Indicates the operation is initiated by a user or system. + OriginUserSystem Origin = "user,system" +) + +// PossibleOriginValues returns the possible values for the Origin const type. +func PossibleOriginValues() []Origin { + return []Origin{ + OriginSystem, + OriginUser, + OriginUserSystem, + } +} + +// ResourceProvisioningState - The provisioning state of a resource type. +type ResourceProvisioningState string + +const ( + // ResourceProvisioningStateCanceled - Resource creation was canceled. + ResourceProvisioningStateCanceled ResourceProvisioningState = "Canceled" + // ResourceProvisioningStateFailed - Resource creation failed. + ResourceProvisioningStateFailed ResourceProvisioningState = "Failed" + // ResourceProvisioningStateSucceeded - Resource has been created. + ResourceProvisioningStateSucceeded ResourceProvisioningState = "Succeeded" +) + +// PossibleResourceProvisioningStateValues returns the possible values for the ResourceProvisioningState const type. +func PossibleResourceProvisioningStateValues() []ResourceProvisioningState { + return []ResourceProvisioningState{ + ResourceProvisioningStateCanceled, + ResourceProvisioningStateFailed, + ResourceProvisioningStateSucceeded, + } +} + +// TargetProvider - The target Azure Terraform Provider +type TargetProvider string + +const ( + // TargetProviderAzapi - https://registry.terraform.io/providers/Azure/azapi/latest + TargetProviderAzapi TargetProvider = "azapi" + // TargetProviderAzurerm - https://registry.terraform.io/providers/hashicorp/azurerm/latest + TargetProviderAzurerm TargetProvider = "azurerm" +) + +// PossibleTargetProviderValues returns the possible values for the TargetProvider const type. +func PossibleTargetProviderValues() []TargetProvider { + return []TargetProvider{ + TargetProviderAzapi, + TargetProviderAzurerm, + } +} + +// Type - The parameter type +type Type string + +const ( + TypeExportQuery Type = "ExportQuery" + TypeExportResource Type = "ExportResource" + TypeExportResourceGroup Type = "ExportResourceGroup" +) + +// PossibleTypeValues returns the possible values for the Type const type. +func PossibleTypeValues() []Type { + return []Type{ + TypeExportQuery, + TypeExportResource, + TypeExportResourceGroup, + } +} diff --git a/sdk/resourcemanager/terraform/armterraform/fake/internal.go b/sdk/resourcemanager/terraform/armterraform/fake/internal.go new file mode 100644 index 000000000000..1ffebab5709c --- /dev/null +++ b/sdk/resourcemanager/terraform/armterraform/fake/internal.go @@ -0,0 +1,78 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "io" + "net/http" + "sync" +) + +type result struct { + resp *http.Response + err error +} + +type nonRetriableError struct { + error +} + +func (nonRetriableError) NonRetriable() { + // marker method +} + +func contains[T comparable](s []T, v T) bool { + for _, vv := range s { + if vv == v { + return true + } + } + return false +} + +func readRequestBody(req *http.Request) ([]byte, error) { + if req.Body == nil { + return nil, nil + } + body, err := io.ReadAll(req.Body) + if err != nil { + return nil, err + } + req.Body.Close() + return body, nil +} + +func newTracker[T any]() *tracker[T] { + return &tracker[T]{ + items: map[string]*T{}, + } +} + +type tracker[T any] struct { + items map[string]*T + mu sync.Mutex +} + +func (p *tracker[T]) get(req *http.Request) *T { + p.mu.Lock() + defer p.mu.Unlock() + if item, ok := p.items[server.SanitizePagerPollerPath(req.URL.Path)]; ok { + return item + } + return nil +} + +func (p *tracker[T]) add(req *http.Request, item *T) { + p.mu.Lock() + defer p.mu.Unlock() + p.items[server.SanitizePagerPollerPath(req.URL.Path)] = item +} + +func (p *tracker[T]) remove(req *http.Request) { + p.mu.Lock() + defer p.mu.Unlock() + delete(p.items, server.SanitizePagerPollerPath(req.URL.Path)) +} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/operations_server.go b/sdk/resourcemanager/terraform/armterraform/fake/operations_server.go similarity index 56% rename from sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/operations_server.go rename to sdk/resourcemanager/terraform/armterraform/fake/operations_server.go index 15823a3f8cc4..d04a92198df0 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/operations_server.go +++ b/sdk/resourcemanager/terraform/armterraform/fake/operations_server.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -15,32 +11,32 @@ import ( "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/devopsinfrastructure/armdevopsinfrastructure" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/terraform/armterraform" "net/http" ) -// OperationsServer is a fake server for instances of the armdevopsinfrastructure.OperationsClient type. +// OperationsServer is a fake server for instances of the armterraform.OperationsClient type. type OperationsServer struct { // NewListPager is the fake for method OperationsClient.NewListPager // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armdevopsinfrastructure.OperationsClientListOptions) (resp azfake.PagerResponder[armdevopsinfrastructure.OperationsClientListResponse]) + NewListPager func(options *armterraform.OperationsClientListOptions) (resp azfake.PagerResponder[armterraform.OperationsClientListResponse]) } // NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. -// The returned OperationsServerTransport instance is connected to an instance of armdevopsinfrastructure.OperationsClient via the +// The returned OperationsServerTransport instance is connected to an instance of armterraform.OperationsClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewOperationsServerTransport(srv *OperationsServer) *OperationsServerTransport { return &OperationsServerTransport{ srv: srv, - newListPager: newTracker[azfake.PagerResponder[armdevopsinfrastructure.OperationsClientListResponse]](), + newListPager: newTracker[azfake.PagerResponder[armterraform.OperationsClientListResponse]](), } } -// OperationsServerTransport connects instances of armdevopsinfrastructure.OperationsClient to instances of OperationsServer. +// OperationsServerTransport connects instances of armterraform.OperationsClient to instances of OperationsServer. // Don't use this type directly, use NewOperationsServerTransport instead. type OperationsServerTransport struct { srv *OperationsServer - newListPager *tracker[azfake.PagerResponder[armdevopsinfrastructure.OperationsClientListResponse]] + newListPager *tracker[azfake.PagerResponder[armterraform.OperationsClientListResponse]] } // Do implements the policy.Transporter interface for OperationsServerTransport. @@ -51,21 +47,40 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return o.dispatchToMethodFake(req, method) +} - switch method { - case "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -77,7 +92,7 @@ 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 *armdevopsinfrastructure.OperationsClientListResponse, createLink func() string) { + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armterraform.OperationsClientListResponse, createLink func() string) { page.NextLink = to.Ptr(createLink()) }) } @@ -94,3 +109,9 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/terraform/armterraform/fake/polymorphic_helpers.go b/sdk/resourcemanager/terraform/armterraform/fake/polymorphic_helpers.go new file mode 100644 index 000000000000..dff235021ac1 --- /dev/null +++ b/sdk/resourcemanager/terraform/armterraform/fake/polymorphic_helpers.go @@ -0,0 +1,35 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/terraform/armterraform" +) + +func unmarshalBaseExportModelClassification(rawMsg json.RawMessage) (armterraform.BaseExportModelClassification, error) { + if rawMsg == nil || string(rawMsg) == "null" { + return nil, nil + } + var m map[string]any + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b armterraform.BaseExportModelClassification + switch m["type"] { + case string(armterraform.TypeExportQuery): + b = &armterraform.ExportQuery{} + case string(armterraform.TypeExportResource): + b = &armterraform.ExportResource{} + case string(armterraform.TypeExportResourceGroup): + b = &armterraform.ExportResourceGroup{} + default: + b = &armterraform.BaseExportModel{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} diff --git a/sdk/resourcemanager/terraform/armterraform/fake/server_factory.go b/sdk/resourcemanager/terraform/armterraform/fake/server_factory.go new file mode 100644 index 000000000000..73b68792b62b --- /dev/null +++ b/sdk/resourcemanager/terraform/armterraform/fake/server_factory.go @@ -0,0 +1,79 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" + "sync" +) + +// ServerFactory is a fake server for instances of the armterraform.ClientFactory type. +type ServerFactory struct { + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer + + // TerraformServer contains the fakes for client TerraformClient + TerraformServer TerraformServer +} + +// NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. +// The returned ServerFactoryTransport instance is connected to an instance of armterraform.ClientFactory via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { + return &ServerFactoryTransport{ + srv: srv, + } +} + +// ServerFactoryTransport connects instances of armterraform.ClientFactory to instances of ServerFactory. +// Don't use this type directly, use NewServerFactoryTransport instead. +type ServerFactoryTransport struct { + srv *ServerFactory + trMu sync.Mutex + trOperationsServer *OperationsServerTransport + trTerraformServer *TerraformServerTransport +} + +// Do implements the policy.Transporter interface for ServerFactoryTransport. +func (s *ServerFactoryTransport) 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")} + } + + client := method[:strings.Index(method, ".")] + var resp *http.Response + var err error + + switch client { + case "OperationsClient": + initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) + resp, err = s.trOperationsServer.Do(req) + case "TerraformClient": + initServer(s, &s.trTerraformServer, func() *TerraformServerTransport { return NewTerraformServerTransport(&s.srv.TerraformServer) }) + resp, err = s.trTerraformServer.Do(req) + default: + err = fmt.Errorf("unhandled client %s", client) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func initServer[T any](s *ServerFactoryTransport, dst **T, src func() *T) { + s.trMu.Lock() + if *dst == nil { + *dst = src() + } + s.trMu.Unlock() +} diff --git a/sdk/resourcemanager/terraform/armterraform/fake/terraform_server.go b/sdk/resourcemanager/terraform/armterraform/fake/terraform_server.go new file mode 100644 index 000000000000..ab052040f9cd --- /dev/null +++ b/sdk/resourcemanager/terraform/armterraform/fake/terraform_server.go @@ -0,0 +1,135 @@ +// 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) Go Code Generator. DO NOT EDIT. + +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/terraform/armterraform" + "net/http" + "regexp" +) + +// TerraformServer is a fake server for instances of the armterraform.TerraformClient type. +type TerraformServer struct { + // BeginExportTerraform is the fake for method TerraformClient.BeginExportTerraform + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginExportTerraform func(ctx context.Context, body armterraform.BaseExportModelClassification, options *armterraform.TerraformClientBeginExportTerraformOptions) (resp azfake.PollerResponder[armterraform.TerraformClientExportTerraformResponse], errResp azfake.ErrorResponder) +} + +// NewTerraformServerTransport creates a new instance of TerraformServerTransport with the provided implementation. +// The returned TerraformServerTransport instance is connected to an instance of armterraform.TerraformClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewTerraformServerTransport(srv *TerraformServer) *TerraformServerTransport { + return &TerraformServerTransport{ + srv: srv, + beginExportTerraform: newTracker[azfake.PollerResponder[armterraform.TerraformClientExportTerraformResponse]](), + } +} + +// TerraformServerTransport connects instances of armterraform.TerraformClient to instances of TerraformServer. +// Don't use this type directly, use NewTerraformServerTransport instead. +type TerraformServerTransport struct { + srv *TerraformServer + beginExportTerraform *tracker[azfake.PollerResponder[armterraform.TerraformClientExportTerraformResponse]] +} + +// Do implements the policy.Transporter interface for TerraformServerTransport. +func (t *TerraformServerTransport) 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")} + } + + return t.dispatchToMethodFake(req, method) +} + +func (t *TerraformServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if terraformServerTransportInterceptor != nil { + res.resp, res.err, intercepted = terraformServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "TerraformClient.BeginExportTerraform": + res.resp, res.err = t.dispatchBeginExportTerraform(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (t *TerraformServerTransport) dispatchBeginExportTerraform(req *http.Request) (*http.Response, error) { + if t.srv.BeginExportTerraform == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginExportTerraform not implemented")} + } + beginExportTerraform := t.beginExportTerraform.get(req) + if beginExportTerraform == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureTerraform/exportTerraform` + 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) + } + raw, err := readRequestBody(req) + if err != nil { + return nil, err + } + body, err := unmarshalBaseExportModelClassification(raw) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.BeginExportTerraform(req.Context(), body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginExportTerraform = &respr + t.beginExportTerraform.add(req, beginExportTerraform) + } + + resp, err := server.PollerResponderNext(beginExportTerraform, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + t.beginExportTerraform.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginExportTerraform) { + t.beginExportTerraform.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to TerraformServerTransport +var terraformServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/terraform/armterraform/fake/time_rfc3339.go b/sdk/resourcemanager/terraform/armterraform/fake/time_rfc3339.go new file mode 100644 index 000000000000..87ee11e83b32 --- /dev/null +++ b/sdk/resourcemanager/terraform/armterraform/fake/time_rfc3339.go @@ -0,0 +1,109 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) + +const ( + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` +) + +type dateTimeRFC3339 time.Time + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + return err +} + +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + +func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { + return nil + } + var aux dateTimeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/terraform/armterraform/go.mod b/sdk/resourcemanager/terraform/armterraform/go.mod new file mode 100644 index 000000000000..1c893c50d6c4 --- /dev/null +++ b/sdk/resourcemanager/terraform/armterraform/go.mod @@ -0,0 +1,21 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/terraform/armterraform + +go 1.18 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 +) + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect + github.com/golang-jwt/jwt/v5 v5.2.1 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect + github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect + golang.org/x/crypto v0.27.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/text v0.18.0 // indirect +) diff --git a/sdk/resourcemanager/terraform/armterraform/go.sum b/sdk/resourcemanager/terraform/armterraform/go.sum new file mode 100644 index 000000000000..cbddbbd9ecec --- /dev/null +++ b/sdk/resourcemanager/terraform/armterraform/go.sum @@ -0,0 +1,29 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 h1:JZg6HRh6W6U4OLl6lk7BZ7BLisIzM9dG1R50zUk9C/M= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0/go.mod h1:YL1xnZ6QejvQHWJrX/AvhFl4WW4rqHVoKspWNVwFk0M= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= +github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/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-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/terraform/armterraform/interfaces.go b/sdk/resourcemanager/terraform/armterraform/interfaces.go new file mode 100644 index 000000000000..fbad2bda44b1 --- /dev/null +++ b/sdk/resourcemanager/terraform/armterraform/interfaces.go @@ -0,0 +1,14 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armterraform + +// BaseExportModelClassification provides polymorphic access to related types. +// Call the interface's GetBaseExportModel() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *BaseExportModel, *ExportQuery, *ExportResource, *ExportResourceGroup +type BaseExportModelClassification interface { + // GetBaseExportModel returns the BaseExportModel content of the underlying type. + GetBaseExportModel() *BaseExportModel +} diff --git a/sdk/resourcemanager/terraform/armterraform/models.go b/sdk/resourcemanager/terraform/armterraform/models.go new file mode 100644 index 000000000000..96e615ca4de8 --- /dev/null +++ b/sdk/resourcemanager/terraform/armterraform/models.go @@ -0,0 +1,253 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armterraform + +import "time" + +// BaseExportModel - The base export parameter +type BaseExportModel struct { + // REQUIRED; The parameter type + Type *Type + + // Whether to output all non-computed properties in the generated Terraform configuration? This probably needs manual modifications + // to make it valid + FullProperties *bool + + // Mask sensitive attributes in the Terraform configuration + MaskSensitive *bool + + // The target Azure Terraform Provider + TargetProvider *TargetProvider +} + +// GetBaseExportModel implements the BaseExportModelClassification interface for type BaseExportModel. +func (b *BaseExportModel) GetBaseExportModel() *BaseExportModel { return b } + +// ErrorAdditionalInfo - The resource management error additional info. +type ErrorAdditionalInfo struct { + // READ-ONLY; The additional info. + Info *ErrorAdditionalInfoInfo + + // READ-ONLY; The additional info type. + Type *string +} + +type ErrorAdditionalInfoInfo struct { +} + +// 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 +} + +// ExportQuery - Export parameter for resources queried by ARG (Azure Resource Graph) +type ExportQuery struct { + // REQUIRED; The ARG where predicate. Note that you can combine multiple conditions in one `where` predicate, e.g. `resourceGroup + // =~ "my-rg" and type =~ "microsoft.network/virtualnetworks"` + Query *string + + // CONSTANT; The parameter type + // Field has constant value TypeExportQuery, any specified value is ignored. + Type *Type + + // Whether to output all non-computed properties in the generated Terraform configuration? This probably needs manual modifications + // to make it valid + FullProperties *bool + + // Mask sensitive attributes in the Terraform configuration + MaskSensitive *bool + + // The name pattern of the Terraform resources + NamePattern *string + + // Whether to recursively list child resources of the query result + Recursive *bool + + // The target Azure Terraform Provider + TargetProvider *TargetProvider +} + +// GetBaseExportModel implements the BaseExportModelClassification interface for type ExportQuery. +func (e *ExportQuery) GetBaseExportModel() *BaseExportModel { + return &BaseExportModel{ + FullProperties: e.FullProperties, + MaskSensitive: e.MaskSensitive, + TargetProvider: e.TargetProvider, + Type: e.Type, + } +} + +// ExportResource - Export parameter for individual resources. +type ExportResource struct { + // REQUIRED; The id of the resource to be exported + ResourceIDs []*string + + // CONSTANT; The parameter type + // Field has constant value TypeExportResource, any specified value is ignored. + Type *Type + + // Whether to output all non-computed properties in the generated Terraform configuration? This probably needs manual modifications + // to make it valid + FullProperties *bool + + // Mask sensitive attributes in the Terraform configuration + MaskSensitive *bool + + // The name pattern of the Terraform resources + NamePattern *string + + // The Terraform resource name. Only works when `resourceIds` contains only one item. + ResourceName *string + + // The Terraform resource type. Only works when `resourceIds` contains only one item. + ResourceType *string + + // The target Azure Terraform Provider + TargetProvider *TargetProvider +} + +// GetBaseExportModel implements the BaseExportModelClassification interface for type ExportResource. +func (e *ExportResource) GetBaseExportModel() *BaseExportModel { + return &BaseExportModel{ + FullProperties: e.FullProperties, + MaskSensitive: e.MaskSensitive, + TargetProvider: e.TargetProvider, + Type: e.Type, + } +} + +// ExportResourceGroup - Export parameter for a resource group +type ExportResourceGroup struct { + // REQUIRED; The name of the resource group to be exported + ResourceGroupName *string + + // CONSTANT; The parameter type + // Field has constant value TypeExportResourceGroup, any specified value is ignored. + Type *Type + + // Whether to output all non-computed properties in the generated Terraform configuration? This probably needs manual modifications + // to make it valid + FullProperties *bool + + // Mask sensitive attributes in the Terraform configuration + MaskSensitive *bool + + // The name pattern of the Terraform resources + NamePattern *string + + // The target Azure Terraform Provider + TargetProvider *TargetProvider +} + +// GetBaseExportModel implements the BaseExportModelClassification interface for type ExportResourceGroup. +func (e *ExportResourceGroup) GetBaseExportModel() *BaseExportModel { + return &BaseExportModel{ + FullProperties: e.FullProperties, + MaskSensitive: e.MaskSensitive, + TargetProvider: e.TargetProvider, + Type: e.Type, + } +} + +// ExportResult - The Terraform export result +type ExportResult struct { + // The Terraform configuration content + Configuration *string + + // A list of errors derived during exporting each resource + Errors []*ErrorDetail + + // A list of Azure resources which are not exported to Terraform due to there is no corresponding resources in Terraform + SkippedResources []*string +} + +// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +type Operation struct { + // Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + ActionType *ActionType + + // READ-ONLY; Localized display information for this particular operation. + Display *OperationDisplay + + // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure + // Resource Manager/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 and 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 { + // REQUIRED; The Operation items on this page + Value []*Operation + + // The link to the next page of items + NextLink *string +} + +// OperationStatus - The status of the LRO operation. +type OperationStatus struct { + // REQUIRED; The operation status + Status *ResourceProvisioningState + + // READ-ONLY; The unique identifier for the operationStatus resource + ID *string + + // READ-ONLY; Operation complete time + EndTime *time.Time + + // READ-ONLY; Errors that occurred if the operation ended with Canceled or Failed status + Error *ErrorDetail + + // READ-ONLY; The name of the operationStatus resource + Name *string + + // READ-ONLY; The progress made toward completing the operation + PercentComplete *float64 + + // READ-ONLY; RP-specific properties for the operationStatus resource, only appears when operation ended with Succeeded status + Properties *ExportResult + + // READ-ONLY; Operation start time + StartTime *time.Time +} diff --git a/sdk/resourcemanager/terraform/armterraform/models_serde.go b/sdk/resourcemanager/terraform/armterraform/models_serde.go new file mode 100644 index 000000000000..4841989a5a45 --- /dev/null +++ b/sdk/resourcemanager/terraform/armterraform/models_serde.go @@ -0,0 +1,501 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armterraform + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type BaseExportModel. +func (b BaseExportModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "fullProperties", b.FullProperties) + populate(objectMap, "maskSensitive", b.MaskSensitive) + populate(objectMap, "targetProvider", b.TargetProvider) + populate(objectMap, "type", b.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BaseExportModel. +func (b *BaseExportModel) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "fullProperties": + err = unpopulate(val, "FullProperties", &b.FullProperties) + delete(rawMsg, key) + case "maskSensitive": + err = unpopulate(val, "MaskSensitive", &b.MaskSensitive) + delete(rawMsg, key) + case "targetProvider": + err = unpopulate(val, "TargetProvider", &b.TargetProvider) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &b.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "info", e.Info) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + 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", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + delete(rawMsg, key) + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExportQuery. +func (e ExportQuery) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "fullProperties", e.FullProperties) + populate(objectMap, "maskSensitive", e.MaskSensitive) + populate(objectMap, "namePattern", e.NamePattern) + populate(objectMap, "query", e.Query) + populate(objectMap, "recursive", e.Recursive) + populate(objectMap, "targetProvider", e.TargetProvider) + objectMap["type"] = TypeExportQuery + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExportQuery. +func (e *ExportQuery) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "fullProperties": + err = unpopulate(val, "FullProperties", &e.FullProperties) + delete(rawMsg, key) + case "maskSensitive": + err = unpopulate(val, "MaskSensitive", &e.MaskSensitive) + delete(rawMsg, key) + case "namePattern": + err = unpopulate(val, "NamePattern", &e.NamePattern) + delete(rawMsg, key) + case "query": + err = unpopulate(val, "Query", &e.Query) + delete(rawMsg, key) + case "recursive": + err = unpopulate(val, "Recursive", &e.Recursive) + delete(rawMsg, key) + case "targetProvider": + err = unpopulate(val, "TargetProvider", &e.TargetProvider) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExportResource. +func (e ExportResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "fullProperties", e.FullProperties) + populate(objectMap, "maskSensitive", e.MaskSensitive) + populate(objectMap, "namePattern", e.NamePattern) + populate(objectMap, "resourceIds", e.ResourceIDs) + populate(objectMap, "resourceName", e.ResourceName) + populate(objectMap, "resourceType", e.ResourceType) + populate(objectMap, "targetProvider", e.TargetProvider) + objectMap["type"] = TypeExportResource + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExportResource. +func (e *ExportResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "fullProperties": + err = unpopulate(val, "FullProperties", &e.FullProperties) + delete(rawMsg, key) + case "maskSensitive": + err = unpopulate(val, "MaskSensitive", &e.MaskSensitive) + delete(rawMsg, key) + case "namePattern": + err = unpopulate(val, "NamePattern", &e.NamePattern) + delete(rawMsg, key) + case "resourceIds": + err = unpopulate(val, "ResourceIDs", &e.ResourceIDs) + delete(rawMsg, key) + case "resourceName": + err = unpopulate(val, "ResourceName", &e.ResourceName) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &e.ResourceType) + delete(rawMsg, key) + case "targetProvider": + err = unpopulate(val, "TargetProvider", &e.TargetProvider) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExportResourceGroup. +func (e ExportResourceGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "fullProperties", e.FullProperties) + populate(objectMap, "maskSensitive", e.MaskSensitive) + populate(objectMap, "namePattern", e.NamePattern) + populate(objectMap, "resourceGroupName", e.ResourceGroupName) + populate(objectMap, "targetProvider", e.TargetProvider) + objectMap["type"] = TypeExportResourceGroup + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExportResourceGroup. +func (e *ExportResourceGroup) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "fullProperties": + err = unpopulate(val, "FullProperties", &e.FullProperties) + delete(rawMsg, key) + case "maskSensitive": + err = unpopulate(val, "MaskSensitive", &e.MaskSensitive) + delete(rawMsg, key) + case "namePattern": + err = unpopulate(val, "NamePattern", &e.NamePattern) + delete(rawMsg, key) + case "resourceGroupName": + err = unpopulate(val, "ResourceGroupName", &e.ResourceGroupName) + delete(rawMsg, key) + case "targetProvider": + err = unpopulate(val, "TargetProvider", &e.TargetProvider) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExportResult. +func (e ExportResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "configuration", e.Configuration) + populate(objectMap, "errors", e.Errors) + populate(objectMap, "skippedResources", e.SkippedResources) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExportResult. +func (e *ExportResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "configuration": + err = unpopulate(val, "Configuration", &e.Configuration) + delete(rawMsg, key) + case "errors": + err = unpopulate(val, "Errors", &e.Errors) + delete(rawMsg, key) + case "skippedResources": + err = unpopulate(val, "SkippedResources", &e.SkippedResources) + delete(rawMsg, key) + } + if err != nil { + 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) { + 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) + populateDateTimeRFC3339(objectMap, "endTime", o.EndTime) + populate(objectMap, "error", o.Error) + populate(objectMap, "id", o.ID) + populate(objectMap, "name", o.Name) + populate(objectMap, "percentComplete", o.PercentComplete) + populate(objectMap, "properties", o.Properties) + populateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(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 "percentComplete": + err = unpopulate(val, "PercentComplete", &o.PercentComplete) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + case "startTime": + err = unpopulateDateTimeRFC3339(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 +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v any) error { + if data == nil || string(data) == "null" { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/terraform/armterraform/operations_client.go b/sdk/resourcemanager/terraform/armterraform/operations_client.go new file mode 100644 index 000000000000..83af3e57206f --- /dev/null +++ b/sdk/resourcemanager/terraform/armterraform/operations_client.go @@ -0,0 +1,84 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armterraform + +import ( + "context" + "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" +) + +// OperationsClient contains the methods for the Operations group. +// Don't use this type directly, use NewOperationsClient() instead. +type OperationsClient struct { + internal *arm.Client +} + +// NewOperationsClient creates a new instance of OperationsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &OperationsClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - List the operations for the provider +// +// Generated from API version 2023-07-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 page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.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, options) + }, nil) + if err != nil { + return OperationsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.AzureTerraform/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-07-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { + result := OperationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { + return OperationsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/terraform/armterraform/operations_client_example_test.go b/sdk/resourcemanager/terraform/armterraform/operations_client_example_test.go new file mode 100644 index 000000000000..7828d87b1ccb --- /dev/null +++ b/sdk/resourcemanager/terraform/armterraform/operations_client_example_test.go @@ -0,0 +1,61 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armterraform_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/terraform/armterraform" + "log" +) + +// Generated from example definition: 2023-07-01-preview/ListOperations.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 := armterraform.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 = armterraform.OperationsClientListResponse{ + // OperationListResult: armterraform.OperationListResult{ + // Value: []*armterraform.Operation{ + // { + // Name: to.Ptr("Microsoft.AzureTerraform/operations/read"), + // Display: &armterraform.OperationDisplay{ + // Provider: to.Ptr("Microsoft AzureTerraform"), + // Resource: to.Ptr("Azure Terraform Resource Provider"), + // Operation: to.Ptr("ListOperations"), + // Description: to.Ptr("Lists all of the available RP operations."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.AzureTerraform/exportTerraform/action"), + // Display: &armterraform.OperationDisplay{ + // Provider: to.Ptr("Microsoft AzureTerraform"), + // Resource: to.Ptr("Azure Terraform Resource Provider"), + // Operation: to.Ptr("ExportTerraform"), + // Description: to.Ptr("Exports the Terraform configuration used for the specified scope."), + // }, + // }, + // }, + // }, + // } + } +} diff --git a/sdk/resourcemanager/terraform/armterraform/options.go b/sdk/resourcemanager/terraform/armterraform/options.go new file mode 100644 index 000000000000..0bf1f8242069 --- /dev/null +++ b/sdk/resourcemanager/terraform/armterraform/options.go @@ -0,0 +1,17 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armterraform + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// TerraformClientBeginExportTerraformOptions contains the optional parameters for the TerraformClient.BeginExportTerraform +// method. +type TerraformClientBeginExportTerraformOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} diff --git a/sdk/resourcemanager/terraform/armterraform/responses.go b/sdk/resourcemanager/terraform/armterraform/responses.go new file mode 100644 index 000000000000..0876321d993b --- /dev/null +++ b/sdk/resourcemanager/terraform/armterraform/responses.go @@ -0,0 +1,17 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armterraform + +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. +type OperationsClientListResponse struct { + // 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 +} + +// TerraformClientExportTerraformResponse contains the response from method TerraformClient.BeginExportTerraform. +type TerraformClientExportTerraformResponse struct { + // The status of the LRO operation. + OperationStatus +} diff --git a/sdk/resourcemanager/terraform/armterraform/terraform_client.go b/sdk/resourcemanager/terraform/armterraform/terraform_client.go new file mode 100644 index 000000000000..7c0eb89352ad --- /dev/null +++ b/sdk/resourcemanager/terraform/armterraform/terraform_client.go @@ -0,0 +1,112 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armterraform + +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" +) + +// TerraformClient contains the methods for the Terraform group. +// Don't use this type directly, use NewTerraformClient() instead. +type TerraformClient struct { + internal *arm.Client + subscriptionID string +} + +// NewTerraformClient creates a new instance of TerraformClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewTerraformClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TerraformClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &TerraformClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginExportTerraform - Exports the Terraform configuration of the specified resource(s). +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01-preview +// - body - The request body +// - options - TerraformClientBeginExportTerraformOptions contains the optional parameters for the TerraformClient.BeginExportTerraform +// method. +func (client *TerraformClient) BeginExportTerraform(ctx context.Context, body BaseExportModelClassification, options *TerraformClientBeginExportTerraformOptions) (*runtime.Poller[TerraformClientExportTerraformResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.exportTerraform(ctx, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[TerraformClientExportTerraformResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[TerraformClientExportTerraformResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ExportTerraform - Exports the Terraform configuration of the specified resource(s). +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01-preview +func (client *TerraformClient) exportTerraform(ctx context.Context, body BaseExportModelClassification, options *TerraformClientBeginExportTerraformOptions) (*http.Response, error) { + var err error + const operationName = "TerraformClient.BeginExportTerraform" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.exportTerraformCreateRequest(ctx, 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.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// exportTerraformCreateRequest creates the ExportTerraform request. +func (client *TerraformClient) exportTerraformCreateRequest(ctx context.Context, body BaseExportModelClassification, _ *TerraformClientBeginExportTerraformOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.AzureTerraform/exportTerraform" + 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.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/terraform/armterraform/terraform_client_example_test.go b/sdk/resourcemanager/terraform/armterraform/terraform_client_example_test.go new file mode 100644 index 000000000000..a6fb7ee92d0d --- /dev/null +++ b/sdk/resourcemanager/terraform/armterraform/terraform_client_example_test.go @@ -0,0 +1,37 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armterraform_test + +import ( + "context" + "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/terraform/armterraform" + "log" +) + +// Generated from example definition: 2023-07-01-preview/ExportTerraform.json +func ExampleTerraformClient_BeginExportTerraform() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armterraform.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewTerraformClient().BeginExportTerraform(ctx, armterraform.ExportResourceGroup{ + Type: to.Ptr(armterraform.TypeExportResourceGroup), + ResourceGroupName: to.Ptr("rg1"), + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} diff --git a/sdk/resourcemanager/terraform/armterraform/time_rfc3339.go b/sdk/resourcemanager/terraform/armterraform/time_rfc3339.go new file mode 100644 index 000000000000..9d6f72ee468a --- /dev/null +++ b/sdk/resourcemanager/terraform/armterraform/time_rfc3339.go @@ -0,0 +1,109 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armterraform + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) + +const ( + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` +) + +type dateTimeRFC3339 time.Time + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + return err +} + +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + +func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { + return nil + } + var aux dateTimeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/terraform/armterraform/tsp-location.yaml b/sdk/resourcemanager/terraform/armterraform/tsp-location.yaml new file mode 100644 index 000000000000..a422d85f8cb6 --- /dev/null +++ b/sdk/resourcemanager/terraform/armterraform/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/terraform/Microsoft.AzureTerraform.Management +commit: df55cd8178ddd870dbd0c3b1e25c80e3ff48826c +repo: Azure/azure-rest-api-specs +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/CHANGELOG.md b/sdk/resourcemanager/trustedsigning/armtrustedsigning/CHANGELOG.md index 65b66c134a02..1c032ef1575f 100644 --- a/sdk/resourcemanager/trustedsigning/armtrustedsigning/CHANGELOG.md +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/CHANGELOG.md @@ -1,5 +1,17 @@ # Release History +## 0.2.0 (2024-11-19) +### Breaking Changes + +- Type of `CodeSigningAccountPatchProperties.SKU` has been changed from `*AccountSKU` to `*AccountSKUPatch` +- Field `City`, `CommonName`, `Country`, `EnhancedKeyUsage`, `Organization`, `OrganizationUnit`, `PostalCode`, `State`, `StreetAddress` of struct `CertificateProfileProperties` has been removed + +### Features Added + +- New struct `AccountSKUPatch` +- New field `EnhancedKeyUsage` in struct `Certificate` + + ## 0.1.0 (2024-09-29) ### Other Changes diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/certificateprofiles_client.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/certificateprofiles_client.go index 532d09c78819..e434808aae39 100644 --- a/sdk/resourcemanager/trustedsigning/armtrustedsigning/certificateprofiles_client.go +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/certificateprofiles_client.go @@ -42,7 +42,7 @@ func NewCertificateProfilesClient(subscriptionID string, credential azcore.Token // BeginCreate - Create a certificate profile. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-05-preview +// Generated from API version 2024-09-30-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Trusted Signing account name. // - profileName - Certificate profile name. @@ -70,7 +70,7 @@ func (client *CertificateProfilesClient) BeginCreate(ctx context.Context, resour // Create - Create a certificate profile. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-05-preview +// Generated from API version 2024-09-30-preview func (client *CertificateProfilesClient) create(ctx context.Context, resourceGroupName string, accountName string, profileName string, resource CertificateProfile, options *CertificateProfilesClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "CertificateProfilesClient.BeginCreate" @@ -116,7 +116,7 @@ func (client *CertificateProfilesClient) createCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-05-preview") + reqQP.Set("api-version", "2024-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} @@ -129,7 +129,7 @@ func (client *CertificateProfilesClient) createCreateRequest(ctx context.Context // BeginDelete - Delete a certificate profile. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-05-preview +// Generated from API version 2024-09-30-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Trusted Signing account name. // - profileName - Certificate profile name. @@ -155,7 +155,7 @@ func (client *CertificateProfilesClient) BeginDelete(ctx context.Context, resour // Delete - Delete a certificate profile. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-05-preview +// Generated from API version 2024-09-30-preview func (client *CertificateProfilesClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, profileName string, options *CertificateProfilesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "CertificateProfilesClient.BeginDelete" @@ -201,7 +201,7 @@ func (client *CertificateProfilesClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-05-preview") + reqQP.Set("api-version", "2024-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -210,7 +210,7 @@ func (client *CertificateProfilesClient) deleteCreateRequest(ctx context.Context // Get - Get details of a certificate profile. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-05-preview +// Generated from API version 2024-09-30-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Trusted Signing account name. // - profileName - Certificate profile name. @@ -261,7 +261,7 @@ func (client *CertificateProfilesClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-05-preview") + reqQP.Set("api-version", "2024-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -278,7 +278,7 @@ func (client *CertificateProfilesClient) getHandleResponse(resp *http.Response) // NewListByCodeSigningAccountPager - List certificate profiles under a trusted signing account. // -// Generated from API version 2024-02-05-preview +// Generated from API version 2024-09-30-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Trusted Signing account name. // - options - CertificateProfilesClientListByCodeSigningAccountOptions contains the optional parameters for the CertificateProfilesClient.NewListByCodeSigningAccountPager @@ -326,7 +326,7 @@ func (client *CertificateProfilesClient) listByCodeSigningAccountCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-05-preview") + reqQP.Set("api-version", "2024-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -344,7 +344,7 @@ func (client *CertificateProfilesClient) listByCodeSigningAccountHandleResponse( // RevokeCertificate - Revoke a certificate under a certificate profile. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-05-preview +// Generated from API version 2024-09-30-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Trusted Signing account name. // - profileName - Certificate profile name. @@ -396,7 +396,7 @@ func (client *CertificateProfilesClient) revokeCertificateCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-05-preview") + reqQP.Set("api-version", "2024-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/certificateprofiles_client_example_test.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/certificateprofiles_client_example_test.go index 080c1b439988..0a6f5872d918 100644 --- a/sdk/resourcemanager/trustedsigning/armtrustedsigning/certificateprofiles_client_example_test.go +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/certificateprofiles_client_example_test.go @@ -13,7 +13,7 @@ import ( "time" ) -// Generated from example definition: 2024-02-05-preview/CertificateProfiles_Create.json +// Generated from example definition: 2024-09-30-preview/CertificateProfiles_Create.json func ExampleCertificateProfilesClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -52,35 +52,28 @@ func ExampleCertificateProfilesClient_BeginCreate() { // { // CreatedDate: to.Ptr("3/14/2023 5:27:49 PM"), // ExpiryDate: to.Ptr("3/17/2023 5:27:49 PM"), + // EnhancedKeyUsage: to.Ptr("1.3.6.1.4.1.311.yy.xxxxxxxx.xxxxxxxx.xxxxxxxxx.xxxxxxxx"), // SerialNumber: to.Ptr("xxxxxxxxxxxxxxxxxx"), // Status: to.Ptr(armtrustedsigning.CertificateStatusActive), // SubjectName: to.Ptr("CN=Contoso Inc, O=Contoso Inc, L=New York, S=New York, C=US"), // Thumbprint: to.Ptr("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"), // }, // }, - // City: to.Ptr("Dallas"), - // CommonName: to.Ptr("Contoso Inc"), - // Country: to.Ptr("US"), - // EnhancedKeyUsage: to.Ptr("1.3.6.1.4.1.311.yy.xxxxxxxx.xxxxxxxx.xxxxxxxxx.xxxxxxxx"), // IdentityValidationID: to.Ptr("00000000-1234-5678-3333-444444444444"), // IncludeCity: to.Ptr(false), // IncludeCountry: to.Ptr(false), // IncludePostalCode: to.Ptr(true), // IncludeState: to.Ptr(false), // IncludeStreetAddress: to.Ptr(false), - // Organization: to.Ptr("Contoso Inc"), - // PostalCode: to.Ptr("560090"), // ProfileType: to.Ptr(armtrustedsigning.ProfileTypePublicTrust), // ProvisioningState: to.Ptr(armtrustedsigning.ProvisioningStateSucceeded), - // State: to.Ptr("Texas"), // Status: to.Ptr(armtrustedsigning.CertificateProfileStatusActive), - // StreetAddress: to.Ptr("123 Bluebonnet"), // }, // }, // } } -// Generated from example definition: 2024-02-05-preview/CertificateProfiles_Delete.json +// Generated from example definition: 2024-09-30-preview/CertificateProfiles_Delete.json func ExampleCertificateProfilesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -101,7 +94,7 @@ func ExampleCertificateProfilesClient_BeginDelete() { } } -// Generated from example definition: 2024-02-05-preview/CertificateProfiles_Get.json +// Generated from example definition: 2024-09-30-preview/CertificateProfiles_Get.json func ExampleCertificateProfilesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -129,35 +122,28 @@ func ExampleCertificateProfilesClient_Get() { // { // CreatedDate: to.Ptr("3/14/2023 5:27:49 PM"), // ExpiryDate: to.Ptr("3/17/2023 5:27:49 PM"), + // EnhancedKeyUsage: to.Ptr("1.3.6.1.4.1.311.yy.xxxxxxxx.xxxxxxxx.xxxxxxxxx.xxxxxxxx"), // SerialNumber: to.Ptr("xxxxxxxxxxxxxxxxxx"), // Status: to.Ptr(armtrustedsigning.CertificateStatusActive), // SubjectName: to.Ptr("CN=Contoso Inc, O=Contoso Inc, L=New York, S=New York, C=US"), // Thumbprint: to.Ptr("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"), // }, // }, - // City: to.Ptr("Dallas"), - // CommonName: to.Ptr("Contoso Inc"), - // Country: to.Ptr("US"), - // EnhancedKeyUsage: to.Ptr("1.3.6.1.4.1.311.yy.xxxxxxxx.xxxxxxxx.xxxxxxxxx.xxxxxxxx"), // IdentityValidationID: to.Ptr("123456"), // IncludeCity: to.Ptr(false), // IncludeCountry: to.Ptr(false), // IncludePostalCode: to.Ptr(true), // IncludeState: to.Ptr(false), // IncludeStreetAddress: to.Ptr(false), - // Organization: to.Ptr("Contoso Inc"), - // PostalCode: to.Ptr("560090"), // ProfileType: to.Ptr(armtrustedsigning.ProfileTypePublicTrust), // ProvisioningState: to.Ptr(armtrustedsigning.ProvisioningStateSucceeded), - // State: to.Ptr("Texas"), // Status: to.Ptr(armtrustedsigning.CertificateProfileStatusActive), - // StreetAddress: to.Ptr("123 Bluebonnet"), // }, // }, // } } -// Generated from example definition: 2024-02-05-preview/CertificateProfiles_ListByCodeSigningAccount.json +// Generated from example definition: 2024-09-30-preview/CertificateProfiles_ListByCodeSigningAccount.json func ExampleCertificateProfilesClient_NewListByCodeSigningAccountPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -191,29 +177,22 @@ func ExampleCertificateProfilesClient_NewListByCodeSigningAccountPager() { // { // CreatedDate: to.Ptr("3/14/2023 5:27:49 PM"), // ExpiryDate: to.Ptr("3/17/2023 5:27:49 PM"), + // EnhancedKeyUsage: to.Ptr("1.3.6.1.4.1.311.yy.xxxxxxxx.xxxxxxxx.xxxxxxxxx.xxxxxxxx"), // SerialNumber: to.Ptr("xxxxxxxxxxxxxxxxxx"), // Status: to.Ptr(armtrustedsigning.CertificateStatusActive), // SubjectName: to.Ptr("CN=Contoso Inc, O=Contoso Inc, L=New York, S=New York, C=US"), // Thumbprint: to.Ptr("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"), // }, // }, - // City: to.Ptr("Dallas"), - // CommonName: to.Ptr("Microsoft Corporation"), - // Country: to.Ptr("US"), - // EnhancedKeyUsage: to.Ptr("1.3.6.1.4.1.311.yy.xxxxxxxx.xxxxxxxx.xxxxxxxxx.xxxxxxxx"), // IdentityValidationID: to.Ptr("123456"), // IncludeCity: to.Ptr(false), // IncludeCountry: to.Ptr(false), // IncludePostalCode: to.Ptr(true), // IncludeState: to.Ptr(false), // IncludeStreetAddress: to.Ptr(false), - // Organization: to.Ptr("Microsoft Corporation"), - // PostalCode: to.Ptr("560090"), // ProfileType: to.Ptr(armtrustedsigning.ProfileTypePublicTrust), // ProvisioningState: to.Ptr(armtrustedsigning.ProvisioningStateSucceeded), - // State: to.Ptr("Texas"), // Status: to.Ptr(armtrustedsigning.CertificateProfileStatusActive), - // StreetAddress: to.Ptr("123 Bluebonnet"), // }, // }, // }, @@ -222,7 +201,7 @@ func ExampleCertificateProfilesClient_NewListByCodeSigningAccountPager() { } } -// Generated from example definition: 2024-02-05-preview/CertificateProfiles_RevokeCertificate.json +// Generated from example definition: 2024-09-30-preview/CertificateProfiles_RevokeCertificate.json func ExampleCertificateProfilesClient_RevokeCertificate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/codesigningaccounts_client.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/codesigningaccounts_client.go index 5d80b7c400f2..fc0c2cd038d0 100644 --- a/sdk/resourcemanager/trustedsigning/armtrustedsigning/codesigningaccounts_client.go +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/codesigningaccounts_client.go @@ -42,7 +42,7 @@ func NewCodeSigningAccountsClient(subscriptionID string, credential azcore.Token // CheckNameAvailability - Checks that the trusted signing account name is valid and is not already in use. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-05-preview +// Generated from API version 2024-09-30-preview // - body - The CheckAvailability request // - options - CodeSigningAccountsClientCheckNameAvailabilityOptions contains the optional parameters for the CodeSigningAccountsClient.CheckNameAvailability // method. @@ -80,7 +80,7 @@ func (client *CodeSigningAccountsClient) checkNameAvailabilityCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-05-preview") + reqQP.Set("api-version", "2024-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} @@ -102,7 +102,7 @@ func (client *CodeSigningAccountsClient) checkNameAvailabilityHandleResponse(res // BeginCreate - Create a trusted Signing Account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-05-preview +// Generated from API version 2024-09-30-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Trusted Signing account name. // - resource - Parameters to create the trusted signing account @@ -129,7 +129,7 @@ func (client *CodeSigningAccountsClient) BeginCreate(ctx context.Context, resour // Create - Create a trusted Signing Account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-05-preview +// Generated from API version 2024-09-30-preview func (client *CodeSigningAccountsClient) create(ctx context.Context, resourceGroupName string, accountName string, resource CodeSigningAccount, options *CodeSigningAccountsClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "CodeSigningAccountsClient.BeginCreate" @@ -171,7 +171,7 @@ func (client *CodeSigningAccountsClient) createCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-05-preview") + reqQP.Set("api-version", "2024-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} @@ -184,7 +184,7 @@ func (client *CodeSigningAccountsClient) createCreateRequest(ctx context.Context // BeginDelete - Delete a trusted signing account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-05-preview +// Generated from API version 2024-09-30-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Trusted Signing account name. // - options - CodeSigningAccountsClientBeginDeleteOptions contains the optional parameters for the CodeSigningAccountsClient.BeginDelete @@ -209,7 +209,7 @@ func (client *CodeSigningAccountsClient) BeginDelete(ctx context.Context, resour // Delete - Delete a trusted signing account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-05-preview +// Generated from API version 2024-09-30-preview func (client *CodeSigningAccountsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, options *CodeSigningAccountsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "CodeSigningAccountsClient.BeginDelete" @@ -251,7 +251,7 @@ func (client *CodeSigningAccountsClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-05-preview") + reqQP.Set("api-version", "2024-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -260,7 +260,7 @@ func (client *CodeSigningAccountsClient) deleteCreateRequest(ctx context.Context // Get - Get a trusted Signing Account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-05-preview +// Generated from API version 2024-09-30-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Trusted Signing account name. // - options - CodeSigningAccountsClientGetOptions contains the optional parameters for the CodeSigningAccountsClient.Get method. @@ -306,7 +306,7 @@ func (client *CodeSigningAccountsClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-05-preview") + reqQP.Set("api-version", "2024-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -323,7 +323,7 @@ func (client *CodeSigningAccountsClient) getHandleResponse(resp *http.Response) // NewListByResourceGroupPager - Lists trusted signing accounts within a resource group. // -// Generated from API version 2024-02-05-preview +// Generated from API version 2024-09-30-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - CodeSigningAccountsClientListByResourceGroupOptions contains the optional parameters for the CodeSigningAccountsClient.NewListByResourceGroupPager // method. @@ -366,7 +366,7 @@ func (client *CodeSigningAccountsClient) listByResourceGroupCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-05-preview") + reqQP.Set("api-version", "2024-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -383,7 +383,7 @@ func (client *CodeSigningAccountsClient) listByResourceGroupHandleResponse(resp // NewListBySubscriptionPager - Lists trusted signing accounts within a subscription. // -// Generated from API version 2024-02-05-preview +// Generated from API version 2024-09-30-preview // - options - CodeSigningAccountsClientListBySubscriptionOptions contains the optional parameters for the CodeSigningAccountsClient.NewListBySubscriptionPager // method. func (client *CodeSigningAccountsClient) NewListBySubscriptionPager(options *CodeSigningAccountsClientListBySubscriptionOptions) *runtime.Pager[CodeSigningAccountsClientListBySubscriptionResponse] { @@ -421,7 +421,7 @@ func (client *CodeSigningAccountsClient) listBySubscriptionCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-05-preview") + reqQP.Set("api-version", "2024-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -439,7 +439,7 @@ func (client *CodeSigningAccountsClient) listBySubscriptionHandleResponse(resp * // BeginUpdate - Update a trusted signing account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-05-preview +// Generated from API version 2024-09-30-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Trusted Signing account name. // - properties - Parameters supplied to update the trusted signing account @@ -465,7 +465,7 @@ func (client *CodeSigningAccountsClient) BeginUpdate(ctx context.Context, resour // Update - Update a trusted signing account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-05-preview +// Generated from API version 2024-09-30-preview func (client *CodeSigningAccountsClient) update(ctx context.Context, resourceGroupName string, accountName string, properties CodeSigningAccountPatch, options *CodeSigningAccountsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "CodeSigningAccountsClient.BeginUpdate" @@ -507,7 +507,7 @@ func (client *CodeSigningAccountsClient) updateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-05-preview") + reqQP.Set("api-version", "2024-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/codesigningaccounts_client_example_test.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/codesigningaccounts_client_example_test.go index 5d99e26faea0..6b8df0c7182e 100644 --- a/sdk/resourcemanager/trustedsigning/armtrustedsigning/codesigningaccounts_client_example_test.go +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/codesigningaccounts_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: 2024-02-05-preview/CodeSigningAccounts_CheckNameAvailability.json +// Generated from example definition: 2024-09-30-preview/CodeSigningAccounts_CheckNameAvailability.json func ExampleCodeSigningAccountsClient_CheckNameAvailability() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -39,7 +39,7 @@ func ExampleCodeSigningAccountsClient_CheckNameAvailability() { // } } -// Generated from example definition: 2024-02-05-preview/CodeSigningAccounts_Create.json +// Generated from example definition: 2024-09-30-preview/CodeSigningAccounts_Create.json func ExampleCodeSigningAccountsClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -84,7 +84,7 @@ func ExampleCodeSigningAccountsClient_BeginCreate() { // } } -// Generated from example definition: 2024-02-05-preview/CodeSigningAccounts_Delete.json +// Generated from example definition: 2024-09-30-preview/CodeSigningAccounts_Delete.json func ExampleCodeSigningAccountsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -105,7 +105,7 @@ func ExampleCodeSigningAccountsClient_BeginDelete() { } } -// Generated from example definition: 2024-02-05-preview/CodeSigningAccounts_Get.json +// Generated from example definition: 2024-09-30-preview/CodeSigningAccounts_Get.json func ExampleCodeSigningAccountsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -142,7 +142,7 @@ func ExampleCodeSigningAccountsClient_Get() { // } } -// Generated from example definition: 2024-02-05-preview/CodeSigningAccounts_ListByResourceGroup.json +// Generated from example definition: 2024-09-30-preview/CodeSigningAccounts_ListByResourceGroup.json func ExampleCodeSigningAccountsClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -188,7 +188,7 @@ func ExampleCodeSigningAccountsClient_NewListByResourceGroupPager() { } } -// Generated from example definition: 2024-02-05-preview/CodeSigningAccounts_ListBySubscription.json +// Generated from example definition: 2024-09-30-preview/CodeSigningAccounts_ListBySubscription.json func ExampleCodeSigningAccountsClient_NewListBySubscriptionPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -234,7 +234,7 @@ func ExampleCodeSigningAccountsClient_NewListBySubscriptionPager() { } } -// Generated from example definition: 2024-02-05-preview/CodeSigningAccounts_Update.json +// Generated from example definition: 2024-09-30-preview/CodeSigningAccounts_Update.json func ExampleCodeSigningAccountsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/constants.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/constants.go index ff6a585fdc9d..f85c071f63ba 100644 --- a/sdk/resourcemanager/trustedsigning/armtrustedsigning/constants.go +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/constants.go @@ -6,7 +6,7 @@ package armtrustedsigning const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/trustedsigning/armtrustedsigning" - moduleVersion = "v0.1.0" + moduleVersion = "v0.2.0" ) // ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/certificateprofiles_server.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/certificateprofiles_server.go index 50234da52fcb..94d152216852 100644 --- a/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/certificateprofiles_server.go +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/certificateprofiles_server.go @@ -25,7 +25,7 @@ type CertificateProfilesServer struct { BeginCreate func(ctx context.Context, resourceGroupName string, accountName string, profileName string, resource armtrustedsigning.CertificateProfile, options *armtrustedsigning.CertificateProfilesClientBeginCreateOptions) (resp azfake.PollerResponder[armtrustedsigning.CertificateProfilesClientCreateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method CertificateProfilesClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, accountName string, profileName string, options *armtrustedsigning.CertificateProfilesClientBeginDeleteOptions) (resp azfake.PollerResponder[armtrustedsigning.CertificateProfilesClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method CertificateProfilesClient.Get @@ -74,25 +74,44 @@ func (c *CertificateProfilesServerTransport) Do(req *http.Request) (*http.Respon } func (c *CertificateProfilesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "CertificateProfilesClient.BeginCreate": - resp, err = c.dispatchBeginCreate(req) - case "CertificateProfilesClient.BeginDelete": - resp, err = c.dispatchBeginDelete(req) - case "CertificateProfilesClient.Get": - resp, err = c.dispatchGet(req) - case "CertificateProfilesClient.NewListByCodeSigningAccountPager": - resp, err = c.dispatchNewListByCodeSigningAccountPager(req) - case "CertificateProfilesClient.RevokeCertificate": - resp, err = c.dispatchRevokeCertificate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if certificateProfilesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = certificateProfilesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "CertificateProfilesClient.BeginCreate": + res.resp, res.err = c.dispatchBeginCreate(req) + case "CertificateProfilesClient.BeginDelete": + res.resp, res.err = c.dispatchBeginDelete(req) + case "CertificateProfilesClient.Get": + res.resp, res.err = c.dispatchGet(req) + case "CertificateProfilesClient.NewListByCodeSigningAccountPager": + res.resp, res.err = c.dispatchNewListByCodeSigningAccountPager(req) + case "CertificateProfilesClient.RevokeCertificate": + res.resp, res.err = c.dispatchRevokeCertificate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (c *CertificateProfilesServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { @@ -184,9 +203,9 @@ func (c *CertificateProfilesServerTransport) dispatchBeginDelete(req *http.Reque return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { c.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { c.beginDelete.remove(req) @@ -313,3 +332,9 @@ func (c *CertificateProfilesServerTransport) dispatchRevokeCertificate(req *http } return resp, nil } + +// set this to conditionally intercept incoming requests to CertificateProfilesServerTransport +var certificateProfilesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/codesigningaccounts_server.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/codesigningaccounts_server.go index a886f6e6372a..933abafd06b9 100644 --- a/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/codesigningaccounts_server.go +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/codesigningaccounts_server.go @@ -29,7 +29,7 @@ type CodeSigningAccountsServer struct { BeginCreate func(ctx context.Context, resourceGroupName string, accountName string, resource armtrustedsigning.CodeSigningAccount, options *armtrustedsigning.CodeSigningAccountsClientBeginCreateOptions) (resp azfake.PollerResponder[armtrustedsigning.CodeSigningAccountsClientCreateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method CodeSigningAccountsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, accountName string, options *armtrustedsigning.CodeSigningAccountsClientBeginDeleteOptions) (resp azfake.PollerResponder[armtrustedsigning.CodeSigningAccountsClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method CodeSigningAccountsClient.Get @@ -86,29 +86,48 @@ func (c *CodeSigningAccountsServerTransport) Do(req *http.Request) (*http.Respon } func (c *CodeSigningAccountsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error - - switch method { - case "CodeSigningAccountsClient.CheckNameAvailability": - resp, err = c.dispatchCheckNameAvailability(req) - case "CodeSigningAccountsClient.BeginCreate": - resp, err = c.dispatchBeginCreate(req) - case "CodeSigningAccountsClient.BeginDelete": - resp, err = c.dispatchBeginDelete(req) - case "CodeSigningAccountsClient.Get": - resp, err = c.dispatchGet(req) - case "CodeSigningAccountsClient.NewListByResourceGroupPager": - resp, err = c.dispatchNewListByResourceGroupPager(req) - case "CodeSigningAccountsClient.NewListBySubscriptionPager": - resp, err = c.dispatchNewListBySubscriptionPager(req) - case "CodeSigningAccountsClient.BeginUpdate": - resp, err = c.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - return resp, err + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if codeSigningAccountsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = codeSigningAccountsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "CodeSigningAccountsClient.CheckNameAvailability": + res.resp, res.err = c.dispatchCheckNameAvailability(req) + case "CodeSigningAccountsClient.BeginCreate": + res.resp, res.err = c.dispatchBeginCreate(req) + case "CodeSigningAccountsClient.BeginDelete": + res.resp, res.err = c.dispatchBeginDelete(req) + case "CodeSigningAccountsClient.Get": + res.resp, res.err = c.dispatchGet(req) + case "CodeSigningAccountsClient.NewListByResourceGroupPager": + res.resp, res.err = c.dispatchNewListByResourceGroupPager(req) + case "CodeSigningAccountsClient.NewListBySubscriptionPager": + res.resp, res.err = c.dispatchNewListBySubscriptionPager(req) + case "CodeSigningAccountsClient.BeginUpdate": + res.resp, res.err = c.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (c *CodeSigningAccountsServerTransport) dispatchCheckNameAvailability(req *http.Request) (*http.Response, error) { @@ -221,9 +240,9 @@ func (c *CodeSigningAccountsServerTransport) dispatchBeginDelete(req *http.Reque return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { c.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { c.beginDelete.remove(req) @@ -382,3 +401,9 @@ func (c *CodeSigningAccountsServerTransport) dispatchBeginUpdate(req *http.Reque return resp, nil } + +// set this to conditionally intercept incoming requests to CodeSigningAccountsServerTransport +var codeSigningAccountsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/internal.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/internal.go index 56a8f624f5f3..7425b6a669e2 100644 --- a/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/internal.go +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/internal.go @@ -10,6 +10,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/operations_server.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/operations_server.go index dcbfc7a95dbc..dc32d5c2713e 100644 --- a/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/operations_server.go +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/operations_server.go @@ -51,17 +51,36 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error } func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -90,3 +109,9 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/go.mod b/sdk/resourcemanager/trustedsigning/armtrustedsigning/go.mod index d0a344d6e1de..62c06031e21e 100644 --- a/sdk/resourcemanager/trustedsigning/armtrustedsigning/go.mod +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/go.mod @@ -3,7 +3,7 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/trustedsigning/armt go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 ) @@ -14,8 +14,8 @@ require ( github.com/google/uuid v1.6.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.25.0 // indirect - golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect - golang.org/x/text v0.16.0 // indirect + golang.org/x/crypto v0.27.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/text v0.18.0 // indirect ) diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/go.sum b/sdk/resourcemanager/trustedsigning/armtrustedsigning/go.sum index 09d275cb9a37..cbddbbd9ecec 100644 --- a/sdk/resourcemanager/trustedsigning/armtrustedsigning/go.sum +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/go.sum @@ -1,5 +1,5 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 h1:JZg6HRh6W6U4OLl6lk7BZ7BLisIzM9dG1R50zUk9C/M= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0/go.mod h1:YL1xnZ6QejvQHWJrX/AvhFl4WW4rqHVoKspWNVwFk0M= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= @@ -17,13 +17,13 @@ github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmd github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= -golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= -golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/models.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/models.go index cfb89b3234d0..730350126f22 100644 --- a/sdk/resourcemanager/trustedsigning/armtrustedsigning/models.go +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/models.go @@ -12,11 +12,20 @@ type AccountSKU struct { Name *SKUName } +// AccountSKUPatch - SKU of the trusted signing account. +type AccountSKUPatch struct { + // Name of the SKU. + Name *SKUName +} + // Certificate - Properties of the certificate. type Certificate struct { // Certificate created date. CreatedDate *string + // Enhanced key usage of the certificate. + EnhancedKeyUsage *string + // Certificate expiry date. ExpiryDate *string @@ -65,12 +74,12 @@ type CertificateProfileListResult struct { // CertificateProfileProperties - Properties of the certificate profile. type CertificateProfileProperties struct { + // REQUIRED; Identity validation id used for the certificate subject name. + IdentityValidationID *string + // REQUIRED; Profile type of the certificate. ProfileType *ProfileType - // Identity validation id used for the certificate subject name. - IdentityValidationID *string - // Whether to include L in the certificate subject name. Applicable only for private trust, private trust ci profile types IncludeCity *bool @@ -89,38 +98,11 @@ type CertificateProfileProperties struct { // READ-ONLY; List of renewed certificates. Certificates []*Certificate - // READ-ONLY; Used as L in the certificate subject name. - City *string - - // READ-ONLY; Used as CN in the certificate subject name. - CommonName *string - - // READ-ONLY; Used as C in the certificate subject name. - Country *string - - // READ-ONLY; Enhanced key usage of the certificate. - EnhancedKeyUsage *string - - // READ-ONLY; Used as O in the certificate subject name. - Organization *string - - // READ-ONLY; Used as OU in the private trust certificate subject name. - OrganizationUnit *string - - // READ-ONLY; Used as PC in the certificate subject name. - PostalCode *string - // READ-ONLY; Status of the current operation on certificate profile. ProvisioningState *ProvisioningState - // READ-ONLY; Used as S in the certificate subject name. - State *string - // READ-ONLY; Status of the certificate profile. Status *CertificateProfileStatus - - // READ-ONLY; Used as STREET in the certificate subject name. - StreetAddress *string } // CheckNameAvailability - The parameters used to check the availability of the trusted signing account name. @@ -188,7 +170,7 @@ type CodeSigningAccountPatch struct { // CodeSigningAccountPatchProperties - Properties of the trusted signing account. type CodeSigningAccountPatchProperties struct { // SKU of the trusted signing account. - SKU *AccountSKU + SKU *AccountSKUPatch } // CodeSigningAccountProperties - Properties of the trusted signing account. diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/models_serde.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/models_serde.go index a2b0b08cfedf..fcb032b16f18 100644 --- a/sdk/resourcemanager/trustedsigning/armtrustedsigning/models_serde.go +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/models_serde.go @@ -38,10 +38,38 @@ func (a *AccountSKU) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type AccountSKUPatch. +func (a AccountSKUPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", a.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountSKUPatch. +func (a *AccountSKUPatch) UnmarshalJSON(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) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Certificate. func (c Certificate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "createdDate", c.CreatedDate) + populate(objectMap, "enhancedKeyUsage", c.EnhancedKeyUsage) populate(objectMap, "expiryDate", c.ExpiryDate) populate(objectMap, "revocation", c.Revocation) populate(objectMap, "serialNumber", c.SerialNumber) @@ -63,6 +91,9 @@ func (c *Certificate) UnmarshalJSON(data []byte) error { case "createdDate": err = unpopulate(val, "CreatedDate", &c.CreatedDate) delete(rawMsg, key) + case "enhancedKeyUsage": + err = unpopulate(val, "EnhancedKeyUsage", &c.EnhancedKeyUsage) + delete(rawMsg, key) case "expiryDate": err = unpopulate(val, "ExpiryDate", &c.ExpiryDate) delete(rawMsg, key) @@ -167,24 +198,15 @@ func (c *CertificateProfileListResult) UnmarshalJSON(data []byte) error { func (c CertificateProfileProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "certificates", c.Certificates) - populate(objectMap, "city", c.City) - populate(objectMap, "commonName", c.CommonName) - populate(objectMap, "country", c.Country) - populate(objectMap, "enhancedKeyUsage", c.EnhancedKeyUsage) populate(objectMap, "identityValidationId", c.IdentityValidationID) populate(objectMap, "includeCity", c.IncludeCity) populate(objectMap, "includeCountry", c.IncludeCountry) populate(objectMap, "includePostalCode", c.IncludePostalCode) populate(objectMap, "includeState", c.IncludeState) populate(objectMap, "includeStreetAddress", c.IncludeStreetAddress) - populate(objectMap, "organization", c.Organization) - populate(objectMap, "organizationUnit", c.OrganizationUnit) - populate(objectMap, "postalCode", c.PostalCode) populate(objectMap, "profileType", c.ProfileType) populate(objectMap, "provisioningState", c.ProvisioningState) - populate(objectMap, "state", c.State) populate(objectMap, "status", c.Status) - populate(objectMap, "streetAddress", c.StreetAddress) return json.Marshal(objectMap) } @@ -200,18 +222,6 @@ func (c *CertificateProfileProperties) UnmarshalJSON(data []byte) error { case "certificates": err = unpopulate(val, "Certificates", &c.Certificates) delete(rawMsg, key) - case "city": - err = unpopulate(val, "City", &c.City) - delete(rawMsg, key) - case "commonName": - err = unpopulate(val, "CommonName", &c.CommonName) - delete(rawMsg, key) - case "country": - err = unpopulate(val, "Country", &c.Country) - delete(rawMsg, key) - case "enhancedKeyUsage": - err = unpopulate(val, "EnhancedKeyUsage", &c.EnhancedKeyUsage) - delete(rawMsg, key) case "identityValidationId": err = unpopulate(val, "IdentityValidationID", &c.IdentityValidationID) delete(rawMsg, key) @@ -230,30 +240,15 @@ func (c *CertificateProfileProperties) UnmarshalJSON(data []byte) error { case "includeStreetAddress": err = unpopulate(val, "IncludeStreetAddress", &c.IncludeStreetAddress) delete(rawMsg, key) - case "organization": - err = unpopulate(val, "Organization", &c.Organization) - delete(rawMsg, key) - case "organizationUnit": - err = unpopulate(val, "OrganizationUnit", &c.OrganizationUnit) - delete(rawMsg, key) - case "postalCode": - err = unpopulate(val, "PostalCode", &c.PostalCode) - delete(rawMsg, key) case "profileType": err = unpopulate(val, "ProfileType", &c.ProfileType) delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &c.State) - delete(rawMsg, key) case "status": err = unpopulate(val, "Status", &c.Status) delete(rawMsg, key) - case "streetAddress": - err = unpopulate(val, "StreetAddress", &c.StreetAddress) - delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/operations_client.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/operations_client.go index 4df423270e96..ee3e36600a93 100644 --- a/sdk/resourcemanager/trustedsigning/armtrustedsigning/operations_client.go +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/operations_client.go @@ -35,7 +35,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - List the operations for the provider // -// Generated from API version 2024-02-05-preview +// Generated from API version 2024-09-30-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]{ @@ -68,7 +68,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *Operat return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-05-preview") + reqQP.Set("api-version", "2024-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/operations_client_example_test.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/operations_client_example_test.go index 8d8011d02001..886d000c955f 100644 --- a/sdk/resourcemanager/trustedsigning/armtrustedsigning/operations_client_example_test.go +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/operations_client_example_test.go @@ -11,7 +11,7 @@ import ( "log" ) -// Generated from example definition: 2024-02-05-preview/Operations_List.json +// Generated from example definition: 2024-09-30-preview/Operations_List.json func ExampleOperationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/tsp-location.yaml b/sdk/resourcemanager/trustedsigning/armtrustedsigning/tsp-location.yaml index 58a0ab9c920e..6c91cb00f510 100644 --- a/sdk/resourcemanager/trustedsigning/armtrustedsigning/tsp-location.yaml +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/codesigning/CodeSigning.Management -commit: 778fdb20839c487eba95a6b161812ad9d9d6337d +commit: df55cd8178ddd870dbd0c3b1e25c80e3ff48826c repo: Azure/azure-rest-api-specs -additionalDirectories: +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/CHANGELOG.md b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/CHANGELOG.md index 3a3e8181ab5f..04d6216fe706 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/CHANGELOG.md +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/CHANGELOG.md @@ -1,5 +1,88 @@ # Release History +## 1.0.0 (2024-11-19) +### Breaking Changes + +- Type of `CreateAndMountFileShareConfiguration.ConfigurationType` has been changed from `*ConfigurationType` to `*FileShareConfigurationType` +- Type of `ErrorAdditionalInfo.Info` has been changed from `any` to `*ErrorAdditionalInfoInfo` +- Type of `FileShareConfiguration.ConfigurationType` has been changed from `*ConfigurationType` to `*FileShareConfigurationType` +- Type of `MountFileShareConfiguration.ConfigurationType` has been changed from `*ConfigurationType` to `*FileShareConfigurationType` +- Type of `OperationStatusResult.PercentComplete` has been changed from `*float32` to `*float64` +- Type of `SAPVirtualInstance.Identity` has been changed from `*UserAssignedServiceIdentity` to `*SAPVirtualInstanceIdentity` +- Type of `SkipFileShareConfiguration.ConfigurationType` has been changed from `*ConfigurationType` to `*FileShareConfigurationType` +- Type of `UpdateSAPVirtualInstanceRequest.Identity` has been changed from `*UserAssignedServiceIdentity` to `*SAPVirtualInstanceIdentity` +- Enum `ActionType` has been removed +- Enum `ConfigurationType` has been removed +- Enum `ManagedServiceIdentityType` has been removed +- Enum `Origin` has been removed +- Function `*ClientFactory.NewOperationsClient` has been removed +- Function `*ClientFactory.NewSAPCentralInstancesClient` has been removed +- Function `*ClientFactory.NewWorkloadsClient` has been removed +- Function `NewOperationsClient` has been removed +- Function `*OperationsClient.NewListPager` has been removed +- Function `*SAPApplicationServerInstancesClient.BeginStartInstance` has been removed +- Function `*SAPApplicationServerInstancesClient.BeginStopInstance` has been removed +- Function `NewSAPCentralInstancesClient` has been removed +- Function `*SAPCentralInstancesClient.BeginCreate` has been removed +- Function `*SAPCentralInstancesClient.BeginDelete` has been removed +- Function `*SAPCentralInstancesClient.Get` has been removed +- Function `*SAPCentralInstancesClient.NewListPager` has been removed +- Function `*SAPCentralInstancesClient.BeginStartInstance` has been removed +- Function `*SAPCentralInstancesClient.BeginStopInstance` has been removed +- Function `*SAPCentralInstancesClient.Update` has been removed +- Function `*SAPDatabaseInstancesClient.BeginStartInstance` has been removed +- Function `*SAPDatabaseInstancesClient.BeginStopInstance` has been removed +- Function `NewWorkloadsClient` has been removed +- Function `*WorkloadsClient.SAPAvailabilityZoneDetails` has been removed +- Function `*WorkloadsClient.SAPDiskConfigurations` has been removed +- Function `*WorkloadsClient.SAPSizingRecommendations` has been removed +- Function `*WorkloadsClient.SAPSupportedSKU` has been removed +- Struct `Operation` has been removed +- Struct `OperationDisplay` has been removed +- Struct `OperationListResult` has been removed +- Struct `SAPApplicationServerInstanceList` has been removed +- Struct `SAPCentralInstanceList` has been removed +- Struct `SAPDatabaseInstanceList` has been removed +- Struct `SAPVirtualInstanceList` has been removed +- Struct `UserAssignedServiceIdentity` has been removed +- Field `SAPApplicationServerInstanceList` of struct `SAPApplicationServerInstancesClientListResponse` has been removed +- Field `SAPDatabaseInstanceList` of struct `SAPDatabaseInstancesClientListResponse` has been removed +- Field `SAPVirtualInstanceList` of struct `SAPVirtualInstancesClientListByResourceGroupResponse` has been removed +- Field `SAPVirtualInstanceList` of struct `SAPVirtualInstancesClientListBySubscriptionResponse` has been removed + +### Features Added + +- New enum type `FileShareConfigurationType` with values `FileShareConfigurationTypeCreateAndMount`, `FileShareConfigurationTypeMount`, `FileShareConfigurationTypeSkip` +- New enum type `SAPVirtualInstanceIdentityType` with values `SAPVirtualInstanceIdentityTypeNone`, `SAPVirtualInstanceIdentityTypeUserAssigned` +- New function `*ClientFactory.NewSAPCentralServerInstancesClient() *SAPCentralServerInstancesClient` +- New function `*SAPApplicationServerInstancesClient.BeginStart(context.Context, string, string, string, *SAPApplicationServerInstancesClientBeginStartOptions) (*runtime.Poller[SAPApplicationServerInstancesClientStartResponse], error)` +- New function `*SAPApplicationServerInstancesClient.BeginStop(context.Context, string, string, string, *SAPApplicationServerInstancesClientBeginStopOptions) (*runtime.Poller[SAPApplicationServerInstancesClientStopResponse], error)` +- New function `NewSAPCentralServerInstancesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*SAPCentralServerInstancesClient, error)` +- New function `*SAPCentralServerInstancesClient.BeginCreate(context.Context, string, string, string, SAPCentralServerInstance, *SAPCentralServerInstancesClientBeginCreateOptions) (*runtime.Poller[SAPCentralServerInstancesClientCreateResponse], error)` +- New function `*SAPCentralServerInstancesClient.BeginDelete(context.Context, string, string, string, *SAPCentralServerInstancesClientBeginDeleteOptions) (*runtime.Poller[SAPCentralServerInstancesClientDeleteResponse], error)` +- New function `*SAPCentralServerInstancesClient.Get(context.Context, string, string, string, *SAPCentralServerInstancesClientGetOptions) (SAPCentralServerInstancesClientGetResponse, error)` +- New function `*SAPCentralServerInstancesClient.NewListPager(string, string, *SAPCentralServerInstancesClientListOptions) *runtime.Pager[SAPCentralServerInstancesClientListResponse]` +- New function `*SAPCentralServerInstancesClient.BeginStart(context.Context, string, string, string, *SAPCentralServerInstancesClientBeginStartOptions) (*runtime.Poller[SAPCentralServerInstancesClientStartResponse], error)` +- New function `*SAPCentralServerInstancesClient.BeginStop(context.Context, string, string, string, *SAPCentralServerInstancesClientBeginStopOptions) (*runtime.Poller[SAPCentralServerInstancesClientStopResponse], error)` +- New function `*SAPCentralServerInstancesClient.Update(context.Context, string, string, string, UpdateSAPCentralInstanceRequest, *SAPCentralServerInstancesClientUpdateOptions) (SAPCentralServerInstancesClientUpdateResponse, error)` +- New function `*SAPDatabaseInstancesClient.BeginStart(context.Context, string, string, string, *SAPDatabaseInstancesClientBeginStartOptions) (*runtime.Poller[SAPDatabaseInstancesClientStartResponse], error)` +- New function `*SAPDatabaseInstancesClient.BeginStop(context.Context, string, string, string, *SAPDatabaseInstancesClientBeginStopOptions) (*runtime.Poller[SAPDatabaseInstancesClientStopResponse], error)` +- New function `*SAPVirtualInstancesClient.GetAvailabilityZoneDetails(context.Context, string, SAPAvailabilityZoneDetailsRequest, *SAPVirtualInstancesClientGetAvailabilityZoneDetailsOptions) (SAPVirtualInstancesClientGetAvailabilityZoneDetailsResponse, error)` +- New function `*SAPVirtualInstancesClient.GetDiskConfigurations(context.Context, string, SAPDiskConfigurationsRequest, *SAPVirtualInstancesClientGetDiskConfigurationsOptions) (SAPVirtualInstancesClientGetDiskConfigurationsResponse, error)` +- New function `*SAPVirtualInstancesClient.GetSapSupportedSKU(context.Context, string, SAPSupportedSKUsRequest, *SAPVirtualInstancesClientGetSapSupportedSKUOptions) (SAPVirtualInstancesClientGetSapSupportedSKUResponse, error)` +- New function `*SAPVirtualInstancesClient.GetSizingRecommendations(context.Context, string, SAPSizingRecommendationRequest, *SAPVirtualInstancesClientGetSizingRecommendationsOptions) (SAPVirtualInstancesClientGetSizingRecommendationsResponse, error)` +- New struct `ErrorAdditionalInfoInfo` +- New struct `SAPApplicationServerInstanceListResult` +- New struct `SAPCentralServerInstanceListResult` +- New struct `SAPDatabaseInstanceListResult` +- New struct `SAPVirtualInstanceIdentity` +- New struct `SAPVirtualInstanceListResult` +- New anonymous field `SAPApplicationServerInstanceListResult` in struct `SAPApplicationServerInstancesClientListResponse` +- New anonymous field `SAPDatabaseInstanceListResult` in struct `SAPDatabaseInstancesClientListResponse` +- New anonymous field `SAPVirtualInstanceListResult` in struct `SAPVirtualInstancesClientListByResourceGroupResponse` +- New anonymous field `SAPVirtualInstanceListResult` in struct `SAPVirtualInstancesClientListBySubscriptionResponse` + + ## 0.1.0 (2024-02-23) ### Other Changes diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/autorest.md b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/autorest.md deleted file mode 100644 index d90afb2e7ea1..000000000000 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/autorest.md +++ /dev/null @@ -1,13 +0,0 @@ -### AutoRest Configuration - -> see https://aka.ms/autorest - -``` yaml -azure-arm: true -require: -- https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/readme.go.md -license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 -tag: package-preview-2023-10 -``` \ No newline at end of file diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/build.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/build.go deleted file mode 100644 index 17e40c7f3d7d..000000000000 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/build.go +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. - -// This file enables 'go generate' to regenerate this specific SDK -//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate -alwaysSetBodyParamRequired -removeUnreferencedTypes resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance - -package armworkloadssapvirtualinstance diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/client_factory.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/client_factory.go index caba65f1dc75..948443e595bd 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/client_factory.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/client_factory.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armworkloadssapvirtualinstance @@ -22,7 +18,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 - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - 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) { @@ -36,13 +32,6 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, }, nil } -// NewOperationsClient creates a new instance of OperationsClient. -func (c *ClientFactory) NewOperationsClient() *OperationsClient { - return &OperationsClient{ - internal: c.internal, - } -} - // NewSAPApplicationServerInstancesClient creates a new instance of SAPApplicationServerInstancesClient. func (c *ClientFactory) NewSAPApplicationServerInstancesClient() *SAPApplicationServerInstancesClient { return &SAPApplicationServerInstancesClient{ @@ -51,9 +40,9 @@ func (c *ClientFactory) NewSAPApplicationServerInstancesClient() *SAPApplication } } -// NewSAPCentralInstancesClient creates a new instance of SAPCentralInstancesClient. -func (c *ClientFactory) NewSAPCentralInstancesClient() *SAPCentralInstancesClient { - return &SAPCentralInstancesClient{ +// NewSAPCentralServerInstancesClient creates a new instance of SAPCentralServerInstancesClient. +func (c *ClientFactory) NewSAPCentralServerInstancesClient() *SAPCentralServerInstancesClient { + return &SAPCentralServerInstancesClient{ subscriptionID: c.subscriptionID, internal: c.internal, } @@ -74,11 +63,3 @@ func (c *ClientFactory) NewSAPVirtualInstancesClient() *SAPVirtualInstancesClien internal: c.internal, } } - -// NewWorkloadsClient creates a new instance of WorkloadsClient. -func (c *ClientFactory) NewWorkloadsClient() *WorkloadsClient { - return &WorkloadsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/constants.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/constants.go index 8e5f27f91544..a023be37502b 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/constants.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/constants.go @@ -1,38 +1,23 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armworkloadssapvirtualinstance const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance" - moduleVersion = "v0.1.0" -) - -// ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. -type ActionType string - -const ( - ActionTypeInternal ActionType = "Internal" + moduleVersion = "v1.0.0" ) -// PossibleActionTypeValues returns the possible values for the ActionType const type. -func PossibleActionTypeValues() []ActionType { - return []ActionType{ - ActionTypeInternal, - } -} - // ApplicationServerVirtualMachineType - Defines the type of application server VM. type ApplicationServerVirtualMachineType string const ( - ApplicationServerVirtualMachineTypeActive ApplicationServerVirtualMachineType = "Active" + // ApplicationServerVirtualMachineTypeActive - Active Application server vm type. + ApplicationServerVirtualMachineTypeActive ApplicationServerVirtualMachineType = "Active" + // ApplicationServerVirtualMachineTypeStandby - Standby Application server vm type. ApplicationServerVirtualMachineTypeStandby ApplicationServerVirtualMachineType = "Standby" + // ApplicationServerVirtualMachineTypeUnknown - Unknown Application server vm type. ApplicationServerVirtualMachineTypeUnknown ApplicationServerVirtualMachineType = "Unknown" ) @@ -49,13 +34,20 @@ func PossibleApplicationServerVirtualMachineTypeValues() []ApplicationServerVirt type CentralServerVirtualMachineType string const ( - CentralServerVirtualMachineTypeASCS CentralServerVirtualMachineType = "ASCS" - CentralServerVirtualMachineTypeERS CentralServerVirtualMachineType = "ERS" + // CentralServerVirtualMachineTypeASCS - ASCS Central server vm type. + CentralServerVirtualMachineTypeASCS CentralServerVirtualMachineType = "ASCS" + // CentralServerVirtualMachineTypeERS - ERS Central server vm type. + CentralServerVirtualMachineTypeERS CentralServerVirtualMachineType = "ERS" + // CentralServerVirtualMachineTypeERSInactive - ERSInactive Central server vm type. CentralServerVirtualMachineTypeERSInactive CentralServerVirtualMachineType = "ERSInactive" - CentralServerVirtualMachineTypePrimary CentralServerVirtualMachineType = "Primary" - CentralServerVirtualMachineTypeSecondary CentralServerVirtualMachineType = "Secondary" - CentralServerVirtualMachineTypeStandby CentralServerVirtualMachineType = "Standby" - CentralServerVirtualMachineTypeUnknown CentralServerVirtualMachineType = "Unknown" + // CentralServerVirtualMachineTypePrimary - Primary central server vm. + CentralServerVirtualMachineTypePrimary CentralServerVirtualMachineType = "Primary" + // CentralServerVirtualMachineTypeSecondary - Secondary central server vm. + CentralServerVirtualMachineTypeSecondary CentralServerVirtualMachineType = "Secondary" + // CentralServerVirtualMachineTypeStandby - Standby Central server vm type. + CentralServerVirtualMachineTypeStandby CentralServerVirtualMachineType = "Standby" + // CentralServerVirtualMachineTypeUnknown - Central server vm type unknown. + CentralServerVirtualMachineTypeUnknown CentralServerVirtualMachineType = "Unknown" ) // PossibleCentralServerVirtualMachineTypeValues returns the possible values for the CentralServerVirtualMachineType const type. @@ -71,32 +63,18 @@ func PossibleCentralServerVirtualMachineTypeValues() []CentralServerVirtualMachi } } -// ConfigurationType - The type of file share config. -type ConfigurationType string - -const ( - ConfigurationTypeCreateAndMount ConfigurationType = "CreateAndMount" - ConfigurationTypeMount ConfigurationType = "Mount" - ConfigurationTypeSkip ConfigurationType = "Skip" -) - -// PossibleConfigurationTypeValues returns the possible values for the ConfigurationType const type. -func PossibleConfigurationTypeValues() []ConfigurationType { - return []ConfigurationType{ - ConfigurationTypeCreateAndMount, - ConfigurationTypeMount, - ConfigurationTypeSkip, - } -} - -// CreatedByType - The type of identity that created the resource. +// CreatedByType - The kind of entity that created the resource. type CreatedByType string const ( - CreatedByTypeApplication CreatedByType = "Application" - CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeApplication - The entity was created by an application. + CreatedByTypeApplication CreatedByType = "Application" + // CreatedByTypeKey - The entity was created by a key. + CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeManagedIdentity - The entity was created by a managed identity. CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - CreatedByTypeUser CreatedByType = "User" + // CreatedByTypeUser - The entity was created by a user. + CreatedByTypeUser CreatedByType = "User" ) // PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. @@ -113,13 +91,20 @@ func PossibleCreatedByTypeValues() []CreatedByType { type DiskSKUName string const ( - DiskSKUNamePremiumLRS DiskSKUName = "Premium_LRS" - DiskSKUNamePremiumV2LRS DiskSKUName = "PremiumV2_LRS" - DiskSKUNamePremiumZRS DiskSKUName = "Premium_ZRS" - DiskSKUNameStandardLRS DiskSKUName = "Standard_LRS" + // DiskSKUNamePremiumLRS - Premium_LRS Disk SKU. + DiskSKUNamePremiumLRS DiskSKUName = "Premium_LRS" + // DiskSKUNamePremiumV2LRS - PremiumV2_LRS Disk SKU. + DiskSKUNamePremiumV2LRS DiskSKUName = "PremiumV2_LRS" + // DiskSKUNamePremiumZRS - Premium_ZRS Disk SKU. + DiskSKUNamePremiumZRS DiskSKUName = "Premium_ZRS" + // DiskSKUNameStandardLRS - Standard LRS Disk SKU. + DiskSKUNameStandardLRS DiskSKUName = "Standard_LRS" + // DiskSKUNameStandardSSDLRS - StandardSSD_LRS Disk SKU. DiskSKUNameStandardSSDLRS DiskSKUName = "StandardSSD_LRS" + // DiskSKUNameStandardSSDZRS - StandardSSD_ZRS Disk SKU. DiskSKUNameStandardSSDZRS DiskSKUName = "StandardSSD_ZRS" - DiskSKUNameUltraSSDLRS DiskSKUName = "UltraSSD_LRS" + // DiskSKUNameUltraSSDLRS - UltraSSD_LRS Disk SKU. + DiskSKUNameUltraSSDLRS DiskSKUName = "UltraSSD_LRS" ) // PossibleDiskSKUNameValues returns the possible values for the DiskSKUName const type. @@ -139,7 +124,9 @@ func PossibleDiskSKUNameValues() []DiskSKUName { type EnqueueReplicationServerType string const ( + // EnqueueReplicationServerTypeEnqueueReplicator1 - Enqueue Replication server type 1. EnqueueReplicationServerTypeEnqueueReplicator1 EnqueueReplicationServerType = "EnqueueReplicator1" + // EnqueueReplicationServerTypeEnqueueReplicator2 - Enqueue Replication server type 2. EnqueueReplicationServerTypeEnqueueReplicator2 EnqueueReplicationServerType = "EnqueueReplicator2" ) @@ -151,12 +138,35 @@ func PossibleEnqueueReplicationServerTypeValues() []EnqueueReplicationServerType } } +// FileShareConfigurationType - The type of file share config. +type FileShareConfigurationType string + +const ( + // FileShareConfigurationTypeCreateAndMount - Fileshare will be created and mounted by service. + FileShareConfigurationTypeCreateAndMount FileShareConfigurationType = "CreateAndMount" + // FileShareConfigurationTypeMount - Existing fileshare provided will be mounted by service. + FileShareConfigurationTypeMount FileShareConfigurationType = "Mount" + // FileShareConfigurationTypeSkip - Skip creating the file share. + FileShareConfigurationTypeSkip FileShareConfigurationType = "Skip" +) + +// PossibleFileShareConfigurationTypeValues returns the possible values for the FileShareConfigurationType const type. +func PossibleFileShareConfigurationTypeValues() []FileShareConfigurationType { + return []FileShareConfigurationType{ + FileShareConfigurationTypeCreateAndMount, + FileShareConfigurationTypeMount, + FileShareConfigurationTypeSkip, + } +} + // ManagedResourcesNetworkAccessType - Defines the network access type for managed resources. type ManagedResourcesNetworkAccessType string const ( + // ManagedResourcesNetworkAccessTypePrivate - Managed resources will be deployed with public network access disabled. ManagedResourcesNetworkAccessTypePrivate ManagedResourcesNetworkAccessType = "Private" - ManagedResourcesNetworkAccessTypePublic ManagedResourcesNetworkAccessType = "Public" + // ManagedResourcesNetworkAccessTypePublic - Managed resources will be deployed with public network access enabled. + ManagedResourcesNetworkAccessTypePublic ManagedResourcesNetworkAccessType = "Public" ) // PossibleManagedResourcesNetworkAccessTypeValues returns the possible values for the ManagedResourcesNetworkAccessType const type. @@ -167,26 +177,11 @@ func PossibleManagedResourcesNetworkAccessTypeValues() []ManagedResourcesNetwork } } -// ManagedServiceIdentityType - Type of managed service identity (only None, UserAssigned types are allowed). -type ManagedServiceIdentityType string - -const ( - ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" - ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" -) - -// PossibleManagedServiceIdentityTypeValues returns the possible values for the ManagedServiceIdentityType const type. -func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { - return []ManagedServiceIdentityType{ - ManagedServiceIdentityTypeNone, - ManagedServiceIdentityTypeUserAssigned, - } -} - // NamingPatternType - The pattern type to be used for resource naming. type NamingPatternType string const ( + // NamingPatternTypeFullResourceName - Full resource names that will be created by service. NamingPatternTypeFullResourceName NamingPatternType = "FullResourceName" ) @@ -201,7 +196,9 @@ func PossibleNamingPatternTypeValues() []NamingPatternType { type OSType string const ( - OSTypeLinux OSType = "Linux" + // OSTypeLinux - Linux OS Type. + OSTypeLinux OSType = "Linux" + // OSTypeWindows - Windows OS Type. OSTypeWindows OSType = "Windows" ) @@ -213,32 +210,16 @@ func PossibleOSTypeValues() []OSType { } } -// 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 ( - OriginSystem Origin = "system" - OriginUser Origin = "user" - OriginUserSystem Origin = "user,system" -) - -// PossibleOriginValues returns the possible values for the Origin const type. -func PossibleOriginValues() []Origin { - return []Origin{ - OriginSystem, - OriginUser, - OriginUserSystem, - } -} - // SAPConfigurationType - The configuration Type. type SAPConfigurationType string const ( - SAPConfigurationTypeDeployment SAPConfigurationType = "Deployment" + // SAPConfigurationTypeDeployment - SAP system will be deployed by service. No OS configurations will be done. + SAPConfigurationTypeDeployment SAPConfigurationType = "Deployment" + // SAPConfigurationTypeDeploymentWithOSConfig - SAP system will be deployed by service. OS configurations will be done. SAPConfigurationTypeDeploymentWithOSConfig SAPConfigurationType = "DeploymentWithOSConfig" - SAPConfigurationTypeDiscovery SAPConfigurationType = "Discovery" + // SAPConfigurationTypeDiscovery - Existing SAP system will be registered. + SAPConfigurationTypeDiscovery SAPConfigurationType = "Discovery" ) // PossibleSAPConfigurationTypeValues returns the possible values for the SAPConfigurationType const type. @@ -254,6 +235,7 @@ func PossibleSAPConfigurationTypeValues() []SAPConfigurationType { type SAPDatabaseScaleMethod string const ( + // SAPDatabaseScaleMethodScaleUp - ScaleUp Hana Database deployment type SAPDatabaseScaleMethodScaleUp SAPDatabaseScaleMethod = "ScaleUp" ) @@ -268,7 +250,9 @@ func PossibleSAPDatabaseScaleMethodValues() []SAPDatabaseScaleMethod { type SAPDatabaseType string const ( - SAPDatabaseTypeDB2 SAPDatabaseType = "DB2" + // SAPDatabaseTypeDB2 - DB2 database type of the SAP system. + SAPDatabaseTypeDB2 SAPDatabaseType = "DB2" + // SAPDatabaseTypeHANA - HANA Database type of SAP system. SAPDatabaseTypeHANA SAPDatabaseType = "HANA" ) @@ -284,8 +268,10 @@ func PossibleSAPDatabaseTypeValues() []SAPDatabaseType { type SAPDeploymentType string const ( + // SAPDeploymentTypeSingleServer - SAP Single server deployment type. SAPDeploymentTypeSingleServer SAPDeploymentType = "SingleServer" - SAPDeploymentTypeThreeTier SAPDeploymentType = "ThreeTier" + // SAPDeploymentTypeThreeTier - SAP Distributed deployment type. + SAPDeploymentTypeThreeTier SAPDeploymentType = "ThreeTier" ) // PossibleSAPDeploymentTypeValues returns the possible values for the SAPDeploymentType const type. @@ -300,8 +286,10 @@ func PossibleSAPDeploymentTypeValues() []SAPDeploymentType { type SAPEnvironmentType string const ( + // SAPEnvironmentTypeNonProd - Non Production SAP system. SAPEnvironmentTypeNonProd SAPEnvironmentType = "NonProd" - SAPEnvironmentTypeProd SAPEnvironmentType = "Prod" + // SAPEnvironmentTypeProd - Production SAP system. + SAPEnvironmentTypeProd SAPEnvironmentType = "Prod" ) // PossibleSAPEnvironmentTypeValues returns the possible values for the SAPEnvironmentType const type. @@ -316,10 +304,14 @@ func PossibleSAPEnvironmentTypeValues() []SAPEnvironmentType { type SAPHealthState string const ( - SAPHealthStateDegraded SAPHealthState = "Degraded" - SAPHealthStateHealthy SAPHealthState = "Healthy" + // SAPHealthStateDegraded - SAP System health is degraded. + SAPHealthStateDegraded SAPHealthState = "Degraded" + // SAPHealthStateHealthy - SAP System health is healthy. + SAPHealthStateHealthy SAPHealthState = "Healthy" + // SAPHealthStateUnhealthy - SAP System is unhealthy. SAPHealthStateUnhealthy SAPHealthState = "Unhealthy" - SAPHealthStateUnknown SAPHealthState = "Unknown" + // SAPHealthStateUnknown - SAP System health is unknown. + SAPHealthStateUnknown SAPHealthState = "Unknown" ) // PossibleSAPHealthStateValues returns the possible values for the SAPHealthState const type. @@ -336,7 +328,9 @@ func PossibleSAPHealthStateValues() []SAPHealthState { type SAPHighAvailabilityType string const ( - SAPHighAvailabilityTypeAvailabilitySet SAPHighAvailabilityType = "AvailabilitySet" + // SAPHighAvailabilityTypeAvailabilitySet - HA deployment with availability sets. + SAPHighAvailabilityTypeAvailabilitySet SAPHighAvailabilityType = "AvailabilitySet" + // SAPHighAvailabilityTypeAvailabilityZone - HA deployment with availability zones. SAPHighAvailabilityTypeAvailabilityZone SAPHighAvailabilityType = "AvailabilityZone" ) @@ -352,8 +346,11 @@ func PossibleSAPHighAvailabilityTypeValues() []SAPHighAvailabilityType { type SAPProductType string const ( - SAPProductTypeECC SAPProductType = "ECC" - SAPProductTypeOther SAPProductType = "Other" + // SAPProductTypeECC - SAP Product ECC. + SAPProductTypeECC SAPProductType = "ECC" + // SAPProductTypeOther - SAP Products other than the ones listed. + SAPProductTypeOther SAPProductType = "Other" + // SAPProductTypeS4HANA - SAP Product S4HANA. SAPProductTypeS4HANA SAPProductType = "S4HANA" ) @@ -370,9 +367,12 @@ func PossibleSAPProductTypeValues() []SAPProductType { type SAPSoftwareInstallationType string const ( - SAPSoftwareInstallationTypeExternal SAPSoftwareInstallationType = "External" + // SAPSoftwareInstallationTypeExternal - External software installation type. + SAPSoftwareInstallationTypeExternal SAPSoftwareInstallationType = "External" + // SAPSoftwareInstallationTypeSAPInstallWithoutOSConfig - SAP Install without OS Config. SAPSoftwareInstallationTypeSAPInstallWithoutOSConfig SAPSoftwareInstallationType = "SAPInstallWithoutOSConfig" - SAPSoftwareInstallationTypeServiceInitiated SAPSoftwareInstallationType = "ServiceInitiated" + // SAPSoftwareInstallationTypeServiceInitiated - SAP Install managed by service. + SAPSoftwareInstallationTypeServiceInitiated SAPSoftwareInstallationType = "ServiceInitiated" ) // PossibleSAPSoftwareInstallationTypeValues returns the possible values for the SAPSoftwareInstallationType const type. @@ -384,23 +384,55 @@ func PossibleSAPSoftwareInstallationTypeValues() []SAPSoftwareInstallationType { } } +// SAPVirtualInstanceIdentityType - Type of managed service identity (where only None and UserAssigned types are allowed). +type SAPVirtualInstanceIdentityType string + +const ( + // SAPVirtualInstanceIdentityTypeNone - No managed identity. + SAPVirtualInstanceIdentityTypeNone SAPVirtualInstanceIdentityType = "None" + // SAPVirtualInstanceIdentityTypeUserAssigned - User assigned managed identity. + SAPVirtualInstanceIdentityTypeUserAssigned SAPVirtualInstanceIdentityType = "UserAssigned" +) + +// PossibleSAPVirtualInstanceIdentityTypeValues returns the possible values for the SAPVirtualInstanceIdentityType const type. +func PossibleSAPVirtualInstanceIdentityTypeValues() []SAPVirtualInstanceIdentityType { + return []SAPVirtualInstanceIdentityType{ + SAPVirtualInstanceIdentityTypeNone, + SAPVirtualInstanceIdentityTypeUserAssigned, + } +} + // SAPVirtualInstanceState - Defines the Virtual Instance for SAP state. type SAPVirtualInstanceState string const ( - SAPVirtualInstanceStateACSSInstallationBlocked SAPVirtualInstanceState = "ACSSInstallationBlocked" - SAPVirtualInstanceStateDiscoveryFailed SAPVirtualInstanceState = "DiscoveryFailed" - SAPVirtualInstanceStateDiscoveryInProgress SAPVirtualInstanceState = "DiscoveryInProgress" - SAPVirtualInstanceStateDiscoveryPending SAPVirtualInstanceState = "DiscoveryPending" - SAPVirtualInstanceStateInfrastructureDeploymentFailed SAPVirtualInstanceState = "InfrastructureDeploymentFailed" + // SAPVirtualInstanceStateACSSInstallationBlocked - ACSS installation cannot proceed. + SAPVirtualInstanceStateACSSInstallationBlocked SAPVirtualInstanceState = "ACSSInstallationBlocked" + // SAPVirtualInstanceStateDiscoveryFailed - Registration has failed. + SAPVirtualInstanceStateDiscoveryFailed SAPVirtualInstanceState = "DiscoveryFailed" + // SAPVirtualInstanceStateDiscoveryInProgress - Registration is in progress. + SAPVirtualInstanceStateDiscoveryInProgress SAPVirtualInstanceState = "DiscoveryInProgress" + // SAPVirtualInstanceStateDiscoveryPending - Registration has not started. + SAPVirtualInstanceStateDiscoveryPending SAPVirtualInstanceState = "DiscoveryPending" + // SAPVirtualInstanceStateInfrastructureDeploymentFailed - Infrastructure deployment has failed. + SAPVirtualInstanceStateInfrastructureDeploymentFailed SAPVirtualInstanceState = "InfrastructureDeploymentFailed" + // SAPVirtualInstanceStateInfrastructureDeploymentInProgress - Infrastructure deployment is in progress. SAPVirtualInstanceStateInfrastructureDeploymentInProgress SAPVirtualInstanceState = "InfrastructureDeploymentInProgress" - SAPVirtualInstanceStateInfrastructureDeploymentPending SAPVirtualInstanceState = "InfrastructureDeploymentPending" - SAPVirtualInstanceStateRegistrationComplete SAPVirtualInstanceState = "RegistrationComplete" - SAPVirtualInstanceStateSoftwareDetectionFailed SAPVirtualInstanceState = "SoftwareDetectionFailed" - SAPVirtualInstanceStateSoftwareDetectionInProgress SAPVirtualInstanceState = "SoftwareDetectionInProgress" - SAPVirtualInstanceStateSoftwareInstallationFailed SAPVirtualInstanceState = "SoftwareInstallationFailed" - SAPVirtualInstanceStateSoftwareInstallationInProgress SAPVirtualInstanceState = "SoftwareInstallationInProgress" - SAPVirtualInstanceStateSoftwareInstallationPending SAPVirtualInstanceState = "SoftwareInstallationPending" + // SAPVirtualInstanceStateInfrastructureDeploymentPending - Infrastructure is not yet deployed. + SAPVirtualInstanceStateInfrastructureDeploymentPending SAPVirtualInstanceState = "InfrastructureDeploymentPending" + // SAPVirtualInstanceStateRegistrationComplete - Registration is complete. + SAPVirtualInstanceStateRegistrationComplete SAPVirtualInstanceState = "RegistrationComplete" + // SAPVirtualInstanceStateSoftwareDetectionFailed - Software detection failed. + SAPVirtualInstanceStateSoftwareDetectionFailed SAPVirtualInstanceState = "SoftwareDetectionFailed" + // SAPVirtualInstanceStateSoftwareDetectionInProgress - Software detection is in progress. + SAPVirtualInstanceStateSoftwareDetectionInProgress SAPVirtualInstanceState = "SoftwareDetectionInProgress" + // SAPVirtualInstanceStateSoftwareInstallationFailed - Software installation failed. + SAPVirtualInstanceStateSoftwareInstallationFailed SAPVirtualInstanceState = "SoftwareInstallationFailed" + // SAPVirtualInstanceStateSoftwareInstallationInProgress - Software installation is in progress. + SAPVirtualInstanceStateSoftwareInstallationInProgress SAPVirtualInstanceState = "SoftwareInstallationInProgress" + // SAPVirtualInstanceStateSoftwareInstallationPending - Infrastructure deployment is successful. Software installation is + // pending. + SAPVirtualInstanceStateSoftwareInstallationPending SAPVirtualInstanceState = "SoftwareInstallationPending" ) // PossibleSAPVirtualInstanceStateValues returns the possible values for the SAPVirtualInstanceState const type. @@ -426,13 +458,20 @@ func PossibleSAPVirtualInstanceStateValues() []SAPVirtualInstanceState { type SAPVirtualInstanceStatus string const ( - SAPVirtualInstanceStatusOffline SAPVirtualInstanceStatus = "Offline" + // SAPVirtualInstanceStatusOffline - SAP system is offline. + SAPVirtualInstanceStatusOffline SAPVirtualInstanceStatus = "Offline" + // SAPVirtualInstanceStatusPartiallyRunning - SAP system is partially running. SAPVirtualInstanceStatusPartiallyRunning SAPVirtualInstanceStatus = "PartiallyRunning" - SAPVirtualInstanceStatusRunning SAPVirtualInstanceStatus = "Running" - SAPVirtualInstanceStatusSoftShutdown SAPVirtualInstanceStatus = "SoftShutdown" - SAPVirtualInstanceStatusStarting SAPVirtualInstanceStatus = "Starting" - SAPVirtualInstanceStatusStopping SAPVirtualInstanceStatus = "Stopping" - SAPVirtualInstanceStatusUnavailable SAPVirtualInstanceStatus = "Unavailable" + // SAPVirtualInstanceStatusRunning - SAP system is running. + SAPVirtualInstanceStatusRunning SAPVirtualInstanceStatus = "Running" + // SAPVirtualInstanceStatusSoftShutdown - Soft shutdown of SAP system is initiated. + SAPVirtualInstanceStatusSoftShutdown SAPVirtualInstanceStatus = "SoftShutdown" + // SAPVirtualInstanceStatusStarting - SAP system is getting started. + SAPVirtualInstanceStatusStarting SAPVirtualInstanceStatus = "Starting" + // SAPVirtualInstanceStatusStopping - SAP system is being stopped. + SAPVirtualInstanceStatusStopping SAPVirtualInstanceStatus = "Stopping" + // SAPVirtualInstanceStatusUnavailable - SAP system status is unavailable. + SAPVirtualInstanceStatusUnavailable SAPVirtualInstanceStatus = "Unavailable" ) // PossibleSAPVirtualInstanceStatusValues returns the possible values for the SAPVirtualInstanceStatus const type. @@ -452,12 +491,18 @@ func PossibleSAPVirtualInstanceStatusValues() []SAPVirtualInstanceStatus { type SapVirtualInstanceProvisioningState string const ( - SapVirtualInstanceProvisioningStateCanceled SapVirtualInstanceProvisioningState = "Canceled" - SapVirtualInstanceProvisioningStateCreating SapVirtualInstanceProvisioningState = "Creating" - SapVirtualInstanceProvisioningStateDeleting SapVirtualInstanceProvisioningState = "Deleting" - SapVirtualInstanceProvisioningStateFailed SapVirtualInstanceProvisioningState = "Failed" + // SapVirtualInstanceProvisioningStateCanceled - ACSS Canceled provisioning state. + SapVirtualInstanceProvisioningStateCanceled SapVirtualInstanceProvisioningState = "Canceled" + // SapVirtualInstanceProvisioningStateCreating - ACSS Creating provisioning state. + SapVirtualInstanceProvisioningStateCreating SapVirtualInstanceProvisioningState = "Creating" + // SapVirtualInstanceProvisioningStateDeleting - ACSS Deleting provisioning state. + SapVirtualInstanceProvisioningStateDeleting SapVirtualInstanceProvisioningState = "Deleting" + // SapVirtualInstanceProvisioningStateFailed - ACSS Failed provisioning state. + SapVirtualInstanceProvisioningStateFailed SapVirtualInstanceProvisioningState = "Failed" + // SapVirtualInstanceProvisioningStateSucceeded - ACSS succeeded provisioning state. SapVirtualInstanceProvisioningStateSucceeded SapVirtualInstanceProvisioningState = "Succeeded" - SapVirtualInstanceProvisioningStateUpdating SapVirtualInstanceProvisioningState = "Updating" + // SapVirtualInstanceProvisioningStateUpdating - ACSS updating provisioning state. + SapVirtualInstanceProvisioningStateUpdating SapVirtualInstanceProvisioningState = "Updating" ) // PossibleSapVirtualInstanceProvisioningStateValues returns the possible values for the SapVirtualInstanceProvisioningState const type. diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/internal.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/internal.go index 5f75802a569e..7425b6a669e2 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/internal.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/internal.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -14,6 +10,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/sapapplicationserverinstances_server.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/sapapplicationserverinstances_server.go index fde564c462de..7613fd80fbcb 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/sapapplicationserverinstances_server.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/sapapplicationserverinstances_server.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -27,10 +23,10 @@ import ( type SAPApplicationServerInstancesServer struct { // BeginCreate is the fake for method SAPApplicationServerInstancesClient.BeginCreate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, body armworkloadssapvirtualinstance.SAPApplicationServerInstance, options *armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientBeginCreateOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientCreateResponse], errResp azfake.ErrorResponder) + BeginCreate func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, resource armworkloadssapvirtualinstance.SAPApplicationServerInstance, options *armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientBeginCreateOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientCreateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method SAPApplicationServerInstancesClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, options *armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientBeginDeleteOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method SAPApplicationServerInstancesClient.Get @@ -41,17 +37,17 @@ type SAPApplicationServerInstancesServer struct { // HTTP status codes to indicate success: http.StatusOK NewListPager func(resourceGroupName string, sapVirtualInstanceName string, options *armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientListOptions) (resp azfake.PagerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientListResponse]) - // BeginStartInstance is the fake for method SAPApplicationServerInstancesClient.BeginStartInstance + // BeginStart is the fake for method SAPApplicationServerInstancesClient.BeginStart // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginStartInstance func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, options *armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientBeginStartInstanceOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientStartInstanceResponse], errResp azfake.ErrorResponder) + BeginStart func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, options *armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientBeginStartOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientStartResponse], errResp azfake.ErrorResponder) - // BeginStopInstance is the fake for method SAPApplicationServerInstancesClient.BeginStopInstance + // BeginStop is the fake for method SAPApplicationServerInstancesClient.BeginStop // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginStopInstance func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, options *armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientBeginStopInstanceOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientStopInstanceResponse], errResp azfake.ErrorResponder) + BeginStop func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, options *armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientBeginStopOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientStopResponse], errResp azfake.ErrorResponder) // Update is the fake for method SAPApplicationServerInstancesClient.Update // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, body armworkloadssapvirtualinstance.UpdateSAPApplicationInstanceRequest, options *armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientUpdateOptions) (resp azfake.Responder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientUpdateResponse], errResp azfake.ErrorResponder) + Update func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, properties armworkloadssapvirtualinstance.UpdateSAPApplicationInstanceRequest, options *armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientUpdateOptions) (resp azfake.Responder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientUpdateResponse], errResp azfake.ErrorResponder) } // NewSAPApplicationServerInstancesServerTransport creates a new instance of SAPApplicationServerInstancesServerTransport with the provided implementation. @@ -59,24 +55,24 @@ type SAPApplicationServerInstancesServer struct { // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewSAPApplicationServerInstancesServerTransport(srv *SAPApplicationServerInstancesServer) *SAPApplicationServerInstancesServerTransport { return &SAPApplicationServerInstancesServerTransport{ - srv: srv, - beginCreate: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientCreateResponse]](), - beginDelete: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientDeleteResponse]](), - newListPager: newTracker[azfake.PagerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientListResponse]](), - beginStartInstance: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientStartInstanceResponse]](), - beginStopInstance: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientStopInstanceResponse]](), + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientCreateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientListResponse]](), + beginStart: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientStartResponse]](), + beginStop: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientStopResponse]](), } } // SAPApplicationServerInstancesServerTransport connects instances of armworkloadssapvirtualinstance.SAPApplicationServerInstancesClient to instances of SAPApplicationServerInstancesServer. // Don't use this type directly, use NewSAPApplicationServerInstancesServerTransport instead. type SAPApplicationServerInstancesServerTransport struct { - srv *SAPApplicationServerInstancesServer - beginCreate *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientCreateResponse]] - beginDelete *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientDeleteResponse]] - newListPager *tracker[azfake.PagerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientListResponse]] - beginStartInstance *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientStartInstanceResponse]] - beginStopInstance *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientStopInstanceResponse]] + srv *SAPApplicationServerInstancesServer + beginCreate *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientCreateResponse]] + beginDelete *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientListResponse]] + beginStart *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientStartResponse]] + beginStop *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientStopResponse]] } // Do implements the policy.Transporter interface for SAPApplicationServerInstancesServerTransport. @@ -87,33 +83,52 @@ func (s *SAPApplicationServerInstancesServerTransport) Do(req *http.Request) (*h return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "SAPApplicationServerInstancesClient.BeginCreate": - resp, err = s.dispatchBeginCreate(req) - case "SAPApplicationServerInstancesClient.BeginDelete": - resp, err = s.dispatchBeginDelete(req) - case "SAPApplicationServerInstancesClient.Get": - resp, err = s.dispatchGet(req) - case "SAPApplicationServerInstancesClient.NewListPager": - resp, err = s.dispatchNewListPager(req) - case "SAPApplicationServerInstancesClient.BeginStartInstance": - resp, err = s.dispatchBeginStartInstance(req) - case "SAPApplicationServerInstancesClient.BeginStopInstance": - resp, err = s.dispatchBeginStopInstance(req) - case "SAPApplicationServerInstancesClient.Update": - resp, err = s.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return s.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err - } +func (s *SAPApplicationServerInstancesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - return resp, nil + go func() { + var intercepted bool + var res result + if sapApplicationServerInstancesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = sapApplicationServerInstancesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SAPApplicationServerInstancesClient.BeginCreate": + res.resp, res.err = s.dispatchBeginCreate(req) + case "SAPApplicationServerInstancesClient.BeginDelete": + res.resp, res.err = s.dispatchBeginDelete(req) + case "SAPApplicationServerInstancesClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "SAPApplicationServerInstancesClient.NewListPager": + res.resp, res.err = s.dispatchNewListPager(req) + case "SAPApplicationServerInstancesClient.BeginStart": + res.resp, res.err = s.dispatchBeginStart(req) + case "SAPApplicationServerInstancesClient.BeginStop": + res.resp, res.err = s.dispatchBeginStop(req) + case "SAPApplicationServerInstancesClient.Update": + res.resp, res.err = s.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *SAPApplicationServerInstancesServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { @@ -205,9 +220,9 @@ func (s *SAPApplicationServerInstancesServerTransport) dispatchBeginDelete(req * return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { s.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { s.beginDelete.remove(req) @@ -294,12 +309,12 @@ func (s *SAPApplicationServerInstancesServerTransport) dispatchNewListPager(req return resp, nil } -func (s *SAPApplicationServerInstancesServerTransport) dispatchBeginStartInstance(req *http.Request) (*http.Response, error) { - if s.srv.BeginStartInstance == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginStartInstance not implemented")} +func (s *SAPApplicationServerInstancesServerTransport) dispatchBeginStart(req *http.Request) (*http.Response, error) { + if s.srv.BeginStart == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginStart not implemented")} } - beginStartInstance := s.beginStartInstance.get(req) - if beginStartInstance == nil { + beginStart := s.beginStart.get(req) + if beginStart == nil { const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/sapVirtualInstances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/applicationInstances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/start` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) @@ -322,42 +337,42 @@ func (s *SAPApplicationServerInstancesServerTransport) dispatchBeginStartInstanc if err != nil { return nil, err } - var options *armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientBeginStartInstanceOptions + var options *armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientBeginStartOptions if !reflect.ValueOf(body).IsZero() { - options = &armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientBeginStartInstanceOptions{ + options = &armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientBeginStartOptions{ Body: &body, } } - respr, errRespr := s.srv.BeginStartInstance(req.Context(), resourceGroupNameParam, sapVirtualInstanceNameParam, applicationInstanceNameParam, options) + respr, errRespr := s.srv.BeginStart(req.Context(), resourceGroupNameParam, sapVirtualInstanceNameParam, applicationInstanceNameParam, options) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } - beginStartInstance = &respr - s.beginStartInstance.add(req, beginStartInstance) + beginStart = &respr + s.beginStart.add(req, beginStart) } - resp, err := server.PollerResponderNext(beginStartInstance, req) + resp, err := server.PollerResponderNext(beginStart, req) if err != nil { return nil, err } if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - s.beginStartInstance.remove(req) + s.beginStart.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} } - if !server.PollerResponderMore(beginStartInstance) { - s.beginStartInstance.remove(req) + if !server.PollerResponderMore(beginStart) { + s.beginStart.remove(req) } return resp, nil } -func (s *SAPApplicationServerInstancesServerTransport) dispatchBeginStopInstance(req *http.Request) (*http.Response, error) { - if s.srv.BeginStopInstance == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginStopInstance not implemented")} +func (s *SAPApplicationServerInstancesServerTransport) dispatchBeginStop(req *http.Request) (*http.Response, error) { + if s.srv.BeginStop == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginStop not implemented")} } - beginStopInstance := s.beginStopInstance.get(req) - if beginStopInstance == nil { + beginStop := s.beginStop.get(req) + if beginStop == nil { const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/sapVirtualInstances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/applicationInstances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/stop` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) @@ -380,31 +395,31 @@ func (s *SAPApplicationServerInstancesServerTransport) dispatchBeginStopInstance if err != nil { return nil, err } - var options *armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientBeginStopInstanceOptions + var options *armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientBeginStopOptions if !reflect.ValueOf(body).IsZero() { - options = &armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientBeginStopInstanceOptions{ + options = &armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientBeginStopOptions{ Body: &body, } } - respr, errRespr := s.srv.BeginStopInstance(req.Context(), resourceGroupNameParam, sapVirtualInstanceNameParam, applicationInstanceNameParam, options) + respr, errRespr := s.srv.BeginStop(req.Context(), resourceGroupNameParam, sapVirtualInstanceNameParam, applicationInstanceNameParam, options) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } - beginStopInstance = &respr - s.beginStopInstance.add(req, beginStopInstance) + beginStop = &respr + s.beginStop.add(req, beginStop) } - resp, err := server.PollerResponderNext(beginStopInstance, req) + resp, err := server.PollerResponderNext(beginStop, req) if err != nil { return nil, err } if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - s.beginStopInstance.remove(req) + s.beginStop.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} } - if !server.PollerResponderMore(beginStopInstance) { - s.beginStopInstance.remove(req) + if !server.PollerResponderMore(beginStop) { + s.beginStop.remove(req) } return resp, nil @@ -450,3 +465,9 @@ func (s *SAPApplicationServerInstancesServerTransport) dispatchUpdate(req *http. } return resp, nil } + +// set this to conditionally intercept incoming requests to SAPApplicationServerInstancesServerTransport +var sapApplicationServerInstancesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/sapcentralinstances_server.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/sapcentralserverinstances_server.go similarity index 60% rename from sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/sapcentralinstances_server.go rename to sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/sapcentralserverinstances_server.go index b4c64a343374..292a935256be 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/sapcentralinstances_server.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/sapcentralserverinstances_server.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -23,100 +19,119 @@ import ( "regexp" ) -// SAPCentralInstancesServer is a fake server for instances of the armworkloadssapvirtualinstance.SAPCentralInstancesClient type. -type SAPCentralInstancesServer struct { - // BeginCreate is the fake for method SAPCentralInstancesClient.BeginCreate +// SAPCentralServerInstancesServer is a fake server for instances of the armworkloadssapvirtualinstance.SAPCentralServerInstancesClient type. +type SAPCentralServerInstancesServer struct { + // BeginCreate is the fake for method SAPCentralServerInstancesClient.BeginCreate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, body armworkloadssapvirtualinstance.SAPCentralServerInstance, options *armworkloadssapvirtualinstance.SAPCentralInstancesClientBeginCreateOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralInstancesClientCreateResponse], errResp azfake.ErrorResponder) + BeginCreate func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, resource armworkloadssapvirtualinstance.SAPCentralServerInstance, options *armworkloadssapvirtualinstance.SAPCentralServerInstancesClientBeginCreateOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralServerInstancesClientCreateResponse], errResp azfake.ErrorResponder) - // BeginDelete is the fake for method SAPCentralInstancesClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *armworkloadssapvirtualinstance.SAPCentralInstancesClientBeginDeleteOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralInstancesClientDeleteResponse], errResp azfake.ErrorResponder) + // BeginDelete is the fake for method SAPCentralServerInstancesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *armworkloadssapvirtualinstance.SAPCentralServerInstancesClientBeginDeleteOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralServerInstancesClientDeleteResponse], errResp azfake.ErrorResponder) - // Get is the fake for method SAPCentralInstancesClient.Get + // Get is the fake for method SAPCentralServerInstancesClient.Get // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *armworkloadssapvirtualinstance.SAPCentralInstancesClientGetOptions) (resp azfake.Responder[armworkloadssapvirtualinstance.SAPCentralInstancesClientGetResponse], errResp azfake.ErrorResponder) + Get func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *armworkloadssapvirtualinstance.SAPCentralServerInstancesClientGetOptions) (resp azfake.Responder[armworkloadssapvirtualinstance.SAPCentralServerInstancesClientGetResponse], errResp azfake.ErrorResponder) - // NewListPager is the fake for method SAPCentralInstancesClient.NewListPager + // NewListPager is the fake for method SAPCentralServerInstancesClient.NewListPager // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, sapVirtualInstanceName string, options *armworkloadssapvirtualinstance.SAPCentralInstancesClientListOptions) (resp azfake.PagerResponder[armworkloadssapvirtualinstance.SAPCentralInstancesClientListResponse]) + NewListPager func(resourceGroupName string, sapVirtualInstanceName string, options *armworkloadssapvirtualinstance.SAPCentralServerInstancesClientListOptions) (resp azfake.PagerResponder[armworkloadssapvirtualinstance.SAPCentralServerInstancesClientListResponse]) - // BeginStartInstance is the fake for method SAPCentralInstancesClient.BeginStartInstance + // BeginStart is the fake for method SAPCentralServerInstancesClient.BeginStart // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginStartInstance func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *armworkloadssapvirtualinstance.SAPCentralInstancesClientBeginStartInstanceOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralInstancesClientStartInstanceResponse], errResp azfake.ErrorResponder) + BeginStart func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *armworkloadssapvirtualinstance.SAPCentralServerInstancesClientBeginStartOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralServerInstancesClientStartResponse], errResp azfake.ErrorResponder) - // BeginStopInstance is the fake for method SAPCentralInstancesClient.BeginStopInstance + // BeginStop is the fake for method SAPCentralServerInstancesClient.BeginStop // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginStopInstance func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *armworkloadssapvirtualinstance.SAPCentralInstancesClientBeginStopInstanceOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralInstancesClientStopInstanceResponse], errResp azfake.ErrorResponder) + BeginStop func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *armworkloadssapvirtualinstance.SAPCentralServerInstancesClientBeginStopOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralServerInstancesClientStopResponse], errResp azfake.ErrorResponder) - // Update is the fake for method SAPCentralInstancesClient.Update + // Update is the fake for method SAPCentralServerInstancesClient.Update // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, body armworkloadssapvirtualinstance.UpdateSAPCentralInstanceRequest, options *armworkloadssapvirtualinstance.SAPCentralInstancesClientUpdateOptions) (resp azfake.Responder[armworkloadssapvirtualinstance.SAPCentralInstancesClientUpdateResponse], errResp azfake.ErrorResponder) + Update func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, properties armworkloadssapvirtualinstance.UpdateSAPCentralInstanceRequest, options *armworkloadssapvirtualinstance.SAPCentralServerInstancesClientUpdateOptions) (resp azfake.Responder[armworkloadssapvirtualinstance.SAPCentralServerInstancesClientUpdateResponse], errResp azfake.ErrorResponder) } -// NewSAPCentralInstancesServerTransport creates a new instance of SAPCentralInstancesServerTransport with the provided implementation. -// The returned SAPCentralInstancesServerTransport instance is connected to an instance of armworkloadssapvirtualinstance.SAPCentralInstancesClient via the +// NewSAPCentralServerInstancesServerTransport creates a new instance of SAPCentralServerInstancesServerTransport with the provided implementation. +// The returned SAPCentralServerInstancesServerTransport instance is connected to an instance of armworkloadssapvirtualinstance.SAPCentralServerInstancesClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewSAPCentralInstancesServerTransport(srv *SAPCentralInstancesServer) *SAPCentralInstancesServerTransport { - return &SAPCentralInstancesServerTransport{ - srv: srv, - beginCreate: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralInstancesClientCreateResponse]](), - beginDelete: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralInstancesClientDeleteResponse]](), - newListPager: newTracker[azfake.PagerResponder[armworkloadssapvirtualinstance.SAPCentralInstancesClientListResponse]](), - beginStartInstance: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralInstancesClientStartInstanceResponse]](), - beginStopInstance: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralInstancesClientStopInstanceResponse]](), +func NewSAPCentralServerInstancesServerTransport(srv *SAPCentralServerInstancesServer) *SAPCentralServerInstancesServerTransport { + return &SAPCentralServerInstancesServerTransport{ + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralServerInstancesClientCreateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralServerInstancesClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armworkloadssapvirtualinstance.SAPCentralServerInstancesClientListResponse]](), + beginStart: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralServerInstancesClientStartResponse]](), + beginStop: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralServerInstancesClientStopResponse]](), } } -// SAPCentralInstancesServerTransport connects instances of armworkloadssapvirtualinstance.SAPCentralInstancesClient to instances of SAPCentralInstancesServer. -// Don't use this type directly, use NewSAPCentralInstancesServerTransport instead. -type SAPCentralInstancesServerTransport struct { - srv *SAPCentralInstancesServer - beginCreate *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralInstancesClientCreateResponse]] - beginDelete *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralInstancesClientDeleteResponse]] - newListPager *tracker[azfake.PagerResponder[armworkloadssapvirtualinstance.SAPCentralInstancesClientListResponse]] - beginStartInstance *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralInstancesClientStartInstanceResponse]] - beginStopInstance *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralInstancesClientStopInstanceResponse]] +// SAPCentralServerInstancesServerTransport connects instances of armworkloadssapvirtualinstance.SAPCentralServerInstancesClient to instances of SAPCentralServerInstancesServer. +// Don't use this type directly, use NewSAPCentralServerInstancesServerTransport instead. +type SAPCentralServerInstancesServerTransport struct { + srv *SAPCentralServerInstancesServer + beginCreate *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralServerInstancesClientCreateResponse]] + beginDelete *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralServerInstancesClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armworkloadssapvirtualinstance.SAPCentralServerInstancesClientListResponse]] + beginStart *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralServerInstancesClientStartResponse]] + beginStop *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralServerInstancesClientStopResponse]] } -// Do implements the policy.Transporter interface for SAPCentralInstancesServerTransport. -func (s *SAPCentralInstancesServerTransport) Do(req *http.Request) (*http.Response, error) { +// Do implements the policy.Transporter interface for SAPCentralServerInstancesServerTransport. +func (s *SAPCentralServerInstancesServerTransport) 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 "SAPCentralInstancesClient.BeginCreate": - resp, err = s.dispatchBeginCreate(req) - case "SAPCentralInstancesClient.BeginDelete": - resp, err = s.dispatchBeginDelete(req) - case "SAPCentralInstancesClient.Get": - resp, err = s.dispatchGet(req) - case "SAPCentralInstancesClient.NewListPager": - resp, err = s.dispatchNewListPager(req) - case "SAPCentralInstancesClient.BeginStartInstance": - resp, err = s.dispatchBeginStartInstance(req) - case "SAPCentralInstancesClient.BeginStopInstance": - resp, err = s.dispatchBeginStopInstance(req) - case "SAPCentralInstancesClient.Update": - resp, err = s.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return s.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err - } +func (s *SAPCentralServerInstancesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - return resp, nil + go func() { + var intercepted bool + var res result + if sapCentralServerInstancesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = sapCentralServerInstancesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SAPCentralServerInstancesClient.BeginCreate": + res.resp, res.err = s.dispatchBeginCreate(req) + case "SAPCentralServerInstancesClient.BeginDelete": + res.resp, res.err = s.dispatchBeginDelete(req) + case "SAPCentralServerInstancesClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "SAPCentralServerInstancesClient.NewListPager": + res.resp, res.err = s.dispatchNewListPager(req) + case "SAPCentralServerInstancesClient.BeginStart": + res.resp, res.err = s.dispatchBeginStart(req) + case "SAPCentralServerInstancesClient.BeginStop": + res.resp, res.err = s.dispatchBeginStop(req) + case "SAPCentralServerInstancesClient.Update": + res.resp, res.err = s.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } -func (s *SAPCentralInstancesServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { +func (s *SAPCentralServerInstancesServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { if s.srv.BeginCreate == nil { return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} } @@ -168,7 +183,7 @@ func (s *SAPCentralInstancesServerTransport) dispatchBeginCreate(req *http.Reque return resp, nil } -func (s *SAPCentralInstancesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { +func (s *SAPCentralServerInstancesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { if s.srv.BeginDelete == nil { return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} } @@ -205,9 +220,9 @@ func (s *SAPCentralInstancesServerTransport) dispatchBeginDelete(req *http.Reque return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { s.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { s.beginDelete.remove(req) @@ -216,7 +231,7 @@ func (s *SAPCentralInstancesServerTransport) dispatchBeginDelete(req *http.Reque return resp, nil } -func (s *SAPCentralInstancesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { +func (s *SAPCentralServerInstancesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { if s.srv.Get == nil { return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} } @@ -253,7 +268,7 @@ func (s *SAPCentralInstancesServerTransport) dispatchGet(req *http.Request) (*ht return resp, nil } -func (s *SAPCentralInstancesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { +func (s *SAPCentralServerInstancesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { if s.srv.NewListPager == nil { return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} } @@ -276,7 +291,7 @@ func (s *SAPCentralInstancesServerTransport) dispatchNewListPager(req *http.Requ resp := s.srv.NewListPager(resourceGroupNameParam, sapVirtualInstanceNameParam, nil) newListPager = &resp s.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armworkloadssapvirtualinstance.SAPCentralInstancesClientListResponse, createLink func() string) { + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armworkloadssapvirtualinstance.SAPCentralServerInstancesClientListResponse, createLink func() string) { page.NextLink = to.Ptr(createLink()) }) } @@ -294,12 +309,12 @@ func (s *SAPCentralInstancesServerTransport) dispatchNewListPager(req *http.Requ return resp, nil } -func (s *SAPCentralInstancesServerTransport) dispatchBeginStartInstance(req *http.Request) (*http.Response, error) { - if s.srv.BeginStartInstance == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginStartInstance not implemented")} +func (s *SAPCentralServerInstancesServerTransport) dispatchBeginStart(req *http.Request) (*http.Response, error) { + if s.srv.BeginStart == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginStart not implemented")} } - beginStartInstance := s.beginStartInstance.get(req) - if beginStartInstance == nil { + beginStart := s.beginStart.get(req) + if beginStart == nil { const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/sapVirtualInstances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/centralInstances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/start` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) @@ -322,42 +337,42 @@ func (s *SAPCentralInstancesServerTransport) dispatchBeginStartInstance(req *htt if err != nil { return nil, err } - var options *armworkloadssapvirtualinstance.SAPCentralInstancesClientBeginStartInstanceOptions + var options *armworkloadssapvirtualinstance.SAPCentralServerInstancesClientBeginStartOptions if !reflect.ValueOf(body).IsZero() { - options = &armworkloadssapvirtualinstance.SAPCentralInstancesClientBeginStartInstanceOptions{ + options = &armworkloadssapvirtualinstance.SAPCentralServerInstancesClientBeginStartOptions{ Body: &body, } } - respr, errRespr := s.srv.BeginStartInstance(req.Context(), resourceGroupNameParam, sapVirtualInstanceNameParam, centralInstanceNameParam, options) + respr, errRespr := s.srv.BeginStart(req.Context(), resourceGroupNameParam, sapVirtualInstanceNameParam, centralInstanceNameParam, options) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } - beginStartInstance = &respr - s.beginStartInstance.add(req, beginStartInstance) + beginStart = &respr + s.beginStart.add(req, beginStart) } - resp, err := server.PollerResponderNext(beginStartInstance, req) + resp, err := server.PollerResponderNext(beginStart, req) if err != nil { return nil, err } if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - s.beginStartInstance.remove(req) + s.beginStart.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} } - if !server.PollerResponderMore(beginStartInstance) { - s.beginStartInstance.remove(req) + if !server.PollerResponderMore(beginStart) { + s.beginStart.remove(req) } return resp, nil } -func (s *SAPCentralInstancesServerTransport) dispatchBeginStopInstance(req *http.Request) (*http.Response, error) { - if s.srv.BeginStopInstance == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginStopInstance not implemented")} +func (s *SAPCentralServerInstancesServerTransport) dispatchBeginStop(req *http.Request) (*http.Response, error) { + if s.srv.BeginStop == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginStop not implemented")} } - beginStopInstance := s.beginStopInstance.get(req) - if beginStopInstance == nil { + beginStop := s.beginStop.get(req) + if beginStop == nil { const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/sapVirtualInstances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/centralInstances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/stop` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) @@ -380,37 +395,37 @@ func (s *SAPCentralInstancesServerTransport) dispatchBeginStopInstance(req *http if err != nil { return nil, err } - var options *armworkloadssapvirtualinstance.SAPCentralInstancesClientBeginStopInstanceOptions + var options *armworkloadssapvirtualinstance.SAPCentralServerInstancesClientBeginStopOptions if !reflect.ValueOf(body).IsZero() { - options = &armworkloadssapvirtualinstance.SAPCentralInstancesClientBeginStopInstanceOptions{ + options = &armworkloadssapvirtualinstance.SAPCentralServerInstancesClientBeginStopOptions{ Body: &body, } } - respr, errRespr := s.srv.BeginStopInstance(req.Context(), resourceGroupNameParam, sapVirtualInstanceNameParam, centralInstanceNameParam, options) + respr, errRespr := s.srv.BeginStop(req.Context(), resourceGroupNameParam, sapVirtualInstanceNameParam, centralInstanceNameParam, options) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } - beginStopInstance = &respr - s.beginStopInstance.add(req, beginStopInstance) + beginStop = &respr + s.beginStop.add(req, beginStop) } - resp, err := server.PollerResponderNext(beginStopInstance, req) + resp, err := server.PollerResponderNext(beginStop, req) if err != nil { return nil, err } if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - s.beginStopInstance.remove(req) + s.beginStop.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} } - if !server.PollerResponderMore(beginStopInstance) { - s.beginStopInstance.remove(req) + if !server.PollerResponderMore(beginStop) { + s.beginStop.remove(req) } return resp, nil } -func (s *SAPCentralInstancesServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { +func (s *SAPCentralServerInstancesServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { if s.srv.Update == nil { return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} } @@ -450,3 +465,9 @@ func (s *SAPCentralInstancesServerTransport) dispatchUpdate(req *http.Request) ( } return resp, nil } + +// set this to conditionally intercept incoming requests to SAPCentralServerInstancesServerTransport +var sapCentralServerInstancesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/sapdatabaseinstances_server.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/sapdatabaseinstances_server.go index cf74eebc66d4..1750ca852dcc 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/sapdatabaseinstances_server.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/sapdatabaseinstances_server.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -27,10 +23,10 @@ import ( type SAPDatabaseInstancesServer struct { // BeginCreate is the fake for method SAPDatabaseInstancesClient.BeginCreate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, body armworkloadssapvirtualinstance.SAPDatabaseInstance, options *armworkloadssapvirtualinstance.SAPDatabaseInstancesClientBeginCreateOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientCreateResponse], errResp azfake.ErrorResponder) + BeginCreate func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, resource armworkloadssapvirtualinstance.SAPDatabaseInstance, options *armworkloadssapvirtualinstance.SAPDatabaseInstancesClientBeginCreateOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientCreateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method SAPDatabaseInstancesClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, options *armworkloadssapvirtualinstance.SAPDatabaseInstancesClientBeginDeleteOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method SAPDatabaseInstancesClient.Get @@ -41,17 +37,17 @@ type SAPDatabaseInstancesServer struct { // HTTP status codes to indicate success: http.StatusOK NewListPager func(resourceGroupName string, sapVirtualInstanceName string, options *armworkloadssapvirtualinstance.SAPDatabaseInstancesClientListOptions) (resp azfake.PagerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientListResponse]) - // BeginStartInstance is the fake for method SAPDatabaseInstancesClient.BeginStartInstance + // BeginStart is the fake for method SAPDatabaseInstancesClient.BeginStart // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginStartInstance func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, options *armworkloadssapvirtualinstance.SAPDatabaseInstancesClientBeginStartInstanceOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientStartInstanceResponse], errResp azfake.ErrorResponder) + BeginStart func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, options *armworkloadssapvirtualinstance.SAPDatabaseInstancesClientBeginStartOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientStartResponse], errResp azfake.ErrorResponder) - // BeginStopInstance is the fake for method SAPDatabaseInstancesClient.BeginStopInstance + // BeginStop is the fake for method SAPDatabaseInstancesClient.BeginStop // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginStopInstance func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, options *armworkloadssapvirtualinstance.SAPDatabaseInstancesClientBeginStopInstanceOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientStopInstanceResponse], errResp azfake.ErrorResponder) + BeginStop func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, options *armworkloadssapvirtualinstance.SAPDatabaseInstancesClientBeginStopOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientStopResponse], errResp azfake.ErrorResponder) // Update is the fake for method SAPDatabaseInstancesClient.Update // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, body armworkloadssapvirtualinstance.UpdateSAPDatabaseInstanceRequest, options *armworkloadssapvirtualinstance.SAPDatabaseInstancesClientUpdateOptions) (resp azfake.Responder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientUpdateResponse], errResp azfake.ErrorResponder) + Update func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, properties armworkloadssapvirtualinstance.UpdateSAPDatabaseInstanceRequest, options *armworkloadssapvirtualinstance.SAPDatabaseInstancesClientUpdateOptions) (resp azfake.Responder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientUpdateResponse], errResp azfake.ErrorResponder) } // NewSAPDatabaseInstancesServerTransport creates a new instance of SAPDatabaseInstancesServerTransport with the provided implementation. @@ -59,24 +55,24 @@ type SAPDatabaseInstancesServer struct { // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewSAPDatabaseInstancesServerTransport(srv *SAPDatabaseInstancesServer) *SAPDatabaseInstancesServerTransport { return &SAPDatabaseInstancesServerTransport{ - srv: srv, - beginCreate: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientCreateResponse]](), - beginDelete: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientDeleteResponse]](), - newListPager: newTracker[azfake.PagerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientListResponse]](), - beginStartInstance: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientStartInstanceResponse]](), - beginStopInstance: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientStopInstanceResponse]](), + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientCreateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientListResponse]](), + beginStart: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientStartResponse]](), + beginStop: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientStopResponse]](), } } // SAPDatabaseInstancesServerTransport connects instances of armworkloadssapvirtualinstance.SAPDatabaseInstancesClient to instances of SAPDatabaseInstancesServer. // Don't use this type directly, use NewSAPDatabaseInstancesServerTransport instead. type SAPDatabaseInstancesServerTransport struct { - srv *SAPDatabaseInstancesServer - beginCreate *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientCreateResponse]] - beginDelete *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientDeleteResponse]] - newListPager *tracker[azfake.PagerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientListResponse]] - beginStartInstance *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientStartInstanceResponse]] - beginStopInstance *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientStopInstanceResponse]] + srv *SAPDatabaseInstancesServer + beginCreate *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientCreateResponse]] + beginDelete *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientListResponse]] + beginStart *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientStartResponse]] + beginStop *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientStopResponse]] } // Do implements the policy.Transporter interface for SAPDatabaseInstancesServerTransport. @@ -87,33 +83,52 @@ func (s *SAPDatabaseInstancesServerTransport) Do(req *http.Request) (*http.Respo return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "SAPDatabaseInstancesClient.BeginCreate": - resp, err = s.dispatchBeginCreate(req) - case "SAPDatabaseInstancesClient.BeginDelete": - resp, err = s.dispatchBeginDelete(req) - case "SAPDatabaseInstancesClient.Get": - resp, err = s.dispatchGet(req) - case "SAPDatabaseInstancesClient.NewListPager": - resp, err = s.dispatchNewListPager(req) - case "SAPDatabaseInstancesClient.BeginStartInstance": - resp, err = s.dispatchBeginStartInstance(req) - case "SAPDatabaseInstancesClient.BeginStopInstance": - resp, err = s.dispatchBeginStopInstance(req) - case "SAPDatabaseInstancesClient.Update": - resp, err = s.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return s.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err - } +func (s *SAPDatabaseInstancesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - return resp, nil + go func() { + var intercepted bool + var res result + if sapDatabaseInstancesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = sapDatabaseInstancesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SAPDatabaseInstancesClient.BeginCreate": + res.resp, res.err = s.dispatchBeginCreate(req) + case "SAPDatabaseInstancesClient.BeginDelete": + res.resp, res.err = s.dispatchBeginDelete(req) + case "SAPDatabaseInstancesClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "SAPDatabaseInstancesClient.NewListPager": + res.resp, res.err = s.dispatchNewListPager(req) + case "SAPDatabaseInstancesClient.BeginStart": + res.resp, res.err = s.dispatchBeginStart(req) + case "SAPDatabaseInstancesClient.BeginStop": + res.resp, res.err = s.dispatchBeginStop(req) + case "SAPDatabaseInstancesClient.Update": + res.resp, res.err = s.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *SAPDatabaseInstancesServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { @@ -205,9 +220,9 @@ func (s *SAPDatabaseInstancesServerTransport) dispatchBeginDelete(req *http.Requ return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { s.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { s.beginDelete.remove(req) @@ -294,12 +309,12 @@ func (s *SAPDatabaseInstancesServerTransport) dispatchNewListPager(req *http.Req return resp, nil } -func (s *SAPDatabaseInstancesServerTransport) dispatchBeginStartInstance(req *http.Request) (*http.Response, error) { - if s.srv.BeginStartInstance == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginStartInstance not implemented")} +func (s *SAPDatabaseInstancesServerTransport) dispatchBeginStart(req *http.Request) (*http.Response, error) { + if s.srv.BeginStart == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginStart not implemented")} } - beginStartInstance := s.beginStartInstance.get(req) - if beginStartInstance == nil { + beginStart := s.beginStart.get(req) + if beginStart == nil { const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/sapVirtualInstances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databaseInstances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/start` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) @@ -322,42 +337,42 @@ func (s *SAPDatabaseInstancesServerTransport) dispatchBeginStartInstance(req *ht if err != nil { return nil, err } - var options *armworkloadssapvirtualinstance.SAPDatabaseInstancesClientBeginStartInstanceOptions + var options *armworkloadssapvirtualinstance.SAPDatabaseInstancesClientBeginStartOptions if !reflect.ValueOf(body).IsZero() { - options = &armworkloadssapvirtualinstance.SAPDatabaseInstancesClientBeginStartInstanceOptions{ + options = &armworkloadssapvirtualinstance.SAPDatabaseInstancesClientBeginStartOptions{ Body: &body, } } - respr, errRespr := s.srv.BeginStartInstance(req.Context(), resourceGroupNameParam, sapVirtualInstanceNameParam, databaseInstanceNameParam, options) + respr, errRespr := s.srv.BeginStart(req.Context(), resourceGroupNameParam, sapVirtualInstanceNameParam, databaseInstanceNameParam, options) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } - beginStartInstance = &respr - s.beginStartInstance.add(req, beginStartInstance) + beginStart = &respr + s.beginStart.add(req, beginStart) } - resp, err := server.PollerResponderNext(beginStartInstance, req) + resp, err := server.PollerResponderNext(beginStart, req) if err != nil { return nil, err } if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - s.beginStartInstance.remove(req) + s.beginStart.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} } - if !server.PollerResponderMore(beginStartInstance) { - s.beginStartInstance.remove(req) + if !server.PollerResponderMore(beginStart) { + s.beginStart.remove(req) } return resp, nil } -func (s *SAPDatabaseInstancesServerTransport) dispatchBeginStopInstance(req *http.Request) (*http.Response, error) { - if s.srv.BeginStopInstance == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginStopInstance not implemented")} +func (s *SAPDatabaseInstancesServerTransport) dispatchBeginStop(req *http.Request) (*http.Response, error) { + if s.srv.BeginStop == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginStop not implemented")} } - beginStopInstance := s.beginStopInstance.get(req) - if beginStopInstance == nil { + beginStop := s.beginStop.get(req) + if beginStop == nil { const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/sapVirtualInstances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databaseInstances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/stop` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) @@ -380,31 +395,31 @@ func (s *SAPDatabaseInstancesServerTransport) dispatchBeginStopInstance(req *htt if err != nil { return nil, err } - var options *armworkloadssapvirtualinstance.SAPDatabaseInstancesClientBeginStopInstanceOptions + var options *armworkloadssapvirtualinstance.SAPDatabaseInstancesClientBeginStopOptions if !reflect.ValueOf(body).IsZero() { - options = &armworkloadssapvirtualinstance.SAPDatabaseInstancesClientBeginStopInstanceOptions{ + options = &armworkloadssapvirtualinstance.SAPDatabaseInstancesClientBeginStopOptions{ Body: &body, } } - respr, errRespr := s.srv.BeginStopInstance(req.Context(), resourceGroupNameParam, sapVirtualInstanceNameParam, databaseInstanceNameParam, options) + respr, errRespr := s.srv.BeginStop(req.Context(), resourceGroupNameParam, sapVirtualInstanceNameParam, databaseInstanceNameParam, options) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } - beginStopInstance = &respr - s.beginStopInstance.add(req, beginStopInstance) + beginStop = &respr + s.beginStop.add(req, beginStop) } - resp, err := server.PollerResponderNext(beginStopInstance, req) + resp, err := server.PollerResponderNext(beginStop, req) if err != nil { return nil, err } if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - s.beginStopInstance.remove(req) + s.beginStop.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} } - if !server.PollerResponderMore(beginStopInstance) { - s.beginStopInstance.remove(req) + if !server.PollerResponderMore(beginStop) { + s.beginStop.remove(req) } return resp, nil @@ -450,3 +465,9 @@ func (s *SAPDatabaseInstancesServerTransport) dispatchUpdate(req *http.Request) } return resp, nil } + +// set this to conditionally intercept incoming requests to SAPDatabaseInstancesServerTransport +var sapDatabaseInstancesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/sapvirtualinstances_server.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/sapvirtualinstances_server.go index 603a01a7b054..fc4305d0fc6a 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/sapvirtualinstances_server.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/sapvirtualinstances_server.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -27,16 +23,32 @@ import ( type SAPVirtualInstancesServer struct { // BeginCreate is the fake for method SAPVirtualInstancesClient.BeginCreate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, body armworkloadssapvirtualinstance.SAPVirtualInstance, options *armworkloadssapvirtualinstance.SAPVirtualInstancesClientBeginCreateOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse], errResp azfake.ErrorResponder) + BeginCreate func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, resource armworkloadssapvirtualinstance.SAPVirtualInstance, options *armworkloadssapvirtualinstance.SAPVirtualInstancesClientBeginCreateOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method SAPVirtualInstancesClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, options *armworkloadssapvirtualinstance.SAPVirtualInstancesClientBeginDeleteOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPVirtualInstancesClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method SAPVirtualInstancesClient.Get // HTTP status codes to indicate success: http.StatusOK Get func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, options *armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetOptions) (resp azfake.Responder[armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetResponse], errResp azfake.ErrorResponder) + // GetAvailabilityZoneDetails is the fake for method SAPVirtualInstancesClient.GetAvailabilityZoneDetails + // HTTP status codes to indicate success: http.StatusOK + GetAvailabilityZoneDetails func(ctx context.Context, location string, body armworkloadssapvirtualinstance.SAPAvailabilityZoneDetailsRequest, options *armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetAvailabilityZoneDetailsOptions) (resp azfake.Responder[armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetAvailabilityZoneDetailsResponse], errResp azfake.ErrorResponder) + + // GetDiskConfigurations is the fake for method SAPVirtualInstancesClient.GetDiskConfigurations + // HTTP status codes to indicate success: http.StatusOK + GetDiskConfigurations func(ctx context.Context, location string, body armworkloadssapvirtualinstance.SAPDiskConfigurationsRequest, options *armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetDiskConfigurationsOptions) (resp azfake.Responder[armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetDiskConfigurationsResponse], errResp azfake.ErrorResponder) + + // GetSapSupportedSKU is the fake for method SAPVirtualInstancesClient.GetSapSupportedSKU + // HTTP status codes to indicate success: http.StatusOK + GetSapSupportedSKU func(ctx context.Context, location string, body armworkloadssapvirtualinstance.SAPSupportedSKUsRequest, options *armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetSapSupportedSKUOptions) (resp azfake.Responder[armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetSapSupportedSKUResponse], errResp azfake.ErrorResponder) + + // GetSizingRecommendations is the fake for method SAPVirtualInstancesClient.GetSizingRecommendations + // HTTP status codes to indicate success: http.StatusOK + GetSizingRecommendations func(ctx context.Context, location string, body armworkloadssapvirtualinstance.SAPSizingRecommendationRequest, options *armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetSizingRecommendationsOptions) (resp azfake.Responder[armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetSizingRecommendationsResponse], errResp azfake.ErrorResponder) + // NewListByResourceGroupPager is the fake for method SAPVirtualInstancesClient.NewListByResourceGroupPager // HTTP status codes to indicate success: http.StatusOK NewListByResourceGroupPager func(resourceGroupName string, options *armworkloadssapvirtualinstance.SAPVirtualInstancesClientListByResourceGroupOptions) (resp azfake.PagerResponder[armworkloadssapvirtualinstance.SAPVirtualInstancesClientListByResourceGroupResponse]) @@ -55,7 +67,7 @@ type SAPVirtualInstancesServer struct { // BeginUpdate is the fake for method SAPVirtualInstancesClient.BeginUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginUpdate func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, body armworkloadssapvirtualinstance.UpdateSAPVirtualInstanceRequest, options *armworkloadssapvirtualinstance.SAPVirtualInstancesClientBeginUpdateOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPVirtualInstancesClientUpdateResponse], errResp azfake.ErrorResponder) + BeginUpdate func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, properties armworkloadssapvirtualinstance.UpdateSAPVirtualInstanceRequest, options *armworkloadssapvirtualinstance.SAPVirtualInstancesClientBeginUpdateOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPVirtualInstancesClientUpdateResponse], errResp azfake.ErrorResponder) } // NewSAPVirtualInstancesServerTransport creates a new instance of SAPVirtualInstancesServerTransport with the provided implementation. @@ -95,35 +107,62 @@ func (s *SAPVirtualInstancesServerTransport) Do(req *http.Request) (*http.Respon return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "SAPVirtualInstancesClient.BeginCreate": - resp, err = s.dispatchBeginCreate(req) - case "SAPVirtualInstancesClient.BeginDelete": - resp, err = s.dispatchBeginDelete(req) - case "SAPVirtualInstancesClient.Get": - resp, err = s.dispatchGet(req) - case "SAPVirtualInstancesClient.NewListByResourceGroupPager": - resp, err = s.dispatchNewListByResourceGroupPager(req) - case "SAPVirtualInstancesClient.NewListBySubscriptionPager": - resp, err = s.dispatchNewListBySubscriptionPager(req) - case "SAPVirtualInstancesClient.BeginStart": - resp, err = s.dispatchBeginStart(req) - case "SAPVirtualInstancesClient.BeginStop": - resp, err = s.dispatchBeginStop(req) - case "SAPVirtualInstancesClient.BeginUpdate": - resp, err = s.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return s.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err - } +func (s *SAPVirtualInstancesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - return resp, nil + go func() { + var intercepted bool + var res result + if sapVirtualInstancesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = sapVirtualInstancesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SAPVirtualInstancesClient.BeginCreate": + res.resp, res.err = s.dispatchBeginCreate(req) + case "SAPVirtualInstancesClient.BeginDelete": + res.resp, res.err = s.dispatchBeginDelete(req) + case "SAPVirtualInstancesClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "SAPVirtualInstancesClient.GetAvailabilityZoneDetails": + res.resp, res.err = s.dispatchGetAvailabilityZoneDetails(req) + case "SAPVirtualInstancesClient.GetDiskConfigurations": + res.resp, res.err = s.dispatchGetDiskConfigurations(req) + case "SAPVirtualInstancesClient.GetSapSupportedSKU": + res.resp, res.err = s.dispatchGetSapSupportedSKU(req) + case "SAPVirtualInstancesClient.GetSizingRecommendations": + res.resp, res.err = s.dispatchGetSizingRecommendations(req) + case "SAPVirtualInstancesClient.NewListByResourceGroupPager": + res.resp, res.err = s.dispatchNewListByResourceGroupPager(req) + case "SAPVirtualInstancesClient.NewListBySubscriptionPager": + res.resp, res.err = s.dispatchNewListBySubscriptionPager(req) + case "SAPVirtualInstancesClient.BeginStart": + res.resp, res.err = s.dispatchBeginStart(req) + case "SAPVirtualInstancesClient.BeginStop": + res.resp, res.err = s.dispatchBeginStop(req) + case "SAPVirtualInstancesClient.BeginUpdate": + res.resp, res.err = s.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *SAPVirtualInstancesServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { @@ -207,9 +246,9 @@ func (s *SAPVirtualInstancesServerTransport) dispatchBeginDelete(req *http.Reque return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { s.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { s.beginDelete.remove(req) @@ -251,6 +290,138 @@ func (s *SAPVirtualInstancesServerTransport) dispatchGet(req *http.Request) (*ht return resp, nil } +func (s *SAPVirtualInstancesServerTransport) dispatchGetAvailabilityZoneDetails(req *http.Request) (*http.Response, error) { + if s.srv.GetAvailabilityZoneDetails == nil { + return nil, &nonRetriableError{errors.New("fake for method GetAvailabilityZoneDetails not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sapVirtualInstanceMetadata/default/getAvailabilityZoneDetails` + 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) + } + body, err := server.UnmarshalRequestAsJSON[armworkloadssapvirtualinstance.SAPAvailabilityZoneDetailsRequest](req) + if err != nil { + return nil, err + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.GetAvailabilityZoneDetails(req.Context(), locationParam, 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).SAPAvailabilityZoneDetailsResult, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SAPVirtualInstancesServerTransport) dispatchGetDiskConfigurations(req *http.Request) (*http.Response, error) { + if s.srv.GetDiskConfigurations == nil { + return nil, &nonRetriableError{errors.New("fake for method GetDiskConfigurations not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sapVirtualInstanceMetadata/default/getDiskConfigurations` + 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) + } + body, err := server.UnmarshalRequestAsJSON[armworkloadssapvirtualinstance.SAPDiskConfigurationsRequest](req) + if err != nil { + return nil, err + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.GetDiskConfigurations(req.Context(), locationParam, 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).SAPDiskConfigurationsResult, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SAPVirtualInstancesServerTransport) dispatchGetSapSupportedSKU(req *http.Request) (*http.Response, error) { + if s.srv.GetSapSupportedSKU == nil { + return nil, &nonRetriableError{errors.New("fake for method GetSapSupportedSKU not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sapVirtualInstanceMetadata/default/getSapSupportedSku` + 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) + } + body, err := server.UnmarshalRequestAsJSON[armworkloadssapvirtualinstance.SAPSupportedSKUsRequest](req) + if err != nil { + return nil, err + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.GetSapSupportedSKU(req.Context(), locationParam, 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).SAPSupportedResourceSKUsResult, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SAPVirtualInstancesServerTransport) dispatchGetSizingRecommendations(req *http.Request) (*http.Response, error) { + if s.srv.GetSizingRecommendations == nil { + return nil, &nonRetriableError{errors.New("fake for method GetSizingRecommendations not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sapVirtualInstanceMetadata/default/getSizingRecommendations` + 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) + } + body, err := server.UnmarshalRequestAsJSON[armworkloadssapvirtualinstance.SAPSizingRecommendationRequest](req) + if err != nil { + return nil, err + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.GetSizingRecommendations(req.Context(), locationParam, 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).SAPSizingRecommendationResultClassification, req) + if err != nil { + return nil, err + } + return resp, nil +} + func (s *SAPVirtualInstancesServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { if s.srv.NewListByResourceGroupPager == nil { return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} @@ -476,3 +647,9 @@ func (s *SAPVirtualInstancesServerTransport) dispatchBeginUpdate(req *http.Reque return resp, nil } + +// set this to conditionally intercept incoming requests to SAPVirtualInstancesServerTransport +var sapVirtualInstancesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/server_factory.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/server_factory.go index 76fde4013d4e..99f4bf1c38bb 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/server_factory.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/server_factory.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -19,12 +15,17 @@ import ( // ServerFactory is a fake server for instances of the armworkloadssapvirtualinstance.ClientFactory type. type ServerFactory struct { - OperationsServer OperationsServer + // SAPApplicationServerInstancesServer contains the fakes for client SAPApplicationServerInstancesClient SAPApplicationServerInstancesServer SAPApplicationServerInstancesServer - SAPCentralInstancesServer SAPCentralInstancesServer - SAPDatabaseInstancesServer SAPDatabaseInstancesServer - SAPVirtualInstancesServer SAPVirtualInstancesServer - WorkloadsServer WorkloadsServer + + // SAPCentralServerInstancesServer contains the fakes for client SAPCentralServerInstancesClient + SAPCentralServerInstancesServer SAPCentralServerInstancesServer + + // SAPDatabaseInstancesServer contains the fakes for client SAPDatabaseInstancesClient + SAPDatabaseInstancesServer SAPDatabaseInstancesServer + + // SAPVirtualInstancesServer contains the fakes for client SAPVirtualInstancesClient + SAPVirtualInstancesServer SAPVirtualInstancesServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. @@ -41,12 +42,10 @@ func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { type ServerFactoryTransport struct { srv *ServerFactory trMu sync.Mutex - trOperationsServer *OperationsServerTransport trSAPApplicationServerInstancesServer *SAPApplicationServerInstancesServerTransport - trSAPCentralInstancesServer *SAPCentralInstancesServerTransport + trSAPCentralServerInstancesServer *SAPCentralServerInstancesServerTransport trSAPDatabaseInstancesServer *SAPDatabaseInstancesServerTransport trSAPVirtualInstancesServer *SAPVirtualInstancesServerTransport - trWorkloadsServer *WorkloadsServerTransport } // Do implements the policy.Transporter interface for ServerFactoryTransport. @@ -62,19 +61,16 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { var err error switch client { - case "OperationsClient": - initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) - resp, err = s.trOperationsServer.Do(req) case "SAPApplicationServerInstancesClient": initServer(s, &s.trSAPApplicationServerInstancesServer, func() *SAPApplicationServerInstancesServerTransport { return NewSAPApplicationServerInstancesServerTransport(&s.srv.SAPApplicationServerInstancesServer) }) resp, err = s.trSAPApplicationServerInstancesServer.Do(req) - case "SAPCentralInstancesClient": - initServer(s, &s.trSAPCentralInstancesServer, func() *SAPCentralInstancesServerTransport { - return NewSAPCentralInstancesServerTransport(&s.srv.SAPCentralInstancesServer) + case "SAPCentralServerInstancesClient": + initServer(s, &s.trSAPCentralServerInstancesServer, func() *SAPCentralServerInstancesServerTransport { + return NewSAPCentralServerInstancesServerTransport(&s.srv.SAPCentralServerInstancesServer) }) - resp, err = s.trSAPCentralInstancesServer.Do(req) + resp, err = s.trSAPCentralServerInstancesServer.Do(req) case "SAPDatabaseInstancesClient": initServer(s, &s.trSAPDatabaseInstancesServer, func() *SAPDatabaseInstancesServerTransport { return NewSAPDatabaseInstancesServerTransport(&s.srv.SAPDatabaseInstancesServer) @@ -85,9 +81,6 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewSAPVirtualInstancesServerTransport(&s.srv.SAPVirtualInstancesServer) }) resp, err = s.trSAPVirtualInstancesServer.Do(req) - case "WorkloadsClient": - initServer(s, &s.trWorkloadsServer, func() *WorkloadsServerTransport { return NewWorkloadsServerTransport(&s.srv.WorkloadsServer) }) - resp, err = s.trWorkloadsServer.Do(req) default: err = fmt.Errorf("unhandled client %s", client) } diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/time_rfc3339.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/time_rfc3339.go index 81f308b0d343..87ee11e83b32 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/time_rfc3339.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/time_rfc3339.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -60,6 +56,9 @@ func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } tzOffset := tzOffsetRegex.Match(data) hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") var layout string diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/workloads_server.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/workloads_server.go deleted file mode 100644 index 52a61891416f..000000000000 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/workloads_server.go +++ /dev/null @@ -1,242 +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/workloadssapvirtualinstance/armworkloadssapvirtualinstance" - "net/http" - "net/url" - "reflect" - "regexp" -) - -// WorkloadsServer is a fake server for instances of the armworkloadssapvirtualinstance.WorkloadsClient type. -type WorkloadsServer struct { - // SAPAvailabilityZoneDetails is the fake for method WorkloadsClient.SAPAvailabilityZoneDetails - // HTTP status codes to indicate success: http.StatusOK - SAPAvailabilityZoneDetails func(ctx context.Context, location string, options *armworkloadssapvirtualinstance.WorkloadsClientSAPAvailabilityZoneDetailsOptions) (resp azfake.Responder[armworkloadssapvirtualinstance.WorkloadsClientSAPAvailabilityZoneDetailsResponse], errResp azfake.ErrorResponder) - - // SAPDiskConfigurations is the fake for method WorkloadsClient.SAPDiskConfigurations - // HTTP status codes to indicate success: http.StatusOK - SAPDiskConfigurations func(ctx context.Context, location string, options *armworkloadssapvirtualinstance.WorkloadsClientSAPDiskConfigurationsOptions) (resp azfake.Responder[armworkloadssapvirtualinstance.WorkloadsClientSAPDiskConfigurationsResponse], errResp azfake.ErrorResponder) - - // SAPSizingRecommendations is the fake for method WorkloadsClient.SAPSizingRecommendations - // HTTP status codes to indicate success: http.StatusOK - SAPSizingRecommendations func(ctx context.Context, location string, options *armworkloadssapvirtualinstance.WorkloadsClientSAPSizingRecommendationsOptions) (resp azfake.Responder[armworkloadssapvirtualinstance.WorkloadsClientSAPSizingRecommendationsResponse], errResp azfake.ErrorResponder) - - // SAPSupportedSKU is the fake for method WorkloadsClient.SAPSupportedSKU - // HTTP status codes to indicate success: http.StatusOK - SAPSupportedSKU func(ctx context.Context, location string, options *armworkloadssapvirtualinstance.WorkloadsClientSAPSupportedSKUOptions) (resp azfake.Responder[armworkloadssapvirtualinstance.WorkloadsClientSAPSupportedSKUResponse], errResp azfake.ErrorResponder) -} - -// NewWorkloadsServerTransport creates a new instance of WorkloadsServerTransport with the provided implementation. -// The returned WorkloadsServerTransport instance is connected to an instance of armworkloadssapvirtualinstance.WorkloadsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewWorkloadsServerTransport(srv *WorkloadsServer) *WorkloadsServerTransport { - return &WorkloadsServerTransport{srv: srv} -} - -// WorkloadsServerTransport connects instances of armworkloadssapvirtualinstance.WorkloadsClient to instances of WorkloadsServer. -// Don't use this type directly, use NewWorkloadsServerTransport instead. -type WorkloadsServerTransport struct { - srv *WorkloadsServer -} - -// Do implements the policy.Transporter interface for WorkloadsServerTransport. -func (w *WorkloadsServerTransport) 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 "WorkloadsClient.SAPAvailabilityZoneDetails": - resp, err = w.dispatchSAPAvailabilityZoneDetails(req) - case "WorkloadsClient.SAPDiskConfigurations": - resp, err = w.dispatchSAPDiskConfigurations(req) - case "WorkloadsClient.SAPSizingRecommendations": - resp, err = w.dispatchSAPSizingRecommendations(req) - case "WorkloadsClient.SAPSupportedSKU": - resp, err = w.dispatchSAPSupportedSKU(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (w *WorkloadsServerTransport) dispatchSAPAvailabilityZoneDetails(req *http.Request) (*http.Response, error) { - if w.srv.SAPAvailabilityZoneDetails == nil { - return nil, &nonRetriableError{errors.New("fake for method SAPAvailabilityZoneDetails not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sapVirtualInstanceMetadata/default/getAvailabilityZoneDetails` - 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) - } - body, err := server.UnmarshalRequestAsJSON[armworkloadssapvirtualinstance.SAPAvailabilityZoneDetailsRequest](req) - if err != nil { - return nil, err - } - locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) - if err != nil { - return nil, err - } - var options *armworkloadssapvirtualinstance.WorkloadsClientSAPAvailabilityZoneDetailsOptions - if !reflect.ValueOf(body).IsZero() { - options = &armworkloadssapvirtualinstance.WorkloadsClientSAPAvailabilityZoneDetailsOptions{ - SAPAvailabilityZoneDetails: &body, - } - } - respr, errRespr := w.srv.SAPAvailabilityZoneDetails(req.Context(), locationParam, 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).SAPAvailabilityZoneDetailsResult, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (w *WorkloadsServerTransport) dispatchSAPDiskConfigurations(req *http.Request) (*http.Response, error) { - if w.srv.SAPDiskConfigurations == nil { - return nil, &nonRetriableError{errors.New("fake for method SAPDiskConfigurations not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sapVirtualInstanceMetadata/default/getDiskConfigurations` - 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) - } - body, err := server.UnmarshalRequestAsJSON[armworkloadssapvirtualinstance.SAPDiskConfigurationsRequest](req) - if err != nil { - return nil, err - } - locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) - if err != nil { - return nil, err - } - var options *armworkloadssapvirtualinstance.WorkloadsClientSAPDiskConfigurationsOptions - if !reflect.ValueOf(body).IsZero() { - options = &armworkloadssapvirtualinstance.WorkloadsClientSAPDiskConfigurationsOptions{ - SAPDiskConfigurations: &body, - } - } - respr, errRespr := w.srv.SAPDiskConfigurations(req.Context(), locationParam, 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).SAPDiskConfigurationsResult, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (w *WorkloadsServerTransport) dispatchSAPSizingRecommendations(req *http.Request) (*http.Response, error) { - if w.srv.SAPSizingRecommendations == nil { - return nil, &nonRetriableError{errors.New("fake for method SAPSizingRecommendations not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sapVirtualInstanceMetadata/default/getSizingRecommendations` - 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) - } - body, err := server.UnmarshalRequestAsJSON[armworkloadssapvirtualinstance.SAPSizingRecommendationRequest](req) - if err != nil { - return nil, err - } - locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) - if err != nil { - return nil, err - } - var options *armworkloadssapvirtualinstance.WorkloadsClientSAPSizingRecommendationsOptions - if !reflect.ValueOf(body).IsZero() { - options = &armworkloadssapvirtualinstance.WorkloadsClientSAPSizingRecommendationsOptions{ - SAPSizingRecommendation: &body, - } - } - respr, errRespr := w.srv.SAPSizingRecommendations(req.Context(), locationParam, 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).SAPSizingRecommendationResultClassification, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (w *WorkloadsServerTransport) dispatchSAPSupportedSKU(req *http.Request) (*http.Response, error) { - if w.srv.SAPSupportedSKU == nil { - return nil, &nonRetriableError{errors.New("fake for method SAPSupportedSKU not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sapVirtualInstanceMetadata/default/getSapSupportedSku` - 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) - } - body, err := server.UnmarshalRequestAsJSON[armworkloadssapvirtualinstance.SAPSupportedSKUsRequest](req) - if err != nil { - return nil, err - } - locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) - if err != nil { - return nil, err - } - var options *armworkloadssapvirtualinstance.WorkloadsClientSAPSupportedSKUOptions - if !reflect.ValueOf(body).IsZero() { - options = &armworkloadssapvirtualinstance.WorkloadsClientSAPSupportedSKUOptions{ - SAPSupportedSKU: &body, - } - } - respr, errRespr := w.srv.SAPSupportedSKU(req.Context(), locationParam, 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).SAPSupportedResourceSKUsResult, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/go.mod b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/go.mod index cbc72d4d4f77..56da7dd00518 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/go.mod +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/go.mod @@ -3,7 +3,7 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloadssapvirtual go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 ) @@ -14,8 +14,8 @@ require ( github.com/google/uuid v1.6.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.25.0 // indirect - golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect - golang.org/x/text v0.16.0 // indirect + golang.org/x/crypto v0.27.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/text v0.18.0 // indirect ) diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/go.sum b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/go.sum index 09d275cb9a37..cbddbbd9ecec 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/go.sum +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/go.sum @@ -1,5 +1,5 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 h1:JZg6HRh6W6U4OLl6lk7BZ7BLisIzM9dG1R50zUk9C/M= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0/go.mod h1:YL1xnZ6QejvQHWJrX/AvhFl4WW4rqHVoKspWNVwFk0M= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= @@ -17,13 +17,13 @@ github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmd github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= -golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= -golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/interfaces.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/interfaces.go index d5a628b5cd4c..6f702bf2f8db 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/interfaces.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/interfaces.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armworkloadssapvirtualinstance diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/models.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/models.go index 3ba605dab9fb..2812c5b4de41 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/models.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/models.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armworkloadssapvirtualinstance @@ -41,7 +37,7 @@ type ApplicationServerVMDetails struct { // READ-ONLY; Defines the type of application server VM. Type *ApplicationServerVirtualMachineType - // READ-ONLY + // READ-ONLY; The virtual machine id. VirtualMachineID *string } @@ -66,8 +62,7 @@ type CentralServerFullResourceNames struct { LoadBalancer *LoadBalancerResourceNames // The list of names for all ASCS virtual machines to be deployed. The number of entries in this list should be equal to the - // number VMs to be created for ASCS layer. At maximum, there can be two virtual - // machines at this layer: ASCS and ERS. + // number VMs to be created for ASCS layer. At maximum, there can be two virtual machines at this layer: ASCS and ERS. VirtualMachines []*VirtualMachineResourceNames } @@ -80,16 +75,17 @@ type CentralServerVMDetails struct { // READ-ONLY; Defines the type of central server VM. Type *CentralServerVirtualMachineType - // READ-ONLY + // READ-ONLY; The virtual machine id. VirtualMachineID *string } // CreateAndMountFileShareConfiguration - Gets or sets the file share configuration where the transport directory fileshare -// is created and mounted as a part of the create infra flow. Please pre-create the resource group you intend to place -// the transport directory in. The storage account and fileshare will be auto-created by the ACSS and doesn't need to be pre-created. +// is created and mounted as a part of the create infra flow. Please pre-create the resource group you intend to place the +// transport directory in. The storage account and fileshare will be auto-created by the ACSS and doesn't need to be pre-created. type CreateAndMountFileShareConfiguration struct { - // REQUIRED; The type of file share config. - ConfigurationType *ConfigurationType + // CONSTANT; The type of file share config. + // Field has constant value FileShareConfigurationTypeCreateAndMount, any specified value is ignored. + ConfigurationType *FileShareConfigurationType // The name of transport file share resource group. This should be pre created by the customer. The app rg is used in case // of missing input. @@ -146,7 +142,7 @@ type DatabaseVMDetails struct { // Storage. StorageDetails []*StorageInformation - // READ-ONLY + // READ-ONLY; The virtual machine id. VirtualMachineID *string } @@ -161,7 +157,8 @@ type DeployerVMPackages struct { // DeploymentConfiguration - Deployment Configuration. type DeploymentConfiguration struct { - // REQUIRED; The configuration Type. + // CONSTANT; The deployment configuration Type. + // Field has constant value SAPConfigurationTypeDeployment, any specified value is ignored. ConfigurationType *SAPConfigurationType // The geo-location where the SAP system is to be created. @@ -183,7 +180,8 @@ func (d *DeploymentConfiguration) GetSAPConfiguration() *SAPConfiguration { // DeploymentWithOSConfiguration - Deployment along with OS Configuration. type DeploymentWithOSConfiguration struct { - // REQUIRED; The configuration Type. + // CONSTANT; The configuration Type. + // Field has constant value SAPConfigurationTypeDeploymentWithOSConfig, any specified value is ignored. ConfigurationType *SAPConfigurationType // The geo-location where the SAP system is to be created. @@ -208,16 +206,16 @@ func (d *DeploymentWithOSConfiguration) GetSAPConfiguration() *SAPConfiguration // DiscoveryConfiguration - Discovery Details. type DiscoveryConfiguration struct { - // REQUIRED; The configuration Type. + // CONSTANT; The configuration Type. + // Field has constant value SAPConfigurationTypeDiscovery, any specified value is ignored. ConfigurationType *SAPConfigurationType // The virtual machine ID of the Central Server. CentralServerVMID *string // The custom storage account name for the storage account created by the service in the managed resource group created as - // part of VIS deployment. - // Refer to the storage account naming rules here [https://learn.microsoft.com/azure/azure-resource-manager/management/resource-name-rules#microsoftstorage]. - // If not provided, the service will create the storage account with a random name. + // part of VIS deployment.

Refer to the storage account naming rules [here](https://learn.microsoft.com/azure/azure-resource-manager/management/resource-name-rules#microsoftstorage).

If + // not provided, the service will create the storage account with a random name. ManagedRgStorageAccountName *string // READ-ONLY; The geo-location where the SAP system exists. @@ -255,14 +253,14 @@ type DiskDetails struct { // The minimum supported disk count. MinimumSupportedDiskCount *int64 - // The type of disk sku. For example, StandardLRS, StandardZRS, PremiumLRS, PremiumZRS. + // The type of disk sku. For example, Standard_LRS, Standard_ZRS, Premium_LRS, Premium_ZRS. SKU *DiskSKU // The disk size in GB. SizeGB *int64 } -// DiskSKU - The type of disk sku. For example, StandardLRS, StandardZRS, PremiumLRS, PremiumZRS. +// DiskSKU - The type of disk sku. For example, Standard_LRS, Standard_ZRS, Premium_LRS, Premium_ZRS. type DiskSKU struct { // Defines the disk sku name. Name *DiskSKUName @@ -322,12 +320,15 @@ type EnqueueServerProperties struct { // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { // READ-ONLY; The additional info. - Info any + Info *ErrorAdditionalInfoInfo // READ-ONLY; The additional info type. Type *string } +type ErrorAdditionalInfoInfo struct { +} + // ErrorDefinition - Error definition. type ErrorDefinition struct { // READ-ONLY; Service specific error code which serves as the substatus for the HTTP error code. @@ -361,7 +362,8 @@ type ErrorDetail struct { // ExternalInstallationSoftwareConfiguration - The SAP Software configuration Input when the software is installed externally // outside the service. type ExternalInstallationSoftwareConfiguration struct { - // REQUIRED; The SAP software installation Type. + // CONSTANT; The SAP software installation Type. + // Field has constant value SAPSoftwareInstallationTypeExternal, any specified value is ignored. SoftwareInstallationType *SAPSoftwareInstallationType // The resource ID of the virtual machine containing the central server instance. @@ -378,8 +380,8 @@ func (e *ExternalInstallationSoftwareConfiguration) GetSoftwareConfiguration() * // FileShareConfiguration - File Share configuration details, populated with information on storage configuration mounted // on the VIS. The createAndMount option is selected in case of missing input. type FileShareConfiguration struct { - // REQUIRED; The type of file share config. - ConfigurationType *ConfigurationType + // REQUIRED; The type of file share config, eg: Mount/CreateAndMount/Skip. + ConfigurationType *FileShareConfigurationType } // GetFileShareConfiguration implements the FileShareConfigurationClassification interface for type FileShareConfiguration. @@ -411,13 +413,12 @@ type HighAvailabilitySoftwareConfiguration struct { } // ImageReference - Specifies information about the image to use. You can specify information about platform images, marketplace -// images, or virtual machine images. This element is required when you want to use a platform -// image, marketplace image, or virtual machine image, but is not used in other creation operations. NOTE: Image reference -// publisher and offer can only be set when you create the scale set. +// images, or virtual machine images. This element is required when you want to use a platform image, marketplace image, or +// virtual machine image, but is not used in other creation operations. NOTE: Image reference publisher and offer can only +// be set when you create the scale set. type ImageReference struct { // Specifies the ARM resource ID of the Azure Compute Gallery image version used for creating ACSS VMs. You will need to provide - // this input when you choose to deploy virtual machines in ACSS with OS - // image from the Azure Compute gallery. + // this input when you choose to deploy virtual machines in ACSS with OS image from the Azure Compute gallery. ID *string // Specifies the offer of the platform image or marketplace image used to create the virtual machine. @@ -430,10 +431,9 @@ type ImageReference struct { SKU *string // Specifies the version of the platform image or marketplace image used to create the virtual machine. The allowed formats - // are Major.Minor.Build or 'latest'. Major, Minor, and Build are decimal numbers. - // Specify 'latest' to use the latest version of an image available at deploy time. Even if you use 'latest', the VM image - // will not automatically update after deploy time even if a new version becomes - // available. + // are Major.Minor.Build or 'latest'. Major, Minor, and Build are decimal numbers. Specify 'latest' to use the latest version + // of an image available at deploy time. Even if you use 'latest', the VM image will not automatically update after deploy + // time even if a new version becomes available. Version *string } @@ -442,7 +442,7 @@ type InfrastructureConfiguration struct { // REQUIRED; The application resource group where SAP system resources will be deployed. AppResourceGroup *string - // REQUIRED; The type of SAP deployment, single server or Three tier. + // REQUIRED; The SAP deployment type. Eg: SingleServer/ThreeTier. DeploymentType *SAPDeploymentType } @@ -451,10 +451,11 @@ func (i *InfrastructureConfiguration) GetInfrastructureConfiguration() *Infrastr return i } -// LinuxConfiguration - Specifies the Linux operating system settings on the virtual machine. -// For a list of supported Linux distributions, see Linux on Azure-Endorsed Distributions [https://docs.microsoft.com/azure/virtual-machines/linux/endorsed-distros]. +// LinuxConfiguration - Specifies the Linux operating system settings on the virtual machine.

For a list of supported +// Linux distributions, see [Linux on Azure-Endorsed Distributions](https://docs.microsoft.com/azure/virtual-machines/linux/endorsed-distros). type LinuxConfiguration struct { - // REQUIRED; The OS Type + // CONSTANT; The OS Type + // Field has constant value OSTypeLinux, any specified value is ignored. OSType *OSType // Specifies whether password authentication should be disabled. @@ -476,7 +477,7 @@ func (l *LinuxConfiguration) GetOSConfiguration() *OSConfiguration { // LoadBalancerDetails - The Load Balancer details such as Load Balancer ID. type LoadBalancerDetails struct { - // READ-ONLY + // READ-ONLY; Fully qualified resource ID for the load balancer. ID *string } @@ -530,8 +531,9 @@ type MessageServerProperties struct { // MountFileShareConfiguration - Gets or sets the file share configuration where the transport directory fileshare already // exists, and user wishes to mount the fileshare as a part of the create infra flow. type MountFileShareConfiguration struct { - // REQUIRED; The type of file share config. - ConfigurationType *ConfigurationType + // CONSTANT; The type of file share config, mount in this case. + // Field has constant value FileShareConfigurationTypeMount, any specified value is ignored. + ConfigurationType *FileShareConfigurationType // REQUIRED; The fileshare resource ID ID *string @@ -556,10 +558,9 @@ type NetworkConfiguration struct { // NetworkInterfaceResourceNames - The resource names object for network interface and related resources. type NetworkInterfaceResourceNames struct { // The full name for network interface. If name is not provided, service uses a default name based on the deployment type. - // For SingleServer, default name is {SID}-Nic. In case of HA-AvZone systems, - // default name will be {SID}-{App/ASCS/DB}-Zone{A/B}-Nic with an incrementor at the end in case of more than 1 instance per - // layer. For distributed and HA-AvSet systems, default name will be - // {SID}-{App/ASCS/DB}-Nic with an incrementor at the end in case of more than 1 instance per layer. + // For SingleServer, default name is {SID}-Nic. In case of HA-AvZone systems, default name will be {SID}-{App/ASCS/DB}-Zone{A/B}-Nic + // with an incrementor at the end in case of more than 1 instance per layer. For distributed and HA-AvSet systems, default + // name will be {SID}-{App/ASCS/DB}-Nic with an incrementor at the end in case of more than 1 instance per layer. NetworkInterfaceName *string } @@ -575,87 +576,28 @@ func (o *OSConfiguration) GetOSConfiguration() *OSConfiguration { return o } // OSProfile - Specifies the operating system settings for the virtual machine. Some of the settings cannot be changed once // VM is provisioned. type OSProfile struct { - // Specifies the password of the administrator account. - // Minimum-length (Windows): 8 characters - // Minimum-length (Linux): 6 characters - // Max-length (Windows): 123 characters - // Max-length (Linux): 72 characters - // Complexity requirements: 3 out of 4 conditions below need to be fulfilled - // Has lower characters - // Has upper characters - // Has a digit - // Has a special character (Regex match [\W_]) - // Disallowed values: "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", - // "Password22", "iloveyou!" - // For resetting the password, see How to reset the Remote Desktop service or its login password in a Windows VM [https://docs.microsoft.com/troubleshoot/azure/virtual-machines/reset-rdp] - // For resetting root password, see Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension - // [https://docs.microsoft.com/troubleshoot/azure/virtual-machines/troubleshoot-ssh-connection] + // Specifies the password of the administrator account.

**Minimum-length (Windows):** 8 characters

**Minimum-length + // (Linux):** 6 characters

**Max-length (Windows):** 123 characters

**Max-length (Linux):** 72 characters + //

**Complexity requirements:** 3 out of 4 conditions below need to be fulfilled
Has lower characters
Has + // upper characters
Has a digit
Has a special character (Regex match [\W_])

**Disallowed values:** "abc@123", + // "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!"

+ // For resetting the password, see [How to reset the Remote Desktop service or its login password in a Windows VM](https://docs.microsoft.com/troubleshoot/azure/virtual-machines/reset-rdp) + //

For resetting root password, see [Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess + // Extension](https://docs.microsoft.com/troubleshoot/azure/virtual-machines/troubleshoot-ssh-connection) AdminPassword *string - // Specifies the name of the administrator account. - // This property cannot be updated after the VM is created. - // Windows-only restriction: Cannot end in "." - // Disallowed values: "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", - // "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", - // "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". - // Minimum-length (Linux): 1 character - // Max-length (Linux): 64 characters - // Max-length (Windows): 20 characters. + // Specifies the name of the administrator account.

This property cannot be updated after the VM is created.

+ // **Windows-only restriction:** Cannot end in "."

**Disallowed values:** "administrator", "admin", "user", "user1", + // "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", + // "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", + // "user5".

**Minimum-length (Linux):** 1 character

**Max-length (Linux):** 64 characters

**Max-length + // (Windows):** 20 characters. AdminUsername *string // Specifies Windows operating system settings on the virtual machine. OSConfiguration OSConfigurationClassification } -// 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 -} - // OperationStatusResult - The current status of an async operation. type OperationStatusResult struct { // REQUIRED; Operation status. @@ -677,7 +619,7 @@ type OperationStatusResult struct { Operations []*OperationStatusResult // Percent of the operation that is complete. - PercentComplete *float32 + PercentComplete *float64 // The start time of the operation. StartTime *time.Time @@ -697,18 +639,18 @@ type SAPApplicationServerInstance struct { // REQUIRED; The geo-location where the resource lives Location *string - // Defines the SAP Application Server instance properties. + // The resource-specific properties for this resource. Properties *SAPApplicationServerProperties // Resource tags. Tags map[string]*string + // READ-ONLY; The name of SAP Application Server instance resource. + Name *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 @@ -716,13 +658,13 @@ type SAPApplicationServerInstance struct { Type *string } -// SAPApplicationServerInstanceList - Defines the collection of SAP Application Server Instance resources. -type SAPApplicationServerInstanceList struct { - // Gets the value of next link. - NextLink *string - - // Gets the list of SAP Application Server instance resources. +// SAPApplicationServerInstanceListResult - The response of a SAPApplicationServerInstance list operation. +type SAPApplicationServerInstanceListResult struct { + // REQUIRED; The SAPApplicationServerInstance items on this page Value []*SAPApplicationServerInstance + + // The link to the next page of items + NextLink *string } // SAPApplicationServerProperties - Defines the SAP Application Server instance properties. @@ -803,32 +745,23 @@ type SAPAvailabilityZonePair struct { ZoneB *int64 } -// SAPCentralInstanceList - Defines the collection of SAP Central Services Instance resources. -type SAPCentralInstanceList struct { - // Gets the value of next link. - NextLink *string - - // Gets the list of SAP central services instance resources. - Value []*SAPCentralServerInstance -} - // SAPCentralServerInstance - Define the SAP Central Services Instance resource. type SAPCentralServerInstance struct { // REQUIRED; The geo-location where the resource lives Location *string - // Defines the SAP Central Services Instance properties. + // The resource-specific properties for this resource. Properties *SAPCentralServerProperties // Resource tags. Tags map[string]*string + // READ-ONLY; Central Services Instance resource name string modeled as parameter for auto generation to work correctly. + Name *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 @@ -836,6 +769,15 @@ type SAPCentralServerInstance struct { Type *string } +// SAPCentralServerInstanceListResult - The response of a SAPCentralServerInstance list operation. +type SAPCentralServerInstanceListResult struct { + // REQUIRED; The SAPCentralServerInstance items on this page + Value []*SAPCentralServerInstance + + // The link to the next page of items + NextLink *string +} + // SAPCentralServerProperties - Defines the SAP Central Services Instance properties. type SAPCentralServerProperties struct { // Defines the SAP Enqueue Replication Server (ERS) properties. @@ -883,7 +825,7 @@ type SAPCentralServerProperties struct { // SAPConfiguration - The SAP Configuration. type SAPConfiguration struct { - // REQUIRED; The configuration Type. + // REQUIRED; The configuration type. Eg: Deployment/Discovery ConfigurationType *SAPConfigurationType } @@ -895,18 +837,18 @@ type SAPDatabaseInstance struct { // REQUIRED; The geo-location where the resource lives Location *string - // Defines the Database properties. + // The resource-specific properties for this resource. Properties *SAPDatabaseProperties // Resource tags. Tags map[string]*string + // READ-ONLY; Database resource name string modeled as parameter for auto generation to work correctly. + Name *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 @@ -914,13 +856,13 @@ type SAPDatabaseInstance struct { Type *string } -// SAPDatabaseInstanceList - Defines the collection of SAP Database Instances. -type SAPDatabaseInstanceList struct { - // Gets the value of next link. - NextLink *string - - // Gets the list of SAP Database instances. +// SAPDatabaseInstanceListResult - The response of a SAPDatabaseInstance list operation. +type SAPDatabaseInstanceListResult struct { + // REQUIRED; The SAPDatabaseInstance items on this page Value []*SAPDatabaseInstance + + // The link to the next page of items + NextLink *string } // SAPDatabaseProperties - Defines the Database properties. @@ -1000,7 +942,8 @@ type SAPInstallWithoutOSConfigSoftwareConfiguration struct { // REQUIRED; The SAP bits storage account id. SapBitsStorageAccountID *string - // REQUIRED; The SAP software installation Type. + // CONSTANT; The SAP software installation Type. + // Field has constant value SAPSoftwareInstallationTypeSAPInstallWithoutOSConfig, any specified value is ignored. SoftwareInstallationType *SAPSoftwareInstallationType // REQUIRED; The software version to install. @@ -1049,7 +992,7 @@ type SAPSizingRecommendationRequest struct { // SAPSizingRecommendationResult - The SAP sizing recommendation result. type SAPSizingRecommendationResult struct { - // REQUIRED; The type of SAP deployment, single server or Three tier. + // REQUIRED; The deployment type. Eg: SingleServer/ThreeTier DeploymentType *SAPDeploymentType } @@ -1102,11 +1045,14 @@ type SAPVirtualInstance struct { // REQUIRED; The geo-location where the resource lives Location *string - // REQUIRED; Defines the Virtual Instance for SAP solutions resource properties. - Properties *SAPVirtualInstanceProperties + // READ-ONLY; The name of the Virtual Instances for SAP solutions resource + Name *string - // Managed service identity (user assigned identities) - Identity *UserAssignedServiceIdentity + // The managed service identities assigned to this resource. + Identity *SAPVirtualInstanceIdentity + + // The resource-specific properties for this resource. + Properties *SAPVirtualInstanceProperties // Resource tags. Tags map[string]*string @@ -1114,9 +1060,6 @@ type SAPVirtualInstance 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 @@ -1130,13 +1073,22 @@ type SAPVirtualInstanceError struct { Properties *ErrorDefinition } -// SAPVirtualInstanceList - Defines the collection of Virtual Instance for SAP solutions resources. -type SAPVirtualInstanceList struct { - // Gets the value of next link. - NextLink *string +// SAPVirtualInstanceIdentity - Managed service identity (user assigned identities) +type SAPVirtualInstanceIdentity struct { + // REQUIRED; The type of managed identity assigned to this resource. + Type *SAPVirtualInstanceIdentityType - // Gets the list of Virtual Instances for SAP solutions resources. + // The identities assigned to this resource by the user. + UserAssignedIdentities map[string]*UserAssignedIdentity +} + +// SAPVirtualInstanceListResult - The response of a SAPVirtualInstance list operation. +type SAPVirtualInstanceListResult struct { + // REQUIRED; The SAPVirtualInstance items on this page Value []*SAPVirtualInstance + + // The link to the next page of items + NextLink *string } // SAPVirtualInstanceProperties - Defines the Virtual Instance for SAP solutions resource properties. @@ -1155,10 +1107,9 @@ type SAPVirtualInstanceProperties struct { ManagedResourceGroupConfiguration *ManagedRGConfiguration // Specifies the network access configuration for the resources that will be deployed in the Managed Resource Group. The options - // to choose from are Public and Private. If 'Private' is chosen, the Storage - // Account service tag should be enabled on the subnets in which the SAP VMs exist. This is required for establishing connectivity - // between VM extensions and the managed resource group storage account. - // This setting is currently applicable only to Storage Account. Learn more here https://go.microsoft.com/fwlink/?linkid=2247228 + // to choose from are Public and Private. If 'Private' is chosen, the Storage Account service tag should be enabled on the + // subnets in which the SAP VMs exist. This is required for establishing connectivity between VM extensions and the managed + // resource group storage account. This setting is currently applicable only to Storage Account. Learn more here https://go.microsoft.com/fwlink/?linkid=2247228 ManagedResourcesNetworkAccessType *ManagedResourcesNetworkAccessType // READ-ONLY; Indicates any errors on the Virtual Instance for SAP solutions resource. @@ -1184,7 +1135,7 @@ type SSHConfiguration struct { } // SSHKeyPair - The SSH Key-pair used to authenticate with the VM. The key needs to be at least 2048-bit and in ssh-rsa format. -// For creating ssh keys, see Create SSH keys on Linux and Mac for Linux VMs in Azure [https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed]. +//

For creating ssh keys, see [Create SSH keys on Linux and Mac for Linux VMs in Azure](https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). type SSHKeyPair struct { // SSH private key. PrivateKey *string @@ -1197,8 +1148,7 @@ type SSHKeyPair struct { // is placed. type SSHPublicKey struct { // SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in ssh-rsa - // format. - // For creating ssh keys, see Create SSH keys on Linux and Mac for Linux VMs in Azure [https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed]. + // format.

For creating ssh keys, see [Create SSH keys on Linux and Mac for Linux VMs in Azure](https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). KeyData *string } @@ -1216,7 +1166,8 @@ type ServiceInitiatedSoftwareConfiguration struct { // REQUIRED; The FQDN to set for the SAP system during install. SapFqdn *string - // REQUIRED; The SAP software installation Type. + // CONSTANT; The SAP software installation Type, service initiated in this case. + // Field has constant value SAPSoftwareInstallationTypeServiceInitiated, any specified value is ignored. SoftwareInstallationType *SAPSoftwareInstallationType // REQUIRED; The software version to install. @@ -1243,12 +1194,13 @@ type SharedStorageResourceNames struct { } // SingleServerConfiguration - Gets or sets the single server configuration. For prerequisites for creating the infrastructure, -// please see here [https://go.microsoft.com/fwlink/?linkid=2212611&clcid=0x409] +// please see [here](https://go.microsoft.com/fwlink/?linkid=2212611&clcid=0x409) type SingleServerConfiguration struct { // REQUIRED; The application resource group where SAP system resources will be deployed. AppResourceGroup *string - // REQUIRED; The type of SAP deployment, single server or Three tier. + // CONSTANT; The type of SAP deployment, single server in this case. + // Field has constant value SAPDeploymentTypeSingleServer, any specified value is ignored. DeploymentType *SAPDeploymentType // REQUIRED; The subnet id. @@ -1281,7 +1233,7 @@ func (s *SingleServerConfiguration) GetInfrastructureConfiguration() *Infrastruc // SingleServerCustomResourceNames - The resource-names input to specify custom names for underlying azure resources that // are part of a single server SAP system. type SingleServerCustomResourceNames struct { - // REQUIRED; The pattern type to be used for resource naming. + // REQUIRED; The naming pattern type. NamingPatternType *NamingPatternType } @@ -1293,7 +1245,8 @@ func (s *SingleServerCustomResourceNames) GetSingleServerCustomResourceNames() * // SingleServerFullResourceNames - The resource name object where the specified values will be full resource names of the // corresponding resources in a single server SAP system. type SingleServerFullResourceNames struct { - // REQUIRED; The pattern type to be used for resource naming. + // CONSTANT; The pattern type to be used for resource naming. + // Field has constant value NamingPatternTypeFullResourceName, any specified value is ignored. NamingPatternType *NamingPatternType // The resource names object for virtual machine and related resources. @@ -1309,7 +1262,7 @@ func (s *SingleServerFullResourceNames) GetSingleServerCustomResourceNames() *Si // SingleServerRecommendationResult - The recommended configuration for a single server SAP system. type SingleServerRecommendationResult struct { - // REQUIRED; The type of SAP deployment, single server or Three tier. + // REQUIRED; The single server SAP deployment type. DeploymentType *SAPDeploymentType // The recommended VM SKU for single server. @@ -1326,8 +1279,9 @@ func (s *SingleServerRecommendationResult) GetSAPSizingRecommendationResult() *S // SkipFileShareConfiguration - Gets or sets the file share configuration for scenarios where transport directory fileshare // is not created or required. type SkipFileShareConfiguration struct { - // REQUIRED; The type of file share config. - ConfigurationType *ConfigurationType + // CONSTANT; The type of file share config, skip in this case i.e. fileshare is not created or required. + // Field has constant value FileShareConfigurationTypeSkip, any specified value is ignored. + ConfigurationType *FileShareConfigurationType } // GetFileShareConfiguration implements the FileShareConfigurationClassification interface for type SkipFileShareConfiguration. @@ -1339,7 +1293,7 @@ func (s *SkipFileShareConfiguration) GetFileShareConfiguration() *FileShareConfi // SoftwareConfiguration - The SAP Software configuration Input. type SoftwareConfiguration struct { - // REQUIRED; The SAP software installation Type. + // REQUIRED; The SAP software installation type. SoftwareInstallationType *SAPSoftwareInstallationType } @@ -1358,8 +1312,8 @@ type StopRequest struct { DeallocateVM *bool // This parameter defines how long (in seconds) the soft shutdown waits until the RFC/HTTP clients no longer consider the - // server for calls with load balancing. Value 0 means that the kernel does not - // wait, but goes directly into the next shutdown state, i.e. hard stop. + // server for calls with load balancing. Value 0 means that the kernel does not wait, but goes directly into the next shutdown + // state, i.e. hard stop. SoftStopTimeoutSeconds *int64 } @@ -1372,7 +1326,7 @@ type StorageConfiguration struct { // StorageInformation - Storage details of all the Storage accounts attached to the VM. For e.g. NFS on AFS Shared Storage. type StorageInformation struct { - // READ-ONLY + // READ-ONLY; Fully qualified resource ID for the storage account. ID *string } @@ -1398,7 +1352,7 @@ type SystemData struct { } // ThreeTierConfiguration - Gets or sets the three tier SAP configuration. For prerequisites for creating the infrastructure, -// please see here [https://go.microsoft.com/fwlink/?linkid=2212611&clcid=0x409] +// please see [here](https://go.microsoft.com/fwlink/?linkid=2212611&clcid=0x409) type ThreeTierConfiguration struct { // REQUIRED; The application resource group where SAP system resources will be deployed. AppResourceGroup *string @@ -1412,7 +1366,8 @@ type ThreeTierConfiguration struct { // REQUIRED; The database configuration. DatabaseServer *DatabaseConfiguration - // REQUIRED; The type of SAP deployment, single server or Three tier. + // CONSTANT; The type of SAP deployment, ThreeTier in this case. + // Field has constant value SAPDeploymentTypeThreeTier, any specified value is ignored. DeploymentType *SAPDeploymentType // The set of custom names to be used for underlying azure resources that are part of the SAP system. @@ -1451,7 +1406,8 @@ func (t *ThreeTierCustomResourceNames) GetThreeTierCustomResourceNames() *ThreeT // ThreeTierFullResourceNames - The resource name object where the specified values will be full resource names of the corresponding // resources in a three tier SAP system. type ThreeTierFullResourceNames struct { - // REQUIRED; The pattern type to be used for resource naming. + // CONSTANT; The pattern type to be used for resource naming, FullResourceName in this case. + // Field has constant value NamingPatternTypeFullResourceName, any specified value is ignored. NamingPatternType *NamingPatternType // The full resource names object for application layer resources. The number of entries in this list should be equal to the @@ -1478,7 +1434,7 @@ func (t *ThreeTierFullResourceNames) GetThreeTierCustomResourceNames() *ThreeTie // ThreeTierRecommendationResult - The recommended configuration for a three tier SAP system. type ThreeTierRecommendationResult struct { - // REQUIRED; The type of SAP deployment, single server or Three tier. + // REQUIRED; The three tier SAP deployment type. DeploymentType *SAPDeploymentType // The application server instance count. @@ -1525,22 +1481,21 @@ type UpdateSAPDatabaseInstanceRequest struct { Tags map[string]*string } -// UpdateSAPVirtualInstanceProperties - Defines the properties to be updated for Virtual Instance for SAP. +// UpdateSAPVirtualInstanceProperties - Defines the update request body properties for updating Virtual Instance for SAP. type UpdateSAPVirtualInstanceProperties struct { // Specifies the network access configuration for the resources that will be deployed in the Managed Resource Group. The options - // to choose from are Public and Private. If 'Private' is chosen, the Storage - // Account service tag should be enabled on the subnets in which the SAP VMs exist. This is required for establishing connectivity - // between VM extensions and the managed resource group storage account. - // This setting is currently applicable only to Storage Account. Learn more here https://go.microsoft.com/fwlink/?linkid=2247228 + // to choose from are Public and Private. If 'Private' is chosen, the Storage Account service tag should be enabled on the + // subnets in which the SAP VMs exist. This is required for establishing connectivity between VM extensions and the managed + // resource group storage account. This setting is currently applicable only to Storage Account. Learn more here https://go.microsoft.com/fwlink/?linkid=2247228 ManagedResourcesNetworkAccessType *ManagedResourcesNetworkAccessType } // UpdateSAPVirtualInstanceRequest - Defines the request body for updating Virtual Instance for SAP. type UpdateSAPVirtualInstanceRequest struct { // Managed service identity (user assigned identities) - Identity *UserAssignedServiceIdentity + Identity *SAPVirtualInstanceIdentity - // Defines the properties to be updated for Virtual Instance for SAP. + // The update properties. Properties *UpdateSAPVirtualInstanceProperties // Gets or sets the Resource tags. @@ -1556,15 +1511,6 @@ type UserAssignedIdentity struct { PrincipalID *string } -// UserAssignedServiceIdentity - Managed service identity (user assigned identities) -type UserAssignedServiceIdentity struct { - // REQUIRED; Type of manage identity - Type *ManagedServiceIdentityType - - // User assigned identities dictionary - UserAssignedIdentities map[string]*UserAssignedIdentity -} - // VirtualMachineConfiguration - Defines the virtual machine configuration. type VirtualMachineConfiguration struct { // REQUIRED; The image reference. @@ -1580,13 +1526,12 @@ type VirtualMachineConfiguration struct { // VirtualMachineResourceNames - The resource names object for virtual machine and related resources. type VirtualMachineResourceNames struct { // The full resource names for virtual machine data disks. This is a dictionary containing list of names of data disks per - // volume. Currently supported volumes for database layer are ['hana/data', - // 'hana/log', hana/shared', 'usr/sap', 'os', 'backup']. For application and cs layers, only 'default' volume is supported + // volume. Currently supported volumes for database layer are ['hana/data', 'hana/log', hana/shared', 'usr/sap', 'os', 'backup']. + // For application and cs layers, only 'default' volume is supported DataDiskNames map[string][]*string // The full name for virtual-machine's host (computer name). Currently, ACSS only supports host names which are less than - // or equal to 13 characters long. If this value is not provided, vmName will be - // used as host name. + // or equal to 13 characters long. If this value is not provided, vmName will be used as host name. HostName *string // The list of network interface name objects for the selected virtual machine. Currently, only one network interface is supported @@ -1594,21 +1539,21 @@ type VirtualMachineResourceNames struct { NetworkInterfaces []*NetworkInterfaceResourceNames // The full name for OS disk attached to the VM. If this value is not provided, it will be named by ARM as per its default - // naming standards (prefixed with vm name). There is only one OS disk attached per - // Virtual Machine. + // naming standards (prefixed with vm name). There is only one OS disk attached per Virtual Machine. OSDiskName *string // The full name for virtual machine. The length of this field can be upto 64 characters. If name is not provided, service - // uses a default name based on the deployment type. For SingleServer, default name - // is {SID}vm. In case of HA-AvZone systems, default name will be {SID}{app/ascs/db}z{a/b}vm with an incrementor at the end - // in case of more than 1 vm per layer. For distributed and HA-AvSet systems, - // default name will be {SID}{app/ascs/db}vm with an incrementor at the end in case of more than 1 vm per layer. + // uses a default name based on the deployment type. For SingleServer, default name is {SID}vm. In case of HA-AvZone systems, + // default name will be {SID}{app/ascs/db}z{a/b}vm with an incrementor at the end in case of more than 1 vm per layer. For + // distributed and HA-AvSet systems, default name will be {SID}{app/ascs/db}vm with an incrementor at the end in case of more + // than 1 vm per layer. VMName *string } // WindowsConfiguration - Specifies Windows operating system settings on the virtual machine. type WindowsConfiguration struct { - // REQUIRED; The OS Type + // CONSTANT; The OS Type + // Field has constant value OSTypeWindows, any specified value is ignored. OSType *OSType } diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/models_serde.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/models_serde.go index a4cbf08d5ef7..77703778cf0b 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/models_serde.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/models_serde.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armworkloadssapvirtualinstance @@ -224,7 +220,7 @@ func (c *CentralServerVMDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CreateAndMountFileShareConfiguration. func (c CreateAndMountFileShareConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["configurationType"] = ConfigurationTypeCreateAndMount + objectMap["configurationType"] = FileShareConfigurationTypeCreateAndMount populate(objectMap, "resourceGroup", c.ResourceGroup) populate(objectMap, "storageAccountName", c.StorageAccountName) return json.Marshal(objectMap) @@ -754,7 +750,7 @@ func (e *EnqueueServerProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateAny(objectMap, "info", e.Info) + populate(objectMap, "info", e.Info) populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } @@ -894,7 +890,7 @@ func (e *ExternalInstallationSoftwareConfiguration) UnmarshalJSON(data []byte) e // MarshalJSON implements the json.Marshaller interface for type FileShareConfiguration. func (f FileShareConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["configurationType"] = f.ConfigurationType + populate(objectMap, "configurationType", f.ConfigurationType) return json.Marshal(objectMap) } @@ -1054,7 +1050,7 @@ func (i *ImageReference) UnmarshalJSON(data []byte) error { func (i InfrastructureConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "appResourceGroup", i.AppResourceGroup) - objectMap["deploymentType"] = i.DeploymentType + populate(objectMap, "deploymentType", i.DeploymentType) return json.Marshal(objectMap) } @@ -1267,7 +1263,7 @@ func (m *MessageServerProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MountFileShareConfiguration. func (m MountFileShareConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["configurationType"] = ConfigurationTypeMount + objectMap["configurationType"] = FileShareConfigurationTypeMount populate(objectMap, "id", m.ID) populate(objectMap, "privateEndpointId", m.PrivateEndpointID) return json.Marshal(objectMap) @@ -1356,7 +1352,7 @@ func (n *NetworkInterfaceResourceNames) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type OSConfiguration. func (o OSConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["osType"] = o.OSType + populate(objectMap, "osType", o.OSType) return json.Marshal(objectMap) } @@ -1415,119 +1411,6 @@ func (o *OSProfile) UnmarshalJSON(data []byte) error { 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 OperationStatusResult. func (o OperationStatusResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1665,16 +1548,16 @@ func (s *SAPApplicationServerInstance) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SAPApplicationServerInstanceList. -func (s SAPApplicationServerInstanceList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SAPApplicationServerInstanceListResult. +func (s SAPApplicationServerInstanceListResult) 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 SAPApplicationServerInstanceList. -func (s *SAPApplicationServerInstanceList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SAPApplicationServerInstanceListResult. +func (s *SAPApplicationServerInstanceListResult) UnmarshalJSON(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) @@ -1876,37 +1759,6 @@ func (s *SAPAvailabilityZonePair) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SAPCentralInstanceList. -func (s SAPCentralInstanceList) 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 SAPCentralInstanceList. -func (s *SAPCentralInstanceList) UnmarshalJSON(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 SAPCentralServerInstance. func (s SAPCentralServerInstance) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1958,6 +1810,37 @@ func (s *SAPCentralServerInstance) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type SAPCentralServerInstanceListResult. +func (s SAPCentralServerInstanceListResult) 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 SAPCentralServerInstanceListResult. +func (s *SAPCentralServerInstanceListResult) UnmarshalJSON(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 SAPCentralServerProperties. func (s SAPCentralServerProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2040,7 +1923,7 @@ func (s *SAPCentralServerProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SAPConfiguration. func (s SAPConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["configurationType"] = s.ConfigurationType + populate(objectMap, "configurationType", s.ConfigurationType) return json.Marshal(objectMap) } @@ -2115,16 +1998,16 @@ func (s *SAPDatabaseInstance) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SAPDatabaseInstanceList. -func (s SAPDatabaseInstanceList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SAPDatabaseInstanceListResult. +func (s SAPDatabaseInstanceListResult) 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 SAPDatabaseInstanceList. -func (s *SAPDatabaseInstanceList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SAPDatabaseInstanceListResult. +func (s *SAPDatabaseInstanceListResult) UnmarshalJSON(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) @@ -2415,7 +2298,7 @@ func (s *SAPSizingRecommendationRequest) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SAPSizingRecommendationResult. func (s SAPSizingRecommendationResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["deploymentType"] = s.DeploymentType + populate(objectMap, "deploymentType", s.DeploymentType) return json.Marshal(objectMap) } @@ -2630,16 +2513,47 @@ func (s *SAPVirtualInstanceError) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SAPVirtualInstanceList. -func (s SAPVirtualInstanceList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SAPVirtualInstanceIdentity. +func (s SAPVirtualInstanceIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "type", s.Type) + populate(objectMap, "userAssignedIdentities", s.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SAPVirtualInstanceIdentity. +func (s *SAPVirtualInstanceIdentity) UnmarshalJSON(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 "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &s.UserAssignedIdentities) + 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 SAPVirtualInstanceListResult. +func (s SAPVirtualInstanceListResult) 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 SAPVirtualInstanceList. -func (s *SAPVirtualInstanceList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SAPVirtualInstanceListResult. +func (s *SAPVirtualInstanceListResult) UnmarshalJSON(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) @@ -2949,7 +2863,7 @@ func (s *SingleServerConfiguration) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SingleServerCustomResourceNames. func (s SingleServerCustomResourceNames) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["namingPatternType"] = s.NamingPatternType + populate(objectMap, "namingPatternType", s.NamingPatternType) return json.Marshal(objectMap) } @@ -3038,7 +2952,7 @@ func (s *SingleServerRecommendationResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SkipFileShareConfiguration. func (s SkipFileShareConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["configurationType"] = ConfigurationTypeSkip + objectMap["configurationType"] = FileShareConfigurationTypeSkip return json.Marshal(objectMap) } @@ -3065,7 +2979,7 @@ func (s *SkipFileShareConfiguration) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SoftwareConfiguration. func (s SoftwareConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["softwareInstallationType"] = s.SoftwareInstallationType + populate(objectMap, "softwareInstallationType", s.SoftwareInstallationType) return json.Marshal(objectMap) } @@ -3310,7 +3224,7 @@ func (t *ThreeTierConfiguration) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ThreeTierCustomResourceNames. func (t ThreeTierCustomResourceNames) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["namingPatternType"] = t.NamingPatternType + populate(objectMap, "namingPatternType", t.NamingPatternType) return json.Marshal(objectMap) } @@ -3602,37 +3516,6 @@ func (u *UserAssignedIdentity) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type UserAssignedServiceIdentity. -func (u UserAssignedServiceIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "type", u.Type) - populate(objectMap, "userAssignedIdentities", u.UserAssignedIdentities) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedServiceIdentity. -func (u *UserAssignedServiceIdentity) UnmarshalJSON(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 "type": - err = unpopulate(val, "Type", &u.Type) - delete(rawMsg, key) - case "userAssignedIdentities": - err = unpopulate(val, "UserAssignedIdentities", &u.UserAssignedIdentities) - 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 VirtualMachineConfiguration. func (v VirtualMachineConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -3748,16 +3631,6 @@ func populate(m map[string]any, k string, v any) { } } -func populateAny(m map[string]any, k string, v any) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else { - m[k] = v - } -} - func unpopulate(data json.RawMessage, fn string, v any) error { if data == nil || string(data) == "null" { return nil diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/operations_client_example_test.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/operations_client_example_test.go deleted file mode 100644 index 5d08b8a4c4be..000000000000 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/operations_client_example_test.go +++ /dev/null @@ -1,316 +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 armworkloadssapvirtualinstance_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/operations/preview/2023-10-01-preview/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 := armworkloadssapvirtualinstance.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.OperationListResult = armworkloadssapvirtualinstance.OperationListResult{ - // Value: []*armworkloadssapvirtualinstance.Operation{ - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/read"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Gets a list of SAP monitors in the specified subscription. The operations returns various properties of each SAP monitor."), - // Operation: to.Ptr("monitors_List"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/read"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Gets a list of SAP monitors in the specified resource group."), - // Operation: to.Ptr("monitors_ListByResourceGroup"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/read"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Gets properties of a SAP monitor for the specified subscription, resource group, and resource name."), - // Operation: to.Ptr("monitors_Get"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/write"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Creates a SAP monitor for the specified subscription, resource group, and resource name."), - // Operation: to.Ptr("monitors_Create"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/delete"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Deletes a SAP monitor with the specified subscription, resource group, and monitor name."), - // Operation: to.Ptr("monitors_Delete"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/write"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Patches the Tags field of a SAP monitor for the specified subscription, resource group, and monitor name."), - // Operation: to.Ptr("monitors_Update"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/providerInstances/read"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Gets a list of provider instances in the specified SAP monitor. The operations returns various properties of each provider instances."), - // Operation: to.Ptr("ProviderInstances_List"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors/providerInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/providerInstances/read"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Gets properties of a provider instance for the specified subscription, resource group, Monitor name, and resource name."), - // Operation: to.Ptr("ProviderInstances_Get"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors/providerInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/providerInstances/write"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Creates a provider instance for the specified subscription, resource group, Monitor name, and resource name."), - // Operation: to.Ptr("ProviderInstances_Create"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors/providerInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/providerInstances/delete"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Deletes a provider instance for the specified subscription, resource group, Monitor name, and resource name."), - // Operation: to.Ptr("ProviderInstances_Delete"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors/providerInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/sapLandscapeMonitor/read"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Gets a list of properties of a SAP Landscape monitor configuration for the specified subscription, resource group, and resource name."), - // Operation: to.Ptr("SapLandscapeMonitor_List"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors/sapLandscapeMonitor"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/sapLandscapeMonitor/read"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Gets properties of a SAP Landscape monitor configuration for the specified subscription, resource group, and resource name."), - // Operation: to.Ptr("SapLandscapeMonitor_Get"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors/sapLandscapeMonitor"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/sapLandscapeMonitor/write"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Creates a SAP Landscape monitor configuration for the specified subscription, resource group, and resource name."), - // Operation: to.Ptr("SapLandscapeMonitor_Create"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors/sapLandscapeMonitor"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/sapLandscapeMonitor/delete"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Deletes a SAP Landscape monitor configuration with the specified subscription, resource group, and monitor name."), - // Operation: to.Ptr("SapLandscapeMonitor_Delete"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors/sapLandscapeMonitor"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/SapDiscoverySites/Write"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Set SapDiscoverySites"), - // Operation: to.Ptr("Creates or updates the SapDiscoverySites"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("SapDiscoverySites"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/SapDiscoverySites/Delete"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Delete SapDiscoverySites"), - // Operation: to.Ptr("Deletes the SapDiscoverySites"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("SapDiscoverySites"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/SapDiscoverySites/Read"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Read SapDiscoverySites"), - // Operation: to.Ptr("Reads the SapDiscoverySites"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("SapDiscoverySites"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/SapDiscoverySites/SapInstances/Write"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Set SapInstances"), - // Operation: to.Ptr("Creates or updates the SapInstances"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("SapInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/SapDiscoverySites/SapInstances/Delete"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Delete SapInstances"), - // Operation: to.Ptr("Deletes the SapInstances"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("SapInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/SapDiscoverySites/SapInstances/Read"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Read SapInstances"), - // Operation: to.Ptr("Reads the SapInstances"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("SapInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/SapDiscoverySites/SapInstances/serverInstances/Write"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Set serverInstances"), - // Operation: to.Ptr("Creates or updates the serverInstances"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("serverInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/SapDiscoverySites/SapInstances/serverInstances/Delete"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Delete serverInstances"), - // Operation: to.Ptr("Deletes the serverInstances"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("serverInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/SapDiscoverySites/SapInstances/serverInstances/Read"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Read serverInstances"), - // Operation: to.Ptr("Reads the serverInstances"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("serverInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/connectors/Write"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Set connectors"), - // Operation: to.Ptr("Creates or updates the connectors"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("connectors"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/connectors/Read"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Read connectors"), - // Operation: to.Ptr("Reads the connectors"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("connectors"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/connectors/acssBackups/Write"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Set acssBackups"), - // Operation: to.Ptr("Creates or updates the acssBackups"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("acssBackups"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/connectors/acssBackups/Read"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Read acssBackups"), - // Operation: to.Ptr("Reads the acssBackups"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("acssBackups"), - // }, - // IsDataAction: to.Ptr(false), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/options.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/options.go index af565915360c..bee0753c9532 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/options.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/options.go @@ -1,50 +1,41 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armworkloadssapvirtualinstance -// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -type OperationsClientListOptions struct { - // placeholder for future optional parameters -} - // SAPApplicationServerInstancesClientBeginCreateOptions contains the optional parameters for the SAPApplicationServerInstancesClient.BeginCreate // method. type SAPApplicationServerInstancesClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // SAPApplicationServerInstancesClientBeginDeleteOptions contains the optional parameters for the SAPApplicationServerInstancesClient.BeginDelete // method. type SAPApplicationServerInstancesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } -// SAPApplicationServerInstancesClientBeginStartInstanceOptions contains the optional parameters for the SAPApplicationServerInstancesClient.BeginStartInstance +// SAPApplicationServerInstancesClientBeginStartOptions contains the optional parameters for the SAPApplicationServerInstancesClient.BeginStart // method. -type SAPApplicationServerInstancesClientBeginStartInstanceOptions struct { +type SAPApplicationServerInstancesClientBeginStartOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string + // SAP Application server instance start request body. Body *StartRequest - - // Resumes the LRO from the provided token. - ResumeToken string } -// SAPApplicationServerInstancesClientBeginStopInstanceOptions contains the optional parameters for the SAPApplicationServerInstancesClient.BeginStopInstance +// SAPApplicationServerInstancesClientBeginStopOptions contains the optional parameters for the SAPApplicationServerInstancesClient.BeginStop // method. -type SAPApplicationServerInstancesClientBeginStopInstanceOptions struct { +type SAPApplicationServerInstancesClientBeginStopOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string + // SAP Application server instance stop request body. Body *StopRequest - - // Resumes the LRO from the provided token. - ResumeToken string } // SAPApplicationServerInstancesClientGetOptions contains the optional parameters for the SAPApplicationServerInstancesClient.Get @@ -65,87 +56,90 @@ type SAPApplicationServerInstancesClientUpdateOptions struct { // placeholder for future optional parameters } -// SAPCentralInstancesClientBeginCreateOptions contains the optional parameters for the SAPCentralInstancesClient.BeginCreate +// SAPCentralServerInstancesClientBeginCreateOptions contains the optional parameters for the SAPCentralServerInstancesClient.BeginCreate // method. -type SAPCentralInstancesClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. +type SAPCentralServerInstancesClientBeginCreateOptions struct { + // Resumes the long-running operation from the provided token. ResumeToken string } -// SAPCentralInstancesClientBeginDeleteOptions contains the optional parameters for the SAPCentralInstancesClient.BeginDelete +// SAPCentralServerInstancesClientBeginDeleteOptions contains the optional parameters for the SAPCentralServerInstancesClient.BeginDelete // method. -type SAPCentralInstancesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. +type SAPCentralServerInstancesClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. ResumeToken string } -// SAPCentralInstancesClientBeginStartInstanceOptions contains the optional parameters for the SAPCentralInstancesClient.BeginStartInstance +// SAPCentralServerInstancesClientBeginStartOptions contains the optional parameters for the SAPCentralServerInstancesClient.BeginStart // method. -type SAPCentralInstancesClientBeginStartInstanceOptions struct { +type SAPCentralServerInstancesClientBeginStartOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string + // SAP Central Services instance start request body. Body *StartRequest - - // Resumes the LRO from the provided token. - ResumeToken string } -// SAPCentralInstancesClientBeginStopInstanceOptions contains the optional parameters for the SAPCentralInstancesClient.BeginStopInstance +// SAPCentralServerInstancesClientBeginStopOptions contains the optional parameters for the SAPCentralServerInstancesClient.BeginStop // method. -type SAPCentralInstancesClientBeginStopInstanceOptions struct { +type SAPCentralServerInstancesClientBeginStopOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string + // SAP Central Services instance stop request body. Body *StopRequest - - // Resumes the LRO from the provided token. - ResumeToken string } -// SAPCentralInstancesClientGetOptions contains the optional parameters for the SAPCentralInstancesClient.Get method. -type SAPCentralInstancesClientGetOptions struct { +// SAPCentralServerInstancesClientGetOptions contains the optional parameters for the SAPCentralServerInstancesClient.Get +// method. +type SAPCentralServerInstancesClientGetOptions struct { // placeholder for future optional parameters } -// SAPCentralInstancesClientListOptions contains the optional parameters for the SAPCentralInstancesClient.NewListPager method. -type SAPCentralInstancesClientListOptions struct { +// SAPCentralServerInstancesClientListOptions contains the optional parameters for the SAPCentralServerInstancesClient.NewListPager +// method. +type SAPCentralServerInstancesClientListOptions struct { // placeholder for future optional parameters } -// SAPCentralInstancesClientUpdateOptions contains the optional parameters for the SAPCentralInstancesClient.Update method. -type SAPCentralInstancesClientUpdateOptions struct { +// SAPCentralServerInstancesClientUpdateOptions contains the optional parameters for the SAPCentralServerInstancesClient.Update +// method. +type SAPCentralServerInstancesClientUpdateOptions struct { // placeholder for future optional parameters } // SAPDatabaseInstancesClientBeginCreateOptions contains the optional parameters for the SAPDatabaseInstancesClient.BeginCreate // method. type SAPDatabaseInstancesClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // SAPDatabaseInstancesClientBeginDeleteOptions contains the optional parameters for the SAPDatabaseInstancesClient.BeginDelete // method. type SAPDatabaseInstancesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } -// SAPDatabaseInstancesClientBeginStartInstanceOptions contains the optional parameters for the SAPDatabaseInstancesClient.BeginStartInstance +// SAPDatabaseInstancesClientBeginStartOptions contains the optional parameters for the SAPDatabaseInstancesClient.BeginStart // method. -type SAPDatabaseInstancesClientBeginStartInstanceOptions struct { +type SAPDatabaseInstancesClientBeginStartOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string + // SAP Database server instance start request body. Body *StartRequest - - // Resumes the LRO from the provided token. - ResumeToken string } -// SAPDatabaseInstancesClientBeginStopInstanceOptions contains the optional parameters for the SAPDatabaseInstancesClient.BeginStopInstance +// SAPDatabaseInstancesClientBeginStopOptions contains the optional parameters for the SAPDatabaseInstancesClient.BeginStop // method. -type SAPDatabaseInstancesClientBeginStopInstanceOptions struct { +type SAPDatabaseInstancesClientBeginStopOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string + // Stop request for the database instance of the SAP system. Body *StopRequest - - // Resumes the LRO from the provided token. - ResumeToken string } // SAPDatabaseInstancesClientGetOptions contains the optional parameters for the SAPDatabaseInstancesClient.Get method. @@ -167,84 +161,81 @@ type SAPDatabaseInstancesClientUpdateOptions struct { // SAPVirtualInstancesClientBeginCreateOptions contains the optional parameters for the SAPVirtualInstancesClient.BeginCreate // method. type SAPVirtualInstancesClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // SAPVirtualInstancesClientBeginDeleteOptions contains the optional parameters for the SAPVirtualInstancesClient.BeginDelete // method. type SAPVirtualInstancesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // SAPVirtualInstancesClientBeginStartOptions contains the optional parameters for the SAPVirtualInstancesClient.BeginStart // method. type SAPVirtualInstancesClientBeginStartOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string + // The Virtual Instance for SAP solutions resource start request body. Body *StartRequest - - // Resumes the LRO from the provided token. - ResumeToken string } // SAPVirtualInstancesClientBeginStopOptions contains the optional parameters for the SAPVirtualInstancesClient.BeginStop // method. type SAPVirtualInstancesClientBeginStopOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string + // The Virtual Instance for SAP solutions resource stop request body. Body *StopRequest - - // Resumes the LRO from the provided token. - ResumeToken string } // SAPVirtualInstancesClientBeginUpdateOptions contains the optional parameters for the SAPVirtualInstancesClient.BeginUpdate // method. type SAPVirtualInstancesClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } -// SAPVirtualInstancesClientGetOptions contains the optional parameters for the SAPVirtualInstancesClient.Get method. -type SAPVirtualInstancesClientGetOptions struct { +// SAPVirtualInstancesClientGetAvailabilityZoneDetailsOptions contains the optional parameters for the SAPVirtualInstancesClient.GetAvailabilityZoneDetails +// method. +type SAPVirtualInstancesClientGetAvailabilityZoneDetailsOptions struct { // placeholder for future optional parameters } -// SAPVirtualInstancesClientListByResourceGroupOptions contains the optional parameters for the SAPVirtualInstancesClient.NewListByResourceGroupPager +// SAPVirtualInstancesClientGetDiskConfigurationsOptions contains the optional parameters for the SAPVirtualInstancesClient.GetDiskConfigurations // method. -type SAPVirtualInstancesClientListByResourceGroupOptions struct { +type SAPVirtualInstancesClientGetDiskConfigurationsOptions struct { // placeholder for future optional parameters } -// SAPVirtualInstancesClientListBySubscriptionOptions contains the optional parameters for the SAPVirtualInstancesClient.NewListBySubscriptionPager -// method. -type SAPVirtualInstancesClientListBySubscriptionOptions struct { +// SAPVirtualInstancesClientGetOptions contains the optional parameters for the SAPVirtualInstancesClient.Get method. +type SAPVirtualInstancesClientGetOptions struct { // placeholder for future optional parameters } -// WorkloadsClientSAPAvailabilityZoneDetailsOptions contains the optional parameters for the WorkloadsClient.SAPAvailabilityZoneDetails +// SAPVirtualInstancesClientGetSapSupportedSKUOptions contains the optional parameters for the SAPVirtualInstancesClient.GetSapSupportedSKU // method. -type WorkloadsClientSAPAvailabilityZoneDetailsOptions struct { - // SAP Availability Zone Details Request body - SAPAvailabilityZoneDetails *SAPAvailabilityZoneDetailsRequest +type SAPVirtualInstancesClientGetSapSupportedSKUOptions struct { + // placeholder for future optional parameters } -// WorkloadsClientSAPDiskConfigurationsOptions contains the optional parameters for the WorkloadsClient.SAPDiskConfigurations +// SAPVirtualInstancesClientGetSizingRecommendationsOptions contains the optional parameters for the SAPVirtualInstancesClient.GetSizingRecommendations // method. -type WorkloadsClientSAPDiskConfigurationsOptions struct { - // SAP Disk Configurations Request body - SAPDiskConfigurations *SAPDiskConfigurationsRequest +type SAPVirtualInstancesClientGetSizingRecommendationsOptions struct { + // placeholder for future optional parameters } -// WorkloadsClientSAPSizingRecommendationsOptions contains the optional parameters for the WorkloadsClient.SAPSizingRecommendations +// SAPVirtualInstancesClientListByResourceGroupOptions contains the optional parameters for the SAPVirtualInstancesClient.NewListByResourceGroupPager // method. -type WorkloadsClientSAPSizingRecommendationsOptions struct { - // SAP Sizing Recommendation Request body - SAPSizingRecommendation *SAPSizingRecommendationRequest +type SAPVirtualInstancesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters } -// WorkloadsClientSAPSupportedSKUOptions contains the optional parameters for the WorkloadsClient.SAPSupportedSKU method. -type WorkloadsClientSAPSupportedSKUOptions struct { - // SAP Supported SKU Request body - SAPSupportedSKU *SAPSupportedSKUsRequest +// SAPVirtualInstancesClientListBySubscriptionOptions contains the optional parameters for the SAPVirtualInstancesClient.NewListBySubscriptionPager +// method. +type SAPVirtualInstancesClientListBySubscriptionOptions struct { + // placeholder for future optional parameters } diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/polymorphic_helpers.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/polymorphic_helpers.go index 0d6862f0c70c..ccad72c54fb3 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/polymorphic_helpers.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/polymorphic_helpers.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armworkloadssapvirtualinstance @@ -20,12 +16,12 @@ func unmarshalFileShareConfigurationClassification(rawMsg json.RawMessage) (File } var b FileShareConfigurationClassification switch m["configurationType"] { - case string(ConfigurationTypeCreateAndMount): + case string(FileShareConfigurationTypeSkip): + b = &SkipFileShareConfiguration{} + case string(FileShareConfigurationTypeCreateAndMount): b = &CreateAndMountFileShareConfiguration{} - case string(ConfigurationTypeMount): + case string(FileShareConfigurationTypeMount): b = &MountFileShareConfiguration{} - case string(ConfigurationTypeSkip): - b = &SkipFileShareConfiguration{} default: b = &FileShareConfiguration{} } @@ -68,10 +64,10 @@ func unmarshalOSConfigurationClassification(rawMsg json.RawMessage) (OSConfigura } var b OSConfigurationClassification switch m["osType"] { - case string(OSTypeLinux): - b = &LinuxConfiguration{} case string(OSTypeWindows): b = &WindowsConfiguration{} + case string(OSTypeLinux): + b = &LinuxConfiguration{} default: b = &OSConfiguration{} } @@ -91,12 +87,12 @@ func unmarshalSAPConfigurationClassification(rawMsg json.RawMessage) (SAPConfigu } var b SAPConfigurationClassification switch m["configurationType"] { + case string(SAPConfigurationTypeDiscovery): + b = &DiscoveryConfiguration{} case string(SAPConfigurationTypeDeployment): b = &DeploymentConfiguration{} case string(SAPConfigurationTypeDeploymentWithOSConfig): b = &DeploymentWithOSConfiguration{} - case string(SAPConfigurationTypeDiscovery): - b = &DiscoveryConfiguration{} default: b = &SAPConfiguration{} } @@ -160,12 +156,12 @@ func unmarshalSoftwareConfigurationClassification(rawMsg json.RawMessage) (Softw } var b SoftwareConfigurationClassification switch m["softwareInstallationType"] { - case string(SAPSoftwareInstallationTypeExternal): - b = &ExternalInstallationSoftwareConfiguration{} - case string(SAPSoftwareInstallationTypeSAPInstallWithoutOSConfig): - b = &SAPInstallWithoutOSConfigSoftwareConfiguration{} case string(SAPSoftwareInstallationTypeServiceInitiated): b = &ServiceInitiatedSoftwareConfiguration{} + case string(SAPSoftwareInstallationTypeSAPInstallWithoutOSConfig): + b = &SAPInstallWithoutOSConfigSoftwareConfiguration{} + case string(SAPSoftwareInstallationTypeExternal): + b = &ExternalInstallationSoftwareConfiguration{} default: b = &SoftwareConfiguration{} } diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/responses.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/responses.go index 46127783a0b7..35faa70f98af 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/responses.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/responses.go @@ -1,19 +1,9 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armworkloadssapvirtualinstance -// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. -type OperationsClientListResponse struct { - // 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 -} - // SAPApplicationServerInstancesClientCreateResponse contains the response from method SAPApplicationServerInstancesClient.BeginCreate. type SAPApplicationServerInstancesClientCreateResponse struct { // Define the SAP Application Server Instance resource. @@ -33,18 +23,18 @@ type SAPApplicationServerInstancesClientGetResponse struct { // SAPApplicationServerInstancesClientListResponse contains the response from method SAPApplicationServerInstancesClient.NewListPager. type SAPApplicationServerInstancesClientListResponse struct { - // Defines the collection of SAP Application Server Instance resources. - SAPApplicationServerInstanceList + // The response of a SAPApplicationServerInstance list operation. + SAPApplicationServerInstanceListResult } -// SAPApplicationServerInstancesClientStartInstanceResponse contains the response from method SAPApplicationServerInstancesClient.BeginStartInstance. -type SAPApplicationServerInstancesClientStartInstanceResponse struct { +// SAPApplicationServerInstancesClientStartResponse contains the response from method SAPApplicationServerInstancesClient.BeginStart. +type SAPApplicationServerInstancesClientStartResponse struct { // The current status of an async operation. OperationStatusResult } -// SAPApplicationServerInstancesClientStopInstanceResponse contains the response from method SAPApplicationServerInstancesClient.BeginStopInstance. -type SAPApplicationServerInstancesClientStopInstanceResponse struct { +// SAPApplicationServerInstancesClientStopResponse contains the response from method SAPApplicationServerInstancesClient.BeginStop. +type SAPApplicationServerInstancesClientStopResponse struct { // The current status of an async operation. OperationStatusResult } @@ -55,43 +45,43 @@ type SAPApplicationServerInstancesClientUpdateResponse struct { SAPApplicationServerInstance } -// SAPCentralInstancesClientCreateResponse contains the response from method SAPCentralInstancesClient.BeginCreate. -type SAPCentralInstancesClientCreateResponse struct { +// SAPCentralServerInstancesClientCreateResponse contains the response from method SAPCentralServerInstancesClient.BeginCreate. +type SAPCentralServerInstancesClientCreateResponse struct { // Define the SAP Central Services Instance resource. SAPCentralServerInstance } -// SAPCentralInstancesClientDeleteResponse contains the response from method SAPCentralInstancesClient.BeginDelete. -type SAPCentralInstancesClientDeleteResponse struct { +// SAPCentralServerInstancesClientDeleteResponse contains the response from method SAPCentralServerInstancesClient.BeginDelete. +type SAPCentralServerInstancesClientDeleteResponse struct { // placeholder for future response values } -// SAPCentralInstancesClientGetResponse contains the response from method SAPCentralInstancesClient.Get. -type SAPCentralInstancesClientGetResponse struct { +// SAPCentralServerInstancesClientGetResponse contains the response from method SAPCentralServerInstancesClient.Get. +type SAPCentralServerInstancesClientGetResponse struct { // Define the SAP Central Services Instance resource. SAPCentralServerInstance } -// SAPCentralInstancesClientListResponse contains the response from method SAPCentralInstancesClient.NewListPager. -type SAPCentralInstancesClientListResponse struct { - // Defines the collection of SAP Central Services Instance resources. - SAPCentralInstanceList +// SAPCentralServerInstancesClientListResponse contains the response from method SAPCentralServerInstancesClient.NewListPager. +type SAPCentralServerInstancesClientListResponse struct { + // The response of a SAPCentralServerInstance list operation. + SAPCentralServerInstanceListResult } -// SAPCentralInstancesClientStartInstanceResponse contains the response from method SAPCentralInstancesClient.BeginStartInstance. -type SAPCentralInstancesClientStartInstanceResponse struct { +// SAPCentralServerInstancesClientStartResponse contains the response from method SAPCentralServerInstancesClient.BeginStart. +type SAPCentralServerInstancesClientStartResponse struct { // The current status of an async operation. OperationStatusResult } -// SAPCentralInstancesClientStopInstanceResponse contains the response from method SAPCentralInstancesClient.BeginStopInstance. -type SAPCentralInstancesClientStopInstanceResponse struct { +// SAPCentralServerInstancesClientStopResponse contains the response from method SAPCentralServerInstancesClient.BeginStop. +type SAPCentralServerInstancesClientStopResponse struct { // The current status of an async operation. OperationStatusResult } -// SAPCentralInstancesClientUpdateResponse contains the response from method SAPCentralInstancesClient.Update. -type SAPCentralInstancesClientUpdateResponse struct { +// SAPCentralServerInstancesClientUpdateResponse contains the response from method SAPCentralServerInstancesClient.Update. +type SAPCentralServerInstancesClientUpdateResponse struct { // Define the SAP Central Services Instance resource. SAPCentralServerInstance } @@ -115,18 +105,18 @@ type SAPDatabaseInstancesClientGetResponse struct { // SAPDatabaseInstancesClientListResponse contains the response from method SAPDatabaseInstancesClient.NewListPager. type SAPDatabaseInstancesClientListResponse struct { - // Defines the collection of SAP Database Instances. - SAPDatabaseInstanceList + // The response of a SAPDatabaseInstance list operation. + SAPDatabaseInstanceListResult } -// SAPDatabaseInstancesClientStartInstanceResponse contains the response from method SAPDatabaseInstancesClient.BeginStartInstance. -type SAPDatabaseInstancesClientStartInstanceResponse struct { +// SAPDatabaseInstancesClientStartResponse contains the response from method SAPDatabaseInstancesClient.BeginStart. +type SAPDatabaseInstancesClientStartResponse struct { // The current status of an async operation. OperationStatusResult } -// SAPDatabaseInstancesClientStopInstanceResponse contains the response from method SAPDatabaseInstancesClient.BeginStopInstance. -type SAPDatabaseInstancesClientStopInstanceResponse struct { +// SAPDatabaseInstancesClientStopResponse contains the response from method SAPDatabaseInstancesClient.BeginStop. +type SAPDatabaseInstancesClientStopResponse struct { // The current status of an async operation. OperationStatusResult } @@ -148,22 +138,46 @@ type SAPVirtualInstancesClientDeleteResponse struct { // placeholder for future response values } +// SAPVirtualInstancesClientGetAvailabilityZoneDetailsResponse contains the response from method SAPVirtualInstancesClient.GetAvailabilityZoneDetails. +type SAPVirtualInstancesClientGetAvailabilityZoneDetailsResponse struct { + // The list of supported availability zone pairs which are part of SAP HA deployment. + SAPAvailabilityZoneDetailsResult +} + +// SAPVirtualInstancesClientGetDiskConfigurationsResponse contains the response from method SAPVirtualInstancesClient.GetDiskConfigurations. +type SAPVirtualInstancesClientGetDiskConfigurationsResponse struct { + // The list of disk configuration for vmSku which are part of SAP deployment. + SAPDiskConfigurationsResult +} + // SAPVirtualInstancesClientGetResponse contains the response from method SAPVirtualInstancesClient.Get. type SAPVirtualInstancesClientGetResponse struct { // Define the Virtual Instance for SAP solutions resource. SAPVirtualInstance } +// SAPVirtualInstancesClientGetSapSupportedSKUResponse contains the response from method SAPVirtualInstancesClient.GetSapSupportedSKU. +type SAPVirtualInstancesClientGetSapSupportedSKUResponse struct { + // The list of supported SKUs for different resources which are part of SAP deployment. + SAPSupportedResourceSKUsResult +} + +// SAPVirtualInstancesClientGetSizingRecommendationsResponse contains the response from method SAPVirtualInstancesClient.GetSizingRecommendations. +type SAPVirtualInstancesClientGetSizingRecommendationsResponse struct { + // The SAP sizing recommendation result. + SAPSizingRecommendationResultClassification +} + // SAPVirtualInstancesClientListByResourceGroupResponse contains the response from method SAPVirtualInstancesClient.NewListByResourceGroupPager. type SAPVirtualInstancesClientListByResourceGroupResponse struct { - // Defines the collection of Virtual Instance for SAP solutions resources. - SAPVirtualInstanceList + // The response of a SAPVirtualInstance list operation. + SAPVirtualInstanceListResult } // SAPVirtualInstancesClientListBySubscriptionResponse contains the response from method SAPVirtualInstancesClient.NewListBySubscriptionPager. type SAPVirtualInstancesClientListBySubscriptionResponse struct { - // Defines the collection of Virtual Instance for SAP solutions resources. - SAPVirtualInstanceList + // The response of a SAPVirtualInstance list operation. + SAPVirtualInstanceListResult } // SAPVirtualInstancesClientStartResponse contains the response from method SAPVirtualInstancesClient.BeginStart. @@ -183,37 +197,3 @@ type SAPVirtualInstancesClientUpdateResponse struct { // Define the Virtual Instance for SAP solutions resource. SAPVirtualInstance } - -// WorkloadsClientSAPAvailabilityZoneDetailsResponse contains the response from method WorkloadsClient.SAPAvailabilityZoneDetails. -type WorkloadsClientSAPAvailabilityZoneDetailsResponse struct { - // The list of supported availability zone pairs which are part of SAP HA deployment. - SAPAvailabilityZoneDetailsResult -} - -// WorkloadsClientSAPDiskConfigurationsResponse contains the response from method WorkloadsClient.SAPDiskConfigurations. -type WorkloadsClientSAPDiskConfigurationsResponse struct { - // The list of disk configuration for vmSku which are part of SAP deployment. - SAPDiskConfigurationsResult -} - -// WorkloadsClientSAPSizingRecommendationsResponse contains the response from method WorkloadsClient.SAPSizingRecommendations. -type WorkloadsClientSAPSizingRecommendationsResponse struct { - // The SAP sizing recommendation result. - SAPSizingRecommendationResultClassification -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadsClientSAPSizingRecommendationsResponse. -func (w *WorkloadsClientSAPSizingRecommendationsResponse) UnmarshalJSON(data []byte) error { - res, err := unmarshalSAPSizingRecommendationResultClassification(data) - if err != nil { - return err - } - w.SAPSizingRecommendationResultClassification = res - return nil -} - -// WorkloadsClientSAPSupportedSKUResponse contains the response from method WorkloadsClient.SAPSupportedSKU. -type WorkloadsClientSAPSupportedSKUResponse struct { - // The list of supported SKUs for different resources which are part of SAP deployment. - SAPSupportedResourceSKUsResult -} diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/responses_serde.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/responses_serde.go new file mode 100644 index 000000000000..ff87f92c7633 --- /dev/null +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/responses_serde.go @@ -0,0 +1,15 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armworkloadssapvirtualinstance + +// UnmarshalJSON implements the json.Unmarshaller interface for type SAPVirtualInstancesClientGetSizingRecommendationsResponse. +func (s *SAPVirtualInstancesClientGetSizingRecommendationsResponse) UnmarshalJSON(data []byte) error { + res, err := unmarshalSAPSizingRecommendationResultClassification(data) + if err != nil { + return err + } + s.SAPSizingRecommendationResultClassification = res + return nil +} diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapapplicationserverinstances_client.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapapplicationserverinstances_client.go index 9a8e05592e28..5e0986185f46 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapapplicationserverinstances_client.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapapplicationserverinstances_client.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armworkloadssapvirtualinstance @@ -28,7 +24,7 @@ type SAPApplicationServerInstancesClient struct { } // NewSAPApplicationServerInstancesClient creates a new instance of SAPApplicationServerInstancesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewSAPApplicationServerInstancesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SAPApplicationServerInstancesClient, error) { @@ -43,26 +39,25 @@ func NewSAPApplicationServerInstancesClient(subscriptionID string, credential az return client, nil } -// BeginCreate - Puts the SAP Application Server Instance resource. -// This will be used by service only. PUT by end user will return a Bad Request error. +// BeginCreate - Puts the SAP Application Server Instance resource. <br><br>This will be used by service only. +// PUT by end user will return a Bad Request error. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - applicationInstanceName - The name of SAP Application Server instance resource. -// - body - The SAP Application Server Instance resource request body. +// - resource - The SAP Application Server Instance resource request body. // - options - SAPApplicationServerInstancesClientBeginCreateOptions contains the optional parameters for the SAPApplicationServerInstancesClient.BeginCreate // method. -func (client *SAPApplicationServerInstancesClient) BeginCreate(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, body SAPApplicationServerInstance, options *SAPApplicationServerInstancesClientBeginCreateOptions) (*runtime.Poller[SAPApplicationServerInstancesClientCreateResponse], error) { +func (client *SAPApplicationServerInstancesClient) BeginCreate(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, resource SAPApplicationServerInstance, options *SAPApplicationServerInstancesClientBeginCreateOptions) (*runtime.Poller[SAPApplicationServerInstancesClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, resourceGroupName, sapVirtualInstanceName, applicationInstanceName, body, options) + resp, err := client.create(ctx, resourceGroupName, sapVirtualInstanceName, applicationInstanceName, resource, options) if err != nil { return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPApplicationServerInstancesClientCreateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -72,18 +67,18 @@ func (client *SAPApplicationServerInstancesClient) BeginCreate(ctx context.Conte } } -// Create - Puts the SAP Application Server Instance resource. -// This will be used by service only. PUT by end user will return a Bad Request error. +// Create - Puts the SAP Application Server Instance resource. <br><br>This will be used by service only. PUT +// by end user will return a Bad Request error. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview -func (client *SAPApplicationServerInstancesClient) create(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, body SAPApplicationServerInstance, options *SAPApplicationServerInstancesClientBeginCreateOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *SAPApplicationServerInstancesClient) create(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, resource SAPApplicationServerInstance, options *SAPApplicationServerInstancesClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "SAPApplicationServerInstancesClient.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, sapVirtualInstanceName, applicationInstanceName, body, options) + req, err := client.createCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, applicationInstanceName, resource, options) if err != nil { return nil, err } @@ -99,7 +94,7 @@ func (client *SAPApplicationServerInstancesClient) create(ctx context.Context, r } // createCreateRequest creates the Create request. -func (client *SAPApplicationServerInstancesClient) createCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, body SAPApplicationServerInstance, options *SAPApplicationServerInstancesClientBeginCreateOptions) (*policy.Request, error) { +func (client *SAPApplicationServerInstancesClient) createCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, resource SAPApplicationServerInstance, _ *SAPApplicationServerInstancesClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -122,20 +117,21 @@ func (client *SAPApplicationServerInstancesClient) createCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, body); err != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } return req, nil } -// BeginDelete - Deletes the SAP Application Server Instance resource. -// This operation will be used by service only. Delete by end user will return a Bad Request error. +// BeginDelete - Deletes the SAP Application Server Instance resource. <br><br>This operation will be used by +// service only. Delete by end user will return a Bad Request error. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - applicationInstanceName - The name of SAP Application Server instance resource. @@ -148,8 +144,7 @@ func (client *SAPApplicationServerInstancesClient) BeginDelete(ctx context.Conte return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPApplicationServerInstancesClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -159,11 +154,11 @@ func (client *SAPApplicationServerInstancesClient) BeginDelete(ctx context.Conte } } -// Delete - Deletes the SAP Application Server Instance resource. -// This operation will be used by service only. Delete by end user will return a Bad Request error. +// Delete - Deletes the SAP Application Server Instance resource. <br><br>This operation will be used by service +// only. Delete by end user will return a Bad Request error. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 func (client *SAPApplicationServerInstancesClient) deleteOperation(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, options *SAPApplicationServerInstancesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "SAPApplicationServerInstancesClient.BeginDelete" @@ -186,7 +181,7 @@ func (client *SAPApplicationServerInstancesClient) deleteOperation(ctx context.C } // deleteCreateRequest creates the Delete request. -func (client *SAPApplicationServerInstancesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, options *SAPApplicationServerInstancesClientBeginDeleteOptions) (*policy.Request, error) { +func (client *SAPApplicationServerInstancesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, _ *SAPApplicationServerInstancesClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -209,7 +204,7 @@ func (client *SAPApplicationServerInstancesClient) deleteCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -218,7 +213,7 @@ func (client *SAPApplicationServerInstancesClient) deleteCreateRequest(ctx conte // Get - Gets the SAP Application Server Instance corresponding to the Virtual Instance for SAP solutions resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - applicationInstanceName - The name of SAP Application Server instance resource. @@ -247,7 +242,7 @@ func (client *SAPApplicationServerInstancesClient) Get(ctx context.Context, reso } // getCreateRequest creates the Get request. -func (client *SAPApplicationServerInstancesClient) getCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, options *SAPApplicationServerInstancesClientGetOptions) (*policy.Request, error) { +func (client *SAPApplicationServerInstancesClient) getCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, _ *SAPApplicationServerInstancesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -270,7 +265,7 @@ func (client *SAPApplicationServerInstancesClient) getCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -287,7 +282,7 @@ func (client *SAPApplicationServerInstancesClient) getHandleResponse(resp *http. // NewListPager - Lists the SAP Application Server Instance resources for a given Virtual Instance for SAP solutions resource. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - options - SAPApplicationServerInstancesClientListOptions contains the optional parameters for the SAPApplicationServerInstancesClient.NewListPager @@ -316,7 +311,7 @@ func (client *SAPApplicationServerInstancesClient) NewListPager(resourceGroupNam } // listCreateRequest creates the List request. -func (client *SAPApplicationServerInstancesClient) listCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, options *SAPApplicationServerInstancesClientListOptions) (*policy.Request, error) { +func (client *SAPApplicationServerInstancesClient) listCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, _ *SAPApplicationServerInstancesClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -335,7 +330,7 @@ func (client *SAPApplicationServerInstancesClient) listCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -344,50 +339,49 @@ func (client *SAPApplicationServerInstancesClient) listCreateRequest(ctx context // listHandleResponse handles the List response. func (client *SAPApplicationServerInstancesClient) listHandleResponse(resp *http.Response) (SAPApplicationServerInstancesClientListResponse, error) { result := SAPApplicationServerInstancesClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SAPApplicationServerInstanceList); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.SAPApplicationServerInstanceListResult); err != nil { return SAPApplicationServerInstancesClientListResponse{}, err } return result, nil } -// BeginStartInstance - Starts the SAP Application Server Instance. +// BeginStart - Starts the SAP Application Server Instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - applicationInstanceName - The name of SAP Application Server instance resource. -// - options - SAPApplicationServerInstancesClientBeginStartInstanceOptions contains the optional parameters for the SAPApplicationServerInstancesClient.BeginStartInstance +// - options - SAPApplicationServerInstancesClientBeginStartOptions contains the optional parameters for the SAPApplicationServerInstancesClient.BeginStart // method. -func (client *SAPApplicationServerInstancesClient) BeginStartInstance(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, options *SAPApplicationServerInstancesClientBeginStartInstanceOptions) (*runtime.Poller[SAPApplicationServerInstancesClientStartInstanceResponse], error) { +func (client *SAPApplicationServerInstancesClient) BeginStart(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, options *SAPApplicationServerInstancesClientBeginStartOptions) (*runtime.Poller[SAPApplicationServerInstancesClientStartResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.startInstance(ctx, resourceGroupName, sapVirtualInstanceName, applicationInstanceName, options) + resp, err := client.start(ctx, resourceGroupName, sapVirtualInstanceName, applicationInstanceName, options) if err != nil { return nil, err } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPApplicationServerInstancesClientStartInstanceResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPApplicationServerInstancesClientStartResponse]{ + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SAPApplicationServerInstancesClientStartInstanceResponse]{ + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SAPApplicationServerInstancesClientStartResponse]{ Tracer: client.internal.Tracer(), }) } } -// StartInstance - Starts the SAP Application Server Instance. +// Start - Starts the SAP Application Server Instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview -func (client *SAPApplicationServerInstancesClient) startInstance(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, options *SAPApplicationServerInstancesClientBeginStartInstanceOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *SAPApplicationServerInstancesClient) start(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, options *SAPApplicationServerInstancesClientBeginStartOptions) (*http.Response, error) { var err error - const operationName = "SAPApplicationServerInstancesClient.BeginStartInstance" + const operationName = "SAPApplicationServerInstancesClient.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.startInstanceCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, applicationInstanceName, options) + req, err := client.startCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, applicationInstanceName, options) if err != nil { return nil, err } @@ -402,8 +396,8 @@ func (client *SAPApplicationServerInstancesClient) startInstance(ctx context.Con return httpResp, nil } -// startInstanceCreateRequest creates the StartInstance request. -func (client *SAPApplicationServerInstancesClient) startInstanceCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, options *SAPApplicationServerInstancesClientBeginStartInstanceOptions) (*policy.Request, error) { +// startCreateRequest creates the Start request. +func (client *SAPApplicationServerInstancesClient) startCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, options *SAPApplicationServerInstancesClientBeginStartOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}/start" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -426,10 +420,11 @@ func (client *SAPApplicationServerInstancesClient) startInstanceCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Body != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { return nil, err } @@ -438,44 +433,43 @@ func (client *SAPApplicationServerInstancesClient) startInstanceCreateRequest(ct return req, nil } -// BeginStopInstance - Stops the SAP Application Server Instance. +// BeginStop - Stops the SAP Application Server Instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - applicationInstanceName - The name of SAP Application Server instance resource. -// - options - SAPApplicationServerInstancesClientBeginStopInstanceOptions contains the optional parameters for the SAPApplicationServerInstancesClient.BeginStopInstance +// - options - SAPApplicationServerInstancesClientBeginStopOptions contains the optional parameters for the SAPApplicationServerInstancesClient.BeginStop // method. -func (client *SAPApplicationServerInstancesClient) BeginStopInstance(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, options *SAPApplicationServerInstancesClientBeginStopInstanceOptions) (*runtime.Poller[SAPApplicationServerInstancesClientStopInstanceResponse], error) { +func (client *SAPApplicationServerInstancesClient) BeginStop(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, options *SAPApplicationServerInstancesClientBeginStopOptions) (*runtime.Poller[SAPApplicationServerInstancesClientStopResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.stopInstance(ctx, resourceGroupName, sapVirtualInstanceName, applicationInstanceName, options) + resp, err := client.stop(ctx, resourceGroupName, sapVirtualInstanceName, applicationInstanceName, options) if err != nil { return nil, err } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPApplicationServerInstancesClientStopInstanceResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPApplicationServerInstancesClientStopResponse]{ + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SAPApplicationServerInstancesClientStopInstanceResponse]{ + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SAPApplicationServerInstancesClientStopResponse]{ Tracer: client.internal.Tracer(), }) } } -// StopInstance - Stops the SAP Application Server Instance. +// Stop - Stops the SAP Application Server Instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview -func (client *SAPApplicationServerInstancesClient) stopInstance(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, options *SAPApplicationServerInstancesClientBeginStopInstanceOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *SAPApplicationServerInstancesClient) stop(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, options *SAPApplicationServerInstancesClientBeginStopOptions) (*http.Response, error) { var err error - const operationName = "SAPApplicationServerInstancesClient.BeginStopInstance" + const operationName = "SAPApplicationServerInstancesClient.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.stopInstanceCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, applicationInstanceName, options) + req, err := client.stopCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, applicationInstanceName, options) if err != nil { return nil, err } @@ -490,8 +484,8 @@ func (client *SAPApplicationServerInstancesClient) stopInstance(ctx context.Cont return httpResp, nil } -// stopInstanceCreateRequest creates the StopInstance request. -func (client *SAPApplicationServerInstancesClient) stopInstanceCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, options *SAPApplicationServerInstancesClientBeginStopInstanceOptions) (*policy.Request, error) { +// stopCreateRequest creates the Stop request. +func (client *SAPApplicationServerInstancesClient) stopCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, options *SAPApplicationServerInstancesClientBeginStopOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}/stop" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -514,10 +508,11 @@ func (client *SAPApplicationServerInstancesClient) stopInstanceCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Body != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { return nil, err } @@ -526,23 +521,23 @@ func (client *SAPApplicationServerInstancesClient) stopInstanceCreateRequest(ctx return req, nil } -// Update - Updates the SAP Application server instance resource. This can be used to update tags on the resource. +// Update - Puts the SAP Application Server Instance resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - applicationInstanceName - The name of SAP Application Server instance resource. -// - body - The SAP Application Server Instance resource request body. +// - properties - The SAP Application Server Instance resource request body. // - options - SAPApplicationServerInstancesClientUpdateOptions contains the optional parameters for the SAPApplicationServerInstancesClient.Update // method. -func (client *SAPApplicationServerInstancesClient) Update(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, body UpdateSAPApplicationInstanceRequest, options *SAPApplicationServerInstancesClientUpdateOptions) (SAPApplicationServerInstancesClientUpdateResponse, error) { +func (client *SAPApplicationServerInstancesClient) Update(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, properties UpdateSAPApplicationInstanceRequest, options *SAPApplicationServerInstancesClientUpdateOptions) (SAPApplicationServerInstancesClientUpdateResponse, error) { var err error const operationName = "SAPApplicationServerInstancesClient.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, sapVirtualInstanceName, applicationInstanceName, body, options) + req, err := client.updateCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, applicationInstanceName, properties, options) if err != nil { return SAPApplicationServerInstancesClientUpdateResponse{}, err } @@ -559,7 +554,7 @@ func (client *SAPApplicationServerInstancesClient) Update(ctx context.Context, r } // updateCreateRequest creates the Update request. -func (client *SAPApplicationServerInstancesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, body UpdateSAPApplicationInstanceRequest, options *SAPApplicationServerInstancesClientUpdateOptions) (*policy.Request, error) { +func (client *SAPApplicationServerInstancesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, properties UpdateSAPApplicationInstanceRequest, _ *SAPApplicationServerInstancesClientUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -582,10 +577,11 @@ func (client *SAPApplicationServerInstancesClient) updateCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, body); err != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { return nil, err } return req, nil diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapapplicationserverinstances_client_example_test.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapapplicationserverinstances_client_example_test.go index f126fa2c64f1..994f42f6ce84 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapapplicationserverinstances_client_example_test.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapapplicationserverinstances_client_example_test.go @@ -1,94 +1,99 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armworkloadssapvirtualinstance_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/workloadssapvirtualinstance/armworkloadssapvirtualinstance" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapapplicationinstances/SAPApplicationServerInstances_Get.json -func ExampleSAPApplicationServerInstancesClient_Get() { +// Generated from example definition: 2024-09-01/SapApplicationServerInstances_Create.json +func ExampleSAPApplicationServerInstancesClient_BeginCreate_sapApplicationServerInstancesCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("6d875e77-e412-4d7d-9af4-8895278b4443", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewSAPApplicationServerInstancesClient().Get(ctx, "test-rg", "X00", "app01", nil) + poller, err := clientFactory.NewSAPApplicationServerInstancesClient().BeginCreate(ctx, "test-rg", "X00", "app01", armworkloadssapvirtualinstance.SAPApplicationServerInstance{ + Location: to.Ptr("westcentralus"), + Properties: &armworkloadssapvirtualinstance.SAPApplicationServerProperties{}, + Tags: map[string]*string{}, + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %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.SAPApplicationServerInstance = armworkloadssapvirtualinstance.SAPApplicationServerInstance{ - // Name: to.Ptr("app01"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPApplicationServerProperties{ - // DispatcherStatus: to.Ptr("Running"), - // GatewayPort: to.Ptr[int64](3300), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-nw1"), - // IcmHTTPPort: to.Ptr[int64](3312), - // IcmHTTPSPort: to.Ptr[int64](3313), - // InstanceNo: to.Ptr("00"), - // IPAddress: to.Ptr("10.0.0.5"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), - // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), - // VMDetails: []*armworkloadssapvirtualinstance.ApplicationServerVMDetails{ - // { - // Type: to.Ptr(armworkloadssapvirtualinstance.ApplicationServerVirtualMachineTypeActive), - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/app01-vm"), - // }}, + // res = armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientCreateResponse{ + // SAPApplicationServerInstance: &armworkloadssapvirtualinstance.SAPApplicationServerInstance{ + // Name: to.Ptr("app01"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPApplicationServerProperties{ + // DispatcherStatus: to.Ptr("Running"), + // GatewayPort: to.Ptr[int64](3300), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Hostname: to.Ptr("vh-nw1"), + // IcmHTTPPort: to.Ptr[int64](3312), + // IcmHTTPSPort: to.Ptr[int64](3313), + // InstanceNo: to.Ptr("01"), + // IPAddress: to.Ptr("10.0.0.5"), + // KernelPatch: to.Ptr("patch 300"), + // KernelVersion: to.Ptr("777"), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), + // VMDetails: []*armworkloadssapvirtualinstance.ApplicationServerVMDetails{ + // { + // Type: to.Ptr(armworkloadssapvirtualinstance.ApplicationServerVirtualMachineTypeActive), + // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/app01-vm"), + // }, + // }, + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapapplicationinstances/SAPApplicationServerInstances_Create_HA_AvSet.json +// Generated from example definition: 2024-09-01/SapApplicationServerInstances_CreateForHaWithAvailabilitySet.json func ExampleSAPApplicationServerInstancesClient_BeginCreate_createSapApplicationServerInstancesForHaSystemWithAvailabilitySet() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("6d875e77-e412-4d7d-9af4-8895278b4443", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPApplicationServerInstancesClient().BeginCreate(ctx, "test-rg", "X00", "app01", armworkloadssapvirtualinstance.SAPApplicationServerInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPApplicationServerProperties{}, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -100,319 +105,371 @@ func ExampleSAPApplicationServerInstancesClient_BeginCreate_createSapApplication // 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.SAPApplicationServerInstance = armworkloadssapvirtualinstance.SAPApplicationServerInstance{ - // Name: to.Ptr("app01"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPApplicationServerProperties{ - // DispatcherStatus: to.Ptr("Running"), - // GatewayPort: to.Ptr[int64](3300), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-nw1"), - // IcmHTTPPort: to.Ptr[int64](3312), - // IcmHTTPSPort: to.Ptr[int64](3313), - // InstanceNo: to.Ptr("01"), - // IPAddress: to.Ptr("10.0.0.5"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // LoadBalancerDetails: &armworkloadssapvirtualinstance.LoadBalancerDetails{ - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Network/loadBalancers/cs-loadBalancer"), - // }, - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), - // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), - // VMDetails: []*armworkloadssapvirtualinstance.ApplicationServerVMDetails{ - // { - // Type: to.Ptr(armworkloadssapvirtualinstance.ApplicationServerVirtualMachineTypeActive), - // StorageDetails: []*armworkloadssapvirtualinstance.StorageInformation{ - // { - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/nfsstorageaccount"), - // }}, - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/cs-vm1"), + // res = armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientCreateResponse{ + // SAPApplicationServerInstance: &armworkloadssapvirtualinstance.SAPApplicationServerInstance{ + // Name: to.Ptr("app01"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPApplicationServerProperties{ + // DispatcherStatus: to.Ptr("Running"), + // GatewayPort: to.Ptr[int64](3300), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Hostname: to.Ptr("vh-nw1"), + // IcmHTTPPort: to.Ptr[int64](3312), + // IcmHTTPSPort: to.Ptr[int64](3313), + // InstanceNo: to.Ptr("01"), + // IPAddress: to.Ptr("10.0.0.5"), + // KernelPatch: to.Ptr("patch 300"), + // KernelVersion: to.Ptr("777"), + // LoadBalancerDetails: &armworkloadssapvirtualinstance.LoadBalancerDetails{ + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Network/loadBalancers/cs-loadBalancer"), + // }, + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), + // VMDetails: []*armworkloadssapvirtualinstance.ApplicationServerVMDetails{ + // { + // Type: to.Ptr(armworkloadssapvirtualinstance.ApplicationServerVirtualMachineTypeActive), + // StorageDetails: []*armworkloadssapvirtualinstance.StorageInformation{ + // { + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/nfsstorageaccount"), + // }, + // }, + // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/cs-vm1"), + // }, + // { + // Type: to.Ptr(armworkloadssapvirtualinstance.ApplicationServerVirtualMachineTypeStandby), + // StorageDetails: []*armworkloadssapvirtualinstance.StorageInformation{ + // { + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/nfsstorageaccount"), + // }, + // }, + // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/cs-vm2"), + // }, // }, - // { - // Type: to.Ptr(armworkloadssapvirtualinstance.ApplicationServerVirtualMachineTypeStandby), - // StorageDetails: []*armworkloadssapvirtualinstance.StorageInformation{ - // { - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/nfsstorageaccount"), - // }}, - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/cs-vm2"), - // }}, + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapapplicationinstances/SAPApplicationServerInstances_Create.json -func ExampleSAPApplicationServerInstancesClient_BeginCreate_sapApplicationServerInstancesCreate() { +// Generated from example definition: 2024-09-01/SapApplicationServerInstances_Delete.json +func ExampleSAPApplicationServerInstancesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("6d875e77-e412-4d7d-9af4-8895278b4443", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPApplicationServerInstancesClient().BeginCreate(ctx, "test-rg", "X00", "app01", armworkloadssapvirtualinstance.SAPApplicationServerInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, - Properties: &armworkloadssapvirtualinstance.SAPApplicationServerProperties{}, - }, nil) + poller, err := clientFactory.NewSAPApplicationServerInstancesClient().BeginDelete(ctx, "test-rg", "X00", "app01", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - res, err := poller.PollUntilDone(ctx, nil) + _, err = poller.PollUntilDone(ctx, nil) if err != nil { log.Fatalf("failed to pull the result: %v", err) } +} + +// Generated from example definition: 2024-09-01/SapApplicationServerInstances_Get.json +func ExampleSAPApplicationServerInstancesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("6d875e77-e412-4d7d-9af4-8895278b4443", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSAPApplicationServerInstancesClient().Get(ctx, "test-rg", "X00", "app01", 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.SAPApplicationServerInstance = armworkloadssapvirtualinstance.SAPApplicationServerInstance{ - // Name: to.Ptr("app01"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPApplicationServerProperties{ - // DispatcherStatus: to.Ptr("Running"), - // GatewayPort: to.Ptr[int64](3300), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-nw1"), - // IcmHTTPPort: to.Ptr[int64](3312), - // IcmHTTPSPort: to.Ptr[int64](3313), - // InstanceNo: to.Ptr("01"), - // IPAddress: to.Ptr("10.0.0.5"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), - // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), - // VMDetails: []*armworkloadssapvirtualinstance.ApplicationServerVMDetails{ - // { - // Type: to.Ptr(armworkloadssapvirtualinstance.ApplicationServerVirtualMachineTypeActive), - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/app01-vm"), - // }}, + // res = armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientGetResponse{ + // SAPApplicationServerInstance: &armworkloadssapvirtualinstance.SAPApplicationServerInstance{ + // Name: to.Ptr("app01"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPApplicationServerProperties{ + // DispatcherStatus: to.Ptr("Running"), + // GatewayPort: to.Ptr[int64](3300), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Hostname: to.Ptr("vh-nw1"), + // IcmHTTPPort: to.Ptr[int64](3312), + // IcmHTTPSPort: to.Ptr[int64](3313), + // InstanceNo: to.Ptr("00"), + // IPAddress: to.Ptr("10.0.0.5"), + // KernelPatch: to.Ptr("patch 300"), + // KernelVersion: to.Ptr("777"), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), + // VMDetails: []*armworkloadssapvirtualinstance.ApplicationServerVMDetails{ + // { + // Type: to.Ptr(armworkloadssapvirtualinstance.ApplicationServerVirtualMachineTypeActive), + // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/app01-vm"), + // }, + // }, + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapapplicationinstances/SAPApplicationServerInstances_Update.json -func ExampleSAPApplicationServerInstancesClient_Update() { +// Generated from example definition: 2024-09-01/SapApplicationServerInstances_ListBySapVirtualInstance.json +func ExampleSAPApplicationServerInstancesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("6d875e77-e412-4d7d-9af4-8895278b4443", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewSAPApplicationServerInstancesClient().Update(ctx, "test-rg", "X00", "app01", armworkloadssapvirtualinstance.UpdateSAPApplicationInstanceRequest{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - }, - }, nil) + pager := clientFactory.NewSAPApplicationServerInstancesClient().NewListPager("test-rg", "X00", 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 = armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientListResponse{ + // SAPApplicationServerInstanceListResult: armworkloadssapvirtualinstance.SAPApplicationServerInstanceListResult{ + // Value: []*armworkloadssapvirtualinstance.SAPApplicationServerInstance{ + // { + // Name: to.Ptr("app01"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPApplicationServerProperties{ + // DispatcherStatus: to.Ptr("Running"), + // GatewayPort: to.Ptr[int64](3300), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Hostname: to.Ptr("vh-nw1"), + // IcmHTTPPort: to.Ptr[int64](3312), + // IcmHTTPSPort: to.Ptr[int64](3313), + // InstanceNo: to.Ptr("00"), + // IPAddress: to.Ptr("10.0.0.5"), + // KernelPatch: to.Ptr("patch 300"), + // KernelVersion: to.Ptr("777"), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), + // VMDetails: []*armworkloadssapvirtualinstance.ApplicationServerVMDetails{ + // { + // Type: to.Ptr(armworkloadssapvirtualinstance.ApplicationServerVirtualMachineTypeActive), + // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/app01-vm"), + // }, + // }, + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, + // }, + // { + // Name: to.Ptr("app02"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app02"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPApplicationServerProperties{ + // DispatcherStatus: to.Ptr("Running"), + // GatewayPort: to.Ptr[int64](3300), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Hostname: to.Ptr("vh-nw1"), + // IcmHTTPPort: to.Ptr[int64](3312), + // IcmHTTPSPort: to.Ptr[int64](3313), + // InstanceNo: to.Ptr("01"), + // IPAddress: to.Ptr("10.0.0.5"), + // KernelPatch: to.Ptr("patch 300"), + // KernelVersion: to.Ptr("777"), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), + // VMDetails: []*armworkloadssapvirtualinstance.ApplicationServerVMDetails{ + // { + // Type: to.Ptr(armworkloadssapvirtualinstance.ApplicationServerVirtualMachineTypeActive), + // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/app01-vm"), + // }, + // }, + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2024-09-01/SapApplicationServerInstances_StartInstance.json +func ExampleSAPApplicationServerInstancesClient_BeginStart_startTheSapApplicationServerInstance() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSAPApplicationServerInstancesClient().BeginStart(ctx, "test-rg", "X00", "app01", &SAPApplicationServerInstancesClientBeginStartOptions{ + body: &armworkloadssapvirtualinstance.StartRequest{}}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %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.SAPApplicationServerInstance = armworkloadssapvirtualinstance.SAPApplicationServerInstance{ - // Name: to.Ptr("app01"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPApplicationServerProperties{ - // DispatcherStatus: to.Ptr("Running"), - // GatewayPort: to.Ptr[int64](3300), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-nw1"), - // IcmHTTPPort: to.Ptr[int64](3312), - // IcmHTTPSPort: to.Ptr[int64](3313), - // InstanceNo: to.Ptr("01"), - // IPAddress: to.Ptr("10.0.0.5"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), - // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), - // VMDetails: []*armworkloadssapvirtualinstance.ApplicationServerVMDetails{ - // { - // Type: to.Ptr(armworkloadssapvirtualinstance.ApplicationServerVirtualMachineTypeActive), - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/app01-vm"), - // }}, + // res = armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientStartResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("app01"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapapplicationinstances/SAPApplicationServerInstances_Delete.json -func ExampleSAPApplicationServerInstancesClient_BeginDelete() { +// Generated from example definition: 2024-09-01/SapApplicationServerInstances_StartInstanceVM.json +func ExampleSAPApplicationServerInstancesClient_BeginStart_startVirtualMachineAndTheSapApplicationServerInstanceOnIt() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPApplicationServerInstancesClient().BeginDelete(ctx, "test-rg", "X00", "app01", nil) + poller, err := clientFactory.NewSAPApplicationServerInstancesClient().BeginStart(ctx, "test-rg", "X00", "app01", &SAPApplicationServerInstancesClientBeginStartOptions{ + body: &armworkloadssapvirtualinstance.StartRequest{ + StartVM: to.Ptr(true), + }}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - _, err = poller.PollUntilDone(ctx, nil) + res, err := poller.PollUntilDone(ctx, nil) if err != nil { log.Fatalf("failed to pull the result: %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 = armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientStartResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("app01"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapapplicationinstances/SAPApplicationServerInstances_List.json -func ExampleSAPApplicationServerInstancesClient_NewListPager() { +// Generated from example definition: 2024-09-01/SapApplicationServerInstances_StopInstance.json +func ExampleSAPApplicationServerInstancesClient_BeginStop_stopTheSapApplicationServerInstance() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewSAPApplicationServerInstancesClient().NewListPager("test-rg", "X00", 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.SAPApplicationServerInstanceList = armworkloadssapvirtualinstance.SAPApplicationServerInstanceList{ - // Value: []*armworkloadssapvirtualinstance.SAPApplicationServerInstance{ - // { - // Name: to.Ptr("app01"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPApplicationServerProperties{ - // DispatcherStatus: to.Ptr("Running"), - // GatewayPort: to.Ptr[int64](3300), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-nw1"), - // IcmHTTPPort: to.Ptr[int64](3312), - // IcmHTTPSPort: to.Ptr[int64](3313), - // InstanceNo: to.Ptr("00"), - // IPAddress: to.Ptr("10.0.0.5"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), - // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), - // VMDetails: []*armworkloadssapvirtualinstance.ApplicationServerVMDetails{ - // { - // Type: to.Ptr(armworkloadssapvirtualinstance.ApplicationServerVirtualMachineTypeActive), - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/app01-vm"), - // }}, - // }, - // }, - // { - // Name: to.Ptr("app02"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app02"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPApplicationServerProperties{ - // DispatcherStatus: to.Ptr("Running"), - // GatewayPort: to.Ptr[int64](3300), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-nw1"), - // IcmHTTPPort: to.Ptr[int64](3312), - // IcmHTTPSPort: to.Ptr[int64](3313), - // InstanceNo: to.Ptr("01"), - // IPAddress: to.Ptr("10.0.0.5"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), - // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), - // VMDetails: []*armworkloadssapvirtualinstance.ApplicationServerVMDetails{ - // { - // Type: to.Ptr(armworkloadssapvirtualinstance.ApplicationServerVirtualMachineTypeActive), - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/app01-vm"), - // }}, - // }, - // }}, - // } + poller, err := clientFactory.NewSAPApplicationServerInstancesClient().BeginStop(ctx, "test-rg", "X00", "app01", &SAPApplicationServerInstancesClientBeginStopOptions{ + body: &armworkloadssapvirtualinstance.StopRequest{ + SoftStopTimeoutSeconds: to.Ptr[int64](0), + }}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %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 = armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientStopResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("app01"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapapplicationinstances/SAPApplicationServerInstances_StartInstance_WithInfraOperations.json -func ExampleSAPApplicationServerInstancesClient_BeginStartInstance_startVirtualMachineAndTheSapApplicationServerInstanceOnIt() { +// Generated from example definition: 2024-09-01/SapApplicationServerInstances_StopInstanceInfrastructure.json +func ExampleSAPApplicationServerInstancesClient_BeginStop_stopTheSapApplicationServerInstanceAndItSInfrastructure() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPApplicationServerInstancesClient().BeginStartInstance(ctx, "test-rg", "X00", "app01", &armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientBeginStartInstanceOptions{Body: &armworkloadssapvirtualinstance.StartRequest{ - StartVM: to.Ptr(true), - }, - }) + poller, err := clientFactory.NewSAPApplicationServerInstancesClient().BeginStop(ctx, "test-rg", "X00", "app01", &SAPApplicationServerInstancesClientBeginStopOptions{ + body: &armworkloadssapvirtualinstance.StopRequest{ + DeallocateVM: to.Ptr(true), + SoftStopTimeoutSeconds: to.Ptr[int64](0), + }}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -423,27 +480,32 @@ func ExampleSAPApplicationServerInstancesClient_BeginStartInstance_startVirtualM // 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.OperationStatusResult = armworkloadssapvirtualinstance.OperationStatusResult{ - // Name: to.Ptr("app01"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), + // res = armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientStopResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("app01"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), + // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapapplicationinstances/SAPApplicationServerInstances_StartInstance.json -func ExampleSAPApplicationServerInstancesClient_BeginStartInstance_startTheSapApplicationServerInstance() { +// Generated from example definition: 2024-09-01/SapApplicationServerInstances_StopInstanceSoft.json +func ExampleSAPApplicationServerInstancesClient_BeginStop_softStopTheSapApplicationServerInstance() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPApplicationServerInstancesClient().BeginStartInstance(ctx, "test-rg", "X00", "app01", &armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientBeginStartInstanceOptions{Body: nil}) + poller, err := clientFactory.NewSAPApplicationServerInstancesClient().BeginStop(ctx, "test-rg", "X00", "app01", &SAPApplicationServerInstancesClientBeginStopOptions{ + body: &armworkloadssapvirtualinstance.StopRequest{ + SoftStopTimeoutSeconds: to.Ptr[int64](300), + }}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -454,30 +516,33 @@ func ExampleSAPApplicationServerInstancesClient_BeginStartInstance_startTheSapAp // 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.OperationStatusResult = armworkloadssapvirtualinstance.OperationStatusResult{ - // Name: to.Ptr("app01"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), + // res = armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientStopResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("app01"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), + // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapapplicationinstances/SAPApplicationServerInstances_StopInstance.json -func ExampleSAPApplicationServerInstancesClient_BeginStopInstance_stopTheSapApplicationServerInstance() { +// Generated from example definition: 2024-09-01/SapApplicationServerInstances_StopInstanceSoftInfrastructure.json +func ExampleSAPApplicationServerInstancesClient_BeginStop_softStopTheSapApplicationServerInstanceAndItSInfrastructure() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPApplicationServerInstancesClient().BeginStopInstance(ctx, "test-rg", "X00", "app01", &armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientBeginStopInstanceOptions{Body: &armworkloadssapvirtualinstance.StopRequest{ - SoftStopTimeoutSeconds: to.Ptr[int64](0), - }, - }) + poller, err := clientFactory.NewSAPApplicationServerInstancesClient().BeginStop(ctx, "test-rg", "X00", "app01", &SAPApplicationServerInstancesClientBeginStopOptions{ + body: &armworkloadssapvirtualinstance.StopRequest{ + DeallocateVM: to.Ptr(true), + SoftStopTimeoutSeconds: to.Ptr[int64](300), + }}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -488,46 +553,76 @@ func ExampleSAPApplicationServerInstancesClient_BeginStopInstance_stopTheSapAppl // 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.OperationStatusResult = armworkloadssapvirtualinstance.OperationStatusResult{ - // Name: to.Ptr("app01"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), + // res = armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientStopResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("app01"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), + // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapapplicationinstances/SAPApplicationServerInstances_StopInstance_WithInfraOperations.json -func ExampleSAPApplicationServerInstancesClient_BeginStopInstance_stopTheSapApplicationServerInstanceAndTheVirtualMachine() { +// Generated from example definition: 2024-09-01/SapApplicationServerInstances_Update.json +func ExampleSAPApplicationServerInstancesClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("6d875e77-e412-4d7d-9af4-8895278b4443", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPApplicationServerInstancesClient().BeginStopInstance(ctx, "test-rg", "X00", "app01", &armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientBeginStopInstanceOptions{Body: &armworkloadssapvirtualinstance.StopRequest{ - DeallocateVM: to.Ptr(true), - SoftStopTimeoutSeconds: to.Ptr[int64](0), - }, - }) + res, err := clientFactory.NewSAPApplicationServerInstancesClient().Update(ctx, "test-rg", "X00", "app01", armworkloadssapvirtualinstance.UpdateSAPApplicationInstanceRequest{ + Tags: map[string]*string{ + "tag1": to.Ptr("value1"), + }, + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %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.OperationStatusResult = armworkloadssapvirtualinstance.OperationStatusResult{ - // Name: to.Ptr("app01"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), + // res = armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientUpdateResponse{ + // SAPApplicationServerInstance: &armworkloadssapvirtualinstance.SAPApplicationServerInstance{ + // Name: to.Ptr("app01"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPApplicationServerProperties{ + // DispatcherStatus: to.Ptr("Running"), + // GatewayPort: to.Ptr[int64](3300), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Hostname: to.Ptr("vh-nw1"), + // IcmHTTPPort: to.Ptr[int64](3312), + // IcmHTTPSPort: to.Ptr[int64](3313), + // InstanceNo: to.Ptr("01"), + // IPAddress: to.Ptr("10.0.0.5"), + // KernelPatch: to.Ptr("patch 300"), + // KernelVersion: to.Ptr("777"), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), + // VMDetails: []*armworkloadssapvirtualinstance.ApplicationServerVMDetails{ + // { + // Type: to.Ptr(armworkloadssapvirtualinstance.ApplicationServerVirtualMachineTypeActive), + // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/app01-vm"), + // }, + // }, + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, + // }, // } } diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapcentralinstances_client_example_test.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapcentralinstances_client_example_test.go deleted file mode 100644 index 84bf884df766..000000000000 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapcentralinstances_client_example_test.go +++ /dev/null @@ -1,606 +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 armworkloadssapvirtualinstance_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/workloadssapvirtualinstance/armworkloadssapvirtualinstance" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapcentralinstances/SAPCentralInstances_Get.json -func ExampleSAPCentralInstancesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSAPCentralInstancesClient().Get(ctx, "test-rg", "X00", "centralServer", 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.SAPCentralServerInstance = armworkloadssapvirtualinstance.SAPCentralServerInstance{ - // Name: to.Ptr("centralServer"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/centralInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPCentralServerProperties{ - // EnqueueReplicationServerProperties: &armworkloadssapvirtualinstance.EnqueueReplicationServerProperties{ - // ErsVersion: to.Ptr(armworkloadssapvirtualinstance.EnqueueReplicationServerTypeEnqueueReplicator1), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-ers1"), - // InstanceNo: to.Ptr("00"), - // IPAddress: to.Ptr("10.0.0.5"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // }, - // EnqueueServerProperties: &armworkloadssapvirtualinstance.EnqueueServerProperties{ - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // Hostname: to.Ptr("vh-ascs1"), - // IPAddress: to.Ptr("10.0.0.5"), - // Port: to.Ptr[int64](3600), - // }, - // GatewayServerProperties: &armworkloadssapvirtualinstance.GatewayServerProperties{ - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateDegraded), - // Port: to.Ptr[int64](3300), - // }, - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // InstanceNo: to.Ptr("00"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // MessageServerProperties: &armworkloadssapvirtualinstance.MessageServerProperties{ - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnhealthy), - // Hostname: to.Ptr("vh-ascs1"), - // HTTPPort: to.Ptr[int64](8100), - // HTTPSPort: to.Ptr[int64](44400), - // InternalMsPort: to.Ptr[int64](3900), - // IPAddress: to.Ptr("10.0.0.5"), - // MSPort: to.Ptr[int64](3600), - // }, - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), - // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), - // VMDetails: []*armworkloadssapvirtualinstance.CentralServerVMDetails{ - // { - // Type: to.Ptr(armworkloadssapvirtualinstance.CentralServerVirtualMachineTypePrimary), - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/cs-vm"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapcentralinstances/SAPCentralInstances_Create_HA_AvSet.json -func ExampleSAPCentralInstancesClient_BeginCreate_createSapCentralInstancesForHaSystemWithAvailabilitySet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPCentralInstancesClient().BeginCreate(ctx, "test-rg", "X00", "centralServer", armworkloadssapvirtualinstance.SAPCentralServerInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, - Properties: &armworkloadssapvirtualinstance.SAPCentralServerProperties{}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %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.SAPCentralServerInstance = armworkloadssapvirtualinstance.SAPCentralServerInstance{ - // Name: to.Ptr("centralServer"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/centralInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPCentralServerProperties{ - // EnqueueReplicationServerProperties: &armworkloadssapvirtualinstance.EnqueueReplicationServerProperties{ - // ErsVersion: to.Ptr(armworkloadssapvirtualinstance.EnqueueReplicationServerTypeEnqueueReplicator1), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-ers1"), - // InstanceNo: to.Ptr("00"), - // IPAddress: to.Ptr("10.0.0.5"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // }, - // EnqueueServerProperties: &armworkloadssapvirtualinstance.EnqueueServerProperties{ - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-ascs1"), - // IPAddress: to.Ptr("10.0.0.5"), - // Port: to.Ptr[int64](3600), - // }, - // GatewayServerProperties: &armworkloadssapvirtualinstance.GatewayServerProperties{ - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Port: to.Ptr[int64](3300), - // }, - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // InstanceNo: to.Ptr("00"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // LoadBalancerDetails: &armworkloadssapvirtualinstance.LoadBalancerDetails{ - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Network/loadBalancers/cs-ASCS-loadBalancer"), - // }, - // MessageServerProperties: &armworkloadssapvirtualinstance.MessageServerProperties{ - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-ascs1"), - // HTTPPort: to.Ptr[int64](8100), - // HTTPSPort: to.Ptr[int64](44400), - // InternalMsPort: to.Ptr[int64](3900), - // IPAddress: to.Ptr("10.0.0.5"), - // MSPort: to.Ptr[int64](3600), - // }, - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), - // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), - // VMDetails: []*armworkloadssapvirtualinstance.CentralServerVMDetails{ - // { - // Type: to.Ptr(armworkloadssapvirtualinstance.CentralServerVirtualMachineTypePrimary), - // StorageDetails: []*armworkloadssapvirtualinstance.StorageInformation{ - // { - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/nfsstorageaccount"), - // }}, - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/cs-vm1"), - // }, - // { - // Type: to.Ptr(armworkloadssapvirtualinstance.CentralServerVirtualMachineTypePrimary), - // StorageDetails: []*armworkloadssapvirtualinstance.StorageInformation{ - // { - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/nfsstorageaccount"), - // }}, - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/cs-vm2"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapcentralinstances/SAPCentralInstances_Create.json -func ExampleSAPCentralInstancesClient_BeginCreate_sapCentralInstancesCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPCentralInstancesClient().BeginCreate(ctx, "test-rg", "X00", "centralServer", armworkloadssapvirtualinstance.SAPCentralServerInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, - Properties: &armworkloadssapvirtualinstance.SAPCentralServerProperties{}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %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.SAPCentralServerInstance = armworkloadssapvirtualinstance.SAPCentralServerInstance{ - // Name: to.Ptr("centralServer"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/centralInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPCentralServerProperties{ - // EnqueueReplicationServerProperties: &armworkloadssapvirtualinstance.EnqueueReplicationServerProperties{ - // ErsVersion: to.Ptr(armworkloadssapvirtualinstance.EnqueueReplicationServerTypeEnqueueReplicator1), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-ers1"), - // InstanceNo: to.Ptr("00"), - // IPAddress: to.Ptr("10.0.0.5"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // }, - // EnqueueServerProperties: &armworkloadssapvirtualinstance.EnqueueServerProperties{ - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-ascs1"), - // IPAddress: to.Ptr("10.0.0.5"), - // Port: to.Ptr[int64](3600), - // }, - // GatewayServerProperties: &armworkloadssapvirtualinstance.GatewayServerProperties{ - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Port: to.Ptr[int64](3300), - // }, - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // InstanceNo: to.Ptr("00"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // MessageServerProperties: &armworkloadssapvirtualinstance.MessageServerProperties{ - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-ascs1"), - // HTTPPort: to.Ptr[int64](8100), - // HTTPSPort: to.Ptr[int64](44400), - // InternalMsPort: to.Ptr[int64](3900), - // IPAddress: to.Ptr("10.0.0.5"), - // MSPort: to.Ptr[int64](3600), - // }, - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), - // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), - // VMDetails: []*armworkloadssapvirtualinstance.CentralServerVMDetails{ - // { - // Type: to.Ptr(armworkloadssapvirtualinstance.CentralServerVirtualMachineTypePrimary), - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/cs-vm"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapcentralinstances/SAPCentralInstances_Update.json -func ExampleSAPCentralInstancesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSAPCentralInstancesClient().Update(ctx, "test-rg", "X00", "centralServer", armworkloadssapvirtualinstance.UpdateSAPCentralInstanceRequest{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - }, - }, 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.SAPCentralServerInstance = armworkloadssapvirtualinstance.SAPCentralServerInstance{ - // Name: to.Ptr("centralServer"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/centralInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPCentralServerProperties{ - // EnqueueReplicationServerProperties: &armworkloadssapvirtualinstance.EnqueueReplicationServerProperties{ - // ErsVersion: to.Ptr(armworkloadssapvirtualinstance.EnqueueReplicationServerTypeEnqueueReplicator1), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-ers1"), - // InstanceNo: to.Ptr("00"), - // IPAddress: to.Ptr("10.0.0.5"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // }, - // EnqueueServerProperties: &armworkloadssapvirtualinstance.EnqueueServerProperties{ - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-ascs1"), - // IPAddress: to.Ptr("10.0.0.5"), - // Port: to.Ptr[int64](3600), - // }, - // GatewayServerProperties: &armworkloadssapvirtualinstance.GatewayServerProperties{ - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Port: to.Ptr[int64](3300), - // }, - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // InstanceNo: to.Ptr("00"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // MessageServerProperties: &armworkloadssapvirtualinstance.MessageServerProperties{ - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-ascs1"), - // HTTPPort: to.Ptr[int64](8100), - // HTTPSPort: to.Ptr[int64](44400), - // InternalMsPort: to.Ptr[int64](3900), - // IPAddress: to.Ptr("10.0.0.5"), - // MSPort: to.Ptr[int64](3600), - // }, - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), - // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), - // VMDetails: []*armworkloadssapvirtualinstance.CentralServerVMDetails{ - // { - // Type: to.Ptr(armworkloadssapvirtualinstance.CentralServerVirtualMachineTypePrimary), - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/cs-vm"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapcentralinstances/SAPCentralInstances_Delete.json -func ExampleSAPCentralInstancesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPCentralInstancesClient().BeginDelete(ctx, "test-rg", "X00", "centralServer", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapcentralinstances/SAPCentralInstances_List.json -func ExampleSAPCentralInstancesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSAPCentralInstancesClient().NewListPager("test-rg", "X00", 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.SAPCentralInstanceList = armworkloadssapvirtualinstance.SAPCentralInstanceList{ - // Value: []*armworkloadssapvirtualinstance.SAPCentralServerInstance{ - // { - // Name: to.Ptr("centralServer"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/centralInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPCentralServerProperties{ - // EnqueueReplicationServerProperties: &armworkloadssapvirtualinstance.EnqueueReplicationServerProperties{ - // ErsVersion: to.Ptr(armworkloadssapvirtualinstance.EnqueueReplicationServerTypeEnqueueReplicator1), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-ers1"), - // InstanceNo: to.Ptr("00"), - // IPAddress: to.Ptr("10.0.0.5"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // }, - // EnqueueServerProperties: &armworkloadssapvirtualinstance.EnqueueServerProperties{ - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-ascs1"), - // IPAddress: to.Ptr("10.0.0.5"), - // Port: to.Ptr[int64](3600), - // }, - // GatewayServerProperties: &armworkloadssapvirtualinstance.GatewayServerProperties{ - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Port: to.Ptr[int64](3300), - // }, - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // InstanceNo: to.Ptr("00"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // MessageServerProperties: &armworkloadssapvirtualinstance.MessageServerProperties{ - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-ascs1"), - // HTTPPort: to.Ptr[int64](8100), - // HTTPSPort: to.Ptr[int64](44400), - // InternalMsPort: to.Ptr[int64](3900), - // IPAddress: to.Ptr("10.0.0.5"), - // MSPort: to.Ptr[int64](3600), - // }, - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), - // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), - // VMDetails: []*armworkloadssapvirtualinstance.CentralServerVMDetails{ - // { - // Type: to.Ptr(armworkloadssapvirtualinstance.CentralServerVirtualMachineTypePrimary), - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/cs-vm"), - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapcentralinstances/SAPCentralInstances_StartInstance.json -func ExampleSAPCentralInstancesClient_BeginStartInstance_startTheSapCentralServicesInstance() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPCentralInstancesClient().BeginStartInstance(ctx, "test-rg", "X00", "centralServer", &armworkloadssapvirtualinstance.SAPCentralInstancesClientBeginStartInstanceOptions{Body: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %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.OperationStatusResult = armworkloadssapvirtualinstance.OperationStatusResult{ - // Name: to.Ptr("centralServer"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapcentralinstances/SAPCentralInstances_StartInstance_WithInfraOperations.json -func ExampleSAPCentralInstancesClient_BeginStartInstance_startTheVirtualMachineSAndTheSapCentralServicesInstanceOnIt() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPCentralInstancesClient().BeginStartInstance(ctx, "test-rg", "X00", "centralServer", &armworkloadssapvirtualinstance.SAPCentralInstancesClientBeginStartInstanceOptions{Body: &armworkloadssapvirtualinstance.StartRequest{ - StartVM: to.Ptr(true), - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %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.OperationStatusResult = armworkloadssapvirtualinstance.OperationStatusResult{ - // Name: to.Ptr("centralServer"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapcentralinstances/SAPCentralInstances_StopInstance_WithInfraOperations.json -func ExampleSAPCentralInstancesClient_BeginStopInstance_stopTheSapCentralServicesInstanceAndItsUnderlyingVirtualMachineS() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPCentralInstancesClient().BeginStopInstance(ctx, "test-rg", "X00", "centralServer", &armworkloadssapvirtualinstance.SAPCentralInstancesClientBeginStopInstanceOptions{Body: &armworkloadssapvirtualinstance.StopRequest{ - DeallocateVM: to.Ptr(true), - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %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.OperationStatusResult = armworkloadssapvirtualinstance.OperationStatusResult{ - // Name: to.Ptr("centralServer"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapcentralinstances/SAPCentralInstances_StopInstance.json -func ExampleSAPCentralInstancesClient_BeginStopInstance_stopTheSapCentralServicesInstance() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPCentralInstancesClient().BeginStopInstance(ctx, "test-rg", "X00", "centralServer", &armworkloadssapvirtualinstance.SAPCentralInstancesClientBeginStopInstanceOptions{Body: &armworkloadssapvirtualinstance.StopRequest{ - SoftStopTimeoutSeconds: to.Ptr[int64](1200), - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %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.OperationStatusResult = armworkloadssapvirtualinstance.OperationStatusResult{ - // Name: to.Ptr("centralServer"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), - // } -} diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapcentralinstances_client.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapcentralserverinstances_client.go similarity index 62% rename from sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapcentralinstances_client.go rename to sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapcentralserverinstances_client.go index 5941cfe5dca7..2f3c222e252f 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapcentralinstances_client.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapcentralserverinstances_client.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armworkloadssapvirtualinstance @@ -20,70 +16,69 @@ import ( "strings" ) -// SAPCentralInstancesClient contains the methods for the SAPCentralInstances group. -// Don't use this type directly, use NewSAPCentralInstancesClient() instead. -type SAPCentralInstancesClient struct { +// SAPCentralServerInstancesClient contains the methods for the SAPCentralServerInstances group. +// Don't use this type directly, use NewSAPCentralServerInstancesClient() instead. +type SAPCentralServerInstancesClient struct { internal *arm.Client subscriptionID string } -// NewSAPCentralInstancesClient creates a new instance of SAPCentralInstancesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// NewSAPCentralServerInstancesClient creates a new instance of SAPCentralServerInstancesClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. -func NewSAPCentralInstancesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SAPCentralInstancesClient, error) { +func NewSAPCentralServerInstancesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SAPCentralServerInstancesClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } - client := &SAPCentralInstancesClient{ + client := &SAPCentralServerInstancesClient{ subscriptionID: subscriptionID, internal: cl, } return client, nil } -// BeginCreate - Creates the SAP Central Services Instance resource. -// This will be used by service only. PUT operation on this resource by end user will return a Bad Request error. +// BeginCreate - Creates the SAP Central Services Instance resource. <br><br>This will be used by service only. +// PUT operation on this resource by end user will return a Bad Request error. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - centralInstanceName - Central Services Instance resource name string modeled as parameter for auto generation to work correctly. -// - body - The SAP Central Services Instance request body. -// - options - SAPCentralInstancesClientBeginCreateOptions contains the optional parameters for the SAPCentralInstancesClient.BeginCreate +// - resource - The SAP Central Services Instance request body. +// - options - SAPCentralServerInstancesClientBeginCreateOptions contains the optional parameters for the SAPCentralServerInstancesClient.BeginCreate // method. -func (client *SAPCentralInstancesClient) BeginCreate(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, body SAPCentralServerInstance, options *SAPCentralInstancesClientBeginCreateOptions) (*runtime.Poller[SAPCentralInstancesClientCreateResponse], error) { +func (client *SAPCentralServerInstancesClient) BeginCreate(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, resource SAPCentralServerInstance, options *SAPCentralServerInstancesClientBeginCreateOptions) (*runtime.Poller[SAPCentralServerInstancesClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, resourceGroupName, sapVirtualInstanceName, centralInstanceName, body, options) + resp, err := client.create(ctx, resourceGroupName, sapVirtualInstanceName, centralInstanceName, resource, options) if err != nil { return nil, err } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPCentralInstancesClientCreateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPCentralServerInstancesClientCreateResponse]{ + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SAPCentralInstancesClientCreateResponse]{ + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SAPCentralServerInstancesClientCreateResponse]{ Tracer: client.internal.Tracer(), }) } } -// Create - Creates the SAP Central Services Instance resource. -// This will be used by service only. PUT operation on this resource by end user will return a Bad Request error. +// Create - Creates the SAP Central Services Instance resource. <br><br>This will be used by service only. PUT +// operation on this resource by end user will return a Bad Request error. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview -func (client *SAPCentralInstancesClient) create(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, body SAPCentralServerInstance, options *SAPCentralInstancesClientBeginCreateOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *SAPCentralServerInstancesClient) create(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, resource SAPCentralServerInstance, options *SAPCentralServerInstancesClientBeginCreateOptions) (*http.Response, error) { var err error - const operationName = "SAPCentralInstancesClient.BeginCreate" + const operationName = "SAPCentralServerInstancesClient.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, sapVirtualInstanceName, centralInstanceName, body, options) + req, err := client.createCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, centralInstanceName, resource, options) if err != nil { return nil, err } @@ -99,7 +94,7 @@ func (client *SAPCentralInstancesClient) create(ctx context.Context, resourceGro } // createCreateRequest creates the Create request. -func (client *SAPCentralInstancesClient) createCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, body SAPCentralServerInstance, options *SAPCentralInstancesClientBeginCreateOptions) (*policy.Request, error) { +func (client *SAPCentralServerInstancesClient) createCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, resource SAPCentralServerInstance, _ *SAPCentralServerInstancesClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -122,55 +117,53 @@ func (client *SAPCentralInstancesClient) createCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, body); err != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } return req, nil } -// BeginDelete - Deletes the SAP Central Services Instance resource. -// This will be used by service only. Delete operation on this resource by end user will return a Bad Request error. You can -// delete the parent resource, which is the Virtual Instance for SAP solutions -// resource, using the delete operation on it. +// BeginDelete - Deletes the SAP Central Services Instance resource. <br><br>This will be used by service only. +// Delete operation on this resource by end user will return a Bad Request error. You can delete the parent resource, which +// is the Virtual Instance for SAP solutions resource, using the delete operation on it. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - centralInstanceName - Central Services Instance resource name string modeled as parameter for auto generation to work correctly. -// - options - SAPCentralInstancesClientBeginDeleteOptions contains the optional parameters for the SAPCentralInstancesClient.BeginDelete +// - options - SAPCentralServerInstancesClientBeginDeleteOptions contains the optional parameters for the SAPCentralServerInstancesClient.BeginDelete // method. -func (client *SAPCentralInstancesClient) BeginDelete(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *SAPCentralInstancesClientBeginDeleteOptions) (*runtime.Poller[SAPCentralInstancesClientDeleteResponse], error) { +func (client *SAPCentralServerInstancesClient) BeginDelete(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *SAPCentralServerInstancesClientBeginDeleteOptions) (*runtime.Poller[SAPCentralServerInstancesClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, sapVirtualInstanceName, centralInstanceName, options) if err != nil { return nil, err } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPCentralInstancesClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPCentralServerInstancesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SAPCentralInstancesClientDeleteResponse]{ + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SAPCentralServerInstancesClientDeleteResponse]{ Tracer: client.internal.Tracer(), }) } } -// Delete - Deletes the SAP Central Services Instance resource. -// This will be used by service only. Delete operation on this resource by end user will return a Bad Request error. You can -// delete the parent resource, which is the Virtual Instance for SAP solutions -// resource, using the delete operation on it. +// Delete - Deletes the SAP Central Services Instance resource. <br><br>This will be used by service only. Delete +// operation on this resource by end user will return a Bad Request error. You can delete the parent resource, which is the +// Virtual Instance for SAP solutions resource, using the delete operation on it. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview -func (client *SAPCentralInstancesClient) deleteOperation(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *SAPCentralInstancesClientBeginDeleteOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *SAPCentralServerInstancesClient) deleteOperation(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *SAPCentralServerInstancesClientBeginDeleteOptions) (*http.Response, error) { var err error - const operationName = "SAPCentralInstancesClient.BeginDelete" + const operationName = "SAPCentralServerInstancesClient.BeginDelete" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() @@ -190,7 +183,7 @@ func (client *SAPCentralInstancesClient) deleteOperation(ctx context.Context, re } // deleteCreateRequest creates the Delete request. -func (client *SAPCentralInstancesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *SAPCentralInstancesClientBeginDeleteOptions) (*policy.Request, error) { +func (client *SAPCentralServerInstancesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, _ *SAPCentralServerInstancesClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -213,7 +206,7 @@ func (client *SAPCentralInstancesClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -222,35 +215,36 @@ func (client *SAPCentralInstancesClient) deleteCreateRequest(ctx context.Context // Get - Gets the SAP Central Services Instance resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - centralInstanceName - Central Services Instance resource name string modeled as parameter for auto generation to work correctly. -// - options - SAPCentralInstancesClientGetOptions contains the optional parameters for the SAPCentralInstancesClient.Get method. -func (client *SAPCentralInstancesClient) Get(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *SAPCentralInstancesClientGetOptions) (SAPCentralInstancesClientGetResponse, error) { +// - options - SAPCentralServerInstancesClientGetOptions contains the optional parameters for the SAPCentralServerInstancesClient.Get +// method. +func (client *SAPCentralServerInstancesClient) Get(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *SAPCentralServerInstancesClientGetOptions) (SAPCentralServerInstancesClientGetResponse, error) { var err error - const operationName = "SAPCentralInstancesClient.Get" + const operationName = "SAPCentralServerInstancesClient.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, sapVirtualInstanceName, centralInstanceName, options) if err != nil { - return SAPCentralInstancesClientGetResponse{}, err + return SAPCentralServerInstancesClientGetResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return SAPCentralInstancesClientGetResponse{}, err + return SAPCentralServerInstancesClientGetResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return SAPCentralInstancesClientGetResponse{}, err + return SAPCentralServerInstancesClientGetResponse{}, err } resp, err := client.getHandleResponse(httpResp) return resp, err } // getCreateRequest creates the Get request. -func (client *SAPCentralInstancesClient) getCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *SAPCentralInstancesClientGetOptions) (*policy.Request, error) { +func (client *SAPCentralServerInstancesClient) getCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, _ *SAPCentralServerInstancesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -273,35 +267,35 @@ func (client *SAPCentralInstancesClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // getHandleResponse handles the Get response. -func (client *SAPCentralInstancesClient) getHandleResponse(resp *http.Response) (SAPCentralInstancesClientGetResponse, error) { - result := SAPCentralInstancesClientGetResponse{} +func (client *SAPCentralServerInstancesClient) getHandleResponse(resp *http.Response) (SAPCentralServerInstancesClientGetResponse, error) { + result := SAPCentralServerInstancesClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.SAPCentralServerInstance); err != nil { - return SAPCentralInstancesClientGetResponse{}, err + return SAPCentralServerInstancesClientGetResponse{}, err } return result, nil } // NewListPager - Lists the SAP Central Services Instance resource for the given Virtual Instance for SAP solutions resource. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource -// - options - SAPCentralInstancesClientListOptions contains the optional parameters for the SAPCentralInstancesClient.NewListPager +// - options - SAPCentralServerInstancesClientListOptions contains the optional parameters for the SAPCentralServerInstancesClient.NewListPager // method. -func (client *SAPCentralInstancesClient) NewListPager(resourceGroupName string, sapVirtualInstanceName string, options *SAPCentralInstancesClientListOptions) *runtime.Pager[SAPCentralInstancesClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[SAPCentralInstancesClientListResponse]{ - More: func(page SAPCentralInstancesClientListResponse) bool { +func (client *SAPCentralServerInstancesClient) NewListPager(resourceGroupName string, sapVirtualInstanceName string, options *SAPCentralServerInstancesClientListOptions) *runtime.Pager[SAPCentralServerInstancesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[SAPCentralServerInstancesClientListResponse]{ + More: func(page SAPCentralServerInstancesClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, - Fetcher: func(ctx context.Context, page *SAPCentralInstancesClientListResponse) (SAPCentralInstancesClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SAPCentralInstancesClient.NewListPager") + Fetcher: func(ctx context.Context, page *SAPCentralServerInstancesClientListResponse) (SAPCentralServerInstancesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SAPCentralServerInstancesClient.NewListPager") nextLink := "" if page != nil { nextLink = *page.NextLink @@ -310,7 +304,7 @@ func (client *SAPCentralInstancesClient) NewListPager(resourceGroupName string, return client.listCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, options) }, nil) if err != nil { - return SAPCentralInstancesClientListResponse{}, err + return SAPCentralServerInstancesClientListResponse{}, err } return client.listHandleResponse(resp) }, @@ -319,7 +313,7 @@ func (client *SAPCentralInstancesClient) NewListPager(resourceGroupName string, } // listCreateRequest creates the List request. -func (client *SAPCentralInstancesClient) listCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, options *SAPCentralInstancesClientListOptions) (*policy.Request, error) { +func (client *SAPCentralServerInstancesClient) listCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, _ *SAPCentralServerInstancesClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -338,59 +332,58 @@ func (client *SAPCentralInstancesClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // listHandleResponse handles the List response. -func (client *SAPCentralInstancesClient) listHandleResponse(resp *http.Response) (SAPCentralInstancesClientListResponse, error) { - result := SAPCentralInstancesClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SAPCentralInstanceList); err != nil { - return SAPCentralInstancesClientListResponse{}, err +func (client *SAPCentralServerInstancesClient) listHandleResponse(resp *http.Response) (SAPCentralServerInstancesClientListResponse, error) { + result := SAPCentralServerInstancesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SAPCentralServerInstanceListResult); err != nil { + return SAPCentralServerInstancesClientListResponse{}, err } return result, nil } -// BeginStartInstance - Starts the SAP Central Services Instance. +// BeginStart - Starts the SAP Central Services Instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - centralInstanceName - Central Services Instance resource name string modeled as parameter for auto generation to work correctly. -// - options - SAPCentralInstancesClientBeginStartInstanceOptions contains the optional parameters for the SAPCentralInstancesClient.BeginStartInstance +// - options - SAPCentralServerInstancesClientBeginStartOptions contains the optional parameters for the SAPCentralServerInstancesClient.BeginStart // method. -func (client *SAPCentralInstancesClient) BeginStartInstance(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *SAPCentralInstancesClientBeginStartInstanceOptions) (*runtime.Poller[SAPCentralInstancesClientStartInstanceResponse], error) { +func (client *SAPCentralServerInstancesClient) BeginStart(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *SAPCentralServerInstancesClientBeginStartOptions) (*runtime.Poller[SAPCentralServerInstancesClientStartResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.startInstance(ctx, resourceGroupName, sapVirtualInstanceName, centralInstanceName, options) + resp, err := client.start(ctx, resourceGroupName, sapVirtualInstanceName, centralInstanceName, options) if err != nil { return nil, err } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPCentralInstancesClientStartInstanceResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPCentralServerInstancesClientStartResponse]{ + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SAPCentralInstancesClientStartInstanceResponse]{ + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SAPCentralServerInstancesClientStartResponse]{ Tracer: client.internal.Tracer(), }) } } -// StartInstance - Starts the SAP Central Services Instance. +// Start - Starts the SAP Central Services Instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview -func (client *SAPCentralInstancesClient) startInstance(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *SAPCentralInstancesClientBeginStartInstanceOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *SAPCentralServerInstancesClient) start(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *SAPCentralServerInstancesClientBeginStartOptions) (*http.Response, error) { var err error - const operationName = "SAPCentralInstancesClient.BeginStartInstance" + const operationName = "SAPCentralServerInstancesClient.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.startInstanceCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, centralInstanceName, options) + req, err := client.startCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, centralInstanceName, options) if err != nil { return nil, err } @@ -405,8 +398,8 @@ func (client *SAPCentralInstancesClient) startInstance(ctx context.Context, reso return httpResp, nil } -// startInstanceCreateRequest creates the StartInstance request. -func (client *SAPCentralInstancesClient) startInstanceCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *SAPCentralInstancesClientBeginStartInstanceOptions) (*policy.Request, error) { +// startCreateRequest creates the Start request. +func (client *SAPCentralServerInstancesClient) startCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *SAPCentralServerInstancesClientBeginStartOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}/start" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -429,10 +422,11 @@ func (client *SAPCentralInstancesClient) startInstanceCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Body != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { return nil, err } @@ -441,44 +435,43 @@ func (client *SAPCentralInstancesClient) startInstanceCreateRequest(ctx context. return req, nil } -// BeginStopInstance - Stops the SAP Central Services Instance. +// BeginStop - Stops the SAP Central Services Instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - centralInstanceName - Central Services Instance resource name string modeled as parameter for auto generation to work correctly. -// - options - SAPCentralInstancesClientBeginStopInstanceOptions contains the optional parameters for the SAPCentralInstancesClient.BeginStopInstance +// - options - SAPCentralServerInstancesClientBeginStopOptions contains the optional parameters for the SAPCentralServerInstancesClient.BeginStop // method. -func (client *SAPCentralInstancesClient) BeginStopInstance(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *SAPCentralInstancesClientBeginStopInstanceOptions) (*runtime.Poller[SAPCentralInstancesClientStopInstanceResponse], error) { +func (client *SAPCentralServerInstancesClient) BeginStop(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *SAPCentralServerInstancesClientBeginStopOptions) (*runtime.Poller[SAPCentralServerInstancesClientStopResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.stopInstance(ctx, resourceGroupName, sapVirtualInstanceName, centralInstanceName, options) + resp, err := client.stop(ctx, resourceGroupName, sapVirtualInstanceName, centralInstanceName, options) if err != nil { return nil, err } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPCentralInstancesClientStopInstanceResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPCentralServerInstancesClientStopResponse]{ + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SAPCentralInstancesClientStopInstanceResponse]{ + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SAPCentralServerInstancesClientStopResponse]{ Tracer: client.internal.Tracer(), }) } } -// StopInstance - Stops the SAP Central Services Instance. +// Stop - Stops the SAP Central Services Instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview -func (client *SAPCentralInstancesClient) stopInstance(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *SAPCentralInstancesClientBeginStopInstanceOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *SAPCentralServerInstancesClient) stop(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *SAPCentralServerInstancesClientBeginStopOptions) (*http.Response, error) { var err error - const operationName = "SAPCentralInstancesClient.BeginStopInstance" + const operationName = "SAPCentralServerInstancesClient.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.stopInstanceCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, centralInstanceName, options) + req, err := client.stopCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, centralInstanceName, options) if err != nil { return nil, err } @@ -493,8 +486,8 @@ func (client *SAPCentralInstancesClient) stopInstance(ctx context.Context, resou return httpResp, nil } -// stopInstanceCreateRequest creates the StopInstance request. -func (client *SAPCentralInstancesClient) stopInstanceCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *SAPCentralInstancesClientBeginStopInstanceOptions) (*policy.Request, error) { +// stopCreateRequest creates the Stop request. +func (client *SAPCentralServerInstancesClient) stopCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *SAPCentralServerInstancesClientBeginStopOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}/stop" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -517,10 +510,11 @@ func (client *SAPCentralInstancesClient) stopInstanceCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Body != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { return nil, err } @@ -529,41 +523,41 @@ func (client *SAPCentralInstancesClient) stopInstanceCreateRequest(ctx context.C return req, nil } -// Update - Updates the SAP Central Services Instance resource. -// This can be used to update tags on the resource. +// Update - Updates the SAP Central Services Instance resource. <br><br>This can be used to update tags on the +// resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - centralInstanceName - Central Services Instance resource name string modeled as parameter for auto generation to work correctly. -// - body - The SAP Central Services Instance resource request body. -// - options - SAPCentralInstancesClientUpdateOptions contains the optional parameters for the SAPCentralInstancesClient.Update +// - properties - The SAP Central Services Instance resource request body. +// - options - SAPCentralServerInstancesClientUpdateOptions contains the optional parameters for the SAPCentralServerInstancesClient.Update // method. -func (client *SAPCentralInstancesClient) Update(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, body UpdateSAPCentralInstanceRequest, options *SAPCentralInstancesClientUpdateOptions) (SAPCentralInstancesClientUpdateResponse, error) { +func (client *SAPCentralServerInstancesClient) Update(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, properties UpdateSAPCentralInstanceRequest, options *SAPCentralServerInstancesClientUpdateOptions) (SAPCentralServerInstancesClientUpdateResponse, error) { var err error - const operationName = "SAPCentralInstancesClient.Update" + const operationName = "SAPCentralServerInstancesClient.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, sapVirtualInstanceName, centralInstanceName, body, options) + req, err := client.updateCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, centralInstanceName, properties, options) if err != nil { - return SAPCentralInstancesClientUpdateResponse{}, err + return SAPCentralServerInstancesClientUpdateResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return SAPCentralInstancesClientUpdateResponse{}, err + return SAPCentralServerInstancesClientUpdateResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return SAPCentralInstancesClientUpdateResponse{}, err + return SAPCentralServerInstancesClientUpdateResponse{}, err } resp, err := client.updateHandleResponse(httpResp) return resp, err } // updateCreateRequest creates the Update request. -func (client *SAPCentralInstancesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, body UpdateSAPCentralInstanceRequest, options *SAPCentralInstancesClientUpdateOptions) (*policy.Request, error) { +func (client *SAPCentralServerInstancesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, properties UpdateSAPCentralInstanceRequest, _ *SAPCentralServerInstancesClientUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -586,20 +580,21 @@ func (client *SAPCentralInstancesClient) updateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, body); err != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { return nil, err } return req, nil } // updateHandleResponse handles the Update response. -func (client *SAPCentralInstancesClient) updateHandleResponse(resp *http.Response) (SAPCentralInstancesClientUpdateResponse, error) { - result := SAPCentralInstancesClientUpdateResponse{} +func (client *SAPCentralServerInstancesClient) updateHandleResponse(resp *http.Response) (SAPCentralServerInstancesClientUpdateResponse, error) { + result := SAPCentralServerInstancesClientUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.SAPCentralServerInstance); err != nil { - return SAPCentralInstancesClientUpdateResponse{}, err + return SAPCentralServerInstancesClientUpdateResponse{}, err } return result, nil } diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapcentralserverinstances_client_example_test.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapcentralserverinstances_client_example_test.go new file mode 100644 index 000000000000..c682e2bcaabc --- /dev/null +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapcentralserverinstances_client_example_test.go @@ -0,0 +1,627 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armworkloadssapvirtualinstance_test + +import ( + "context" + "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/workloadssapvirtualinstance/armworkloadssapvirtualinstance" + "log" +) + +// Generated from example definition: 2024-09-01/SapCentralInstances_Create.json +func ExampleSAPCentralServerInstancesClient_BeginCreate_sapCentralServerInstancesCreate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("6d875e77-e412-4d7d-9af4-8895278b4443", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSAPCentralServerInstancesClient().BeginCreate(ctx, "test-rg", "X00", "centralServer", armworkloadssapvirtualinstance.SAPCentralServerInstance{ + Location: to.Ptr("westcentralus"), + Properties: &armworkloadssapvirtualinstance.SAPCentralServerProperties{}, + Tags: map[string]*string{}, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %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 = armworkloadssapvirtualinstance.SAPCentralServerInstancesClientCreateResponse{ + // SAPCentralServerInstance: &armworkloadssapvirtualinstance.SAPCentralServerInstance{ + // Name: to.Ptr("centralServer"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/centralInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPCentralServerProperties{ + // EnqueueReplicationServerProperties: &armworkloadssapvirtualinstance.EnqueueReplicationServerProperties{ + // ErsVersion: to.Ptr(armworkloadssapvirtualinstance.EnqueueReplicationServerTypeEnqueueReplicator1), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Hostname: to.Ptr("vh-ers1"), + // InstanceNo: to.Ptr("00"), + // IPAddress: to.Ptr("10.0.0.5"), + // KernelPatch: to.Ptr("patch 300"), + // KernelVersion: to.Ptr("777"), + // }, + // EnqueueServerProperties: &armworkloadssapvirtualinstance.EnqueueServerProperties{ + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Hostname: to.Ptr("vh-ascs1"), + // IPAddress: to.Ptr("10.0.0.5"), + // Port: to.Ptr[int64](3600), + // }, + // GatewayServerProperties: &armworkloadssapvirtualinstance.GatewayServerProperties{ + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Port: to.Ptr[int64](3300), + // }, + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // InstanceNo: to.Ptr("00"), + // KernelPatch: to.Ptr("patch 300"), + // KernelVersion: to.Ptr("777"), + // MessageServerProperties: &armworkloadssapvirtualinstance.MessageServerProperties{ + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Hostname: to.Ptr("vh-ascs1"), + // HTTPPort: to.Ptr[int64](8100), + // HTTPSPort: to.Ptr[int64](44400), + // InternalMsPort: to.Ptr[int64](3900), + // IPAddress: to.Ptr("10.0.0.5"), + // MSPort: to.Ptr[int64](3600), + // }, + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), + // VMDetails: []*armworkloadssapvirtualinstance.CentralServerVMDetails{ + // { + // Type: to.Ptr(armworkloadssapvirtualinstance.CentralServerVirtualMachineTypePrimary), + // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/cs-vm"), + // }, + // }, + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapCentralInstances_CreateForHaWithAvailabilitySet.json +func ExampleSAPCentralServerInstancesClient_BeginCreate_createSapCentralInstancesForHaSystemWithAvailabilitySet() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("6d875e77-e412-4d7d-9af4-8895278b4443", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSAPCentralServerInstancesClient().BeginCreate(ctx, "test-rg", "X00", "centralServer", armworkloadssapvirtualinstance.SAPCentralServerInstance{ + Location: to.Ptr("westcentralus"), + Properties: &armworkloadssapvirtualinstance.SAPCentralServerProperties{}, + Tags: map[string]*string{}, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %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 = armworkloadssapvirtualinstance.SAPCentralServerInstancesClientCreateResponse{ + // SAPCentralServerInstance: &armworkloadssapvirtualinstance.SAPCentralServerInstance{ + // Name: to.Ptr("centralServer"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/centralInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPCentralServerProperties{ + // EnqueueReplicationServerProperties: &armworkloadssapvirtualinstance.EnqueueReplicationServerProperties{ + // ErsVersion: to.Ptr(armworkloadssapvirtualinstance.EnqueueReplicationServerTypeEnqueueReplicator1), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Hostname: to.Ptr("vh-ers1"), + // InstanceNo: to.Ptr("00"), + // IPAddress: to.Ptr("10.0.0.5"), + // KernelPatch: to.Ptr("patch 300"), + // KernelVersion: to.Ptr("777"), + // }, + // EnqueueServerProperties: &armworkloadssapvirtualinstance.EnqueueServerProperties{ + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Hostname: to.Ptr("vh-ascs1"), + // IPAddress: to.Ptr("10.0.0.5"), + // Port: to.Ptr[int64](3600), + // }, + // GatewayServerProperties: &armworkloadssapvirtualinstance.GatewayServerProperties{ + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Port: to.Ptr[int64](3300), + // }, + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // InstanceNo: to.Ptr("00"), + // KernelPatch: to.Ptr("patch 300"), + // KernelVersion: to.Ptr("777"), + // LoadBalancerDetails: &armworkloadssapvirtualinstance.LoadBalancerDetails{ + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Network/loadBalancers/cs-ASCS-loadBalancer"), + // }, + // MessageServerProperties: &armworkloadssapvirtualinstance.MessageServerProperties{ + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Hostname: to.Ptr("vh-ascs1"), + // HTTPPort: to.Ptr[int64](8100), + // HTTPSPort: to.Ptr[int64](44400), + // InternalMsPort: to.Ptr[int64](3900), + // IPAddress: to.Ptr("10.0.0.5"), + // MSPort: to.Ptr[int64](3600), + // }, + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), + // VMDetails: []*armworkloadssapvirtualinstance.CentralServerVMDetails{ + // { + // Type: to.Ptr(armworkloadssapvirtualinstance.CentralServerVirtualMachineTypePrimary), + // StorageDetails: []*armworkloadssapvirtualinstance.StorageInformation{ + // { + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/nfsstorageaccount"), + // }, + // }, + // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/cs-vm1"), + // }, + // { + // Type: to.Ptr(armworkloadssapvirtualinstance.CentralServerVirtualMachineTypePrimary), + // StorageDetails: []*armworkloadssapvirtualinstance.StorageInformation{ + // { + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/nfsstorageaccount"), + // }, + // }, + // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/cs-vm2"), + // }, + // }, + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapCentralInstances_Delete.json +func ExampleSAPCentralServerInstancesClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("6d875e77-e412-4d7d-9af4-8895278b4443", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSAPCentralServerInstancesClient().BeginDelete(ctx, "test-rg", "X00", "centralServer", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: 2024-09-01/SapCentralInstances_Get.json +func ExampleSAPCentralServerInstancesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("6d875e77-e412-4d7d-9af4-8895278b4443", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSAPCentralServerInstancesClient().Get(ctx, "test-rg", "X00", "centralServer", 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 = armworkloadssapvirtualinstance.SAPCentralServerInstancesClientGetResponse{ + // SAPCentralServerInstance: &armworkloadssapvirtualinstance.SAPCentralServerInstance{ + // Name: to.Ptr("centralServer"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/centralInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPCentralServerProperties{ + // EnqueueReplicationServerProperties: &armworkloadssapvirtualinstance.EnqueueReplicationServerProperties{ + // ErsVersion: to.Ptr(armworkloadssapvirtualinstance.EnqueueReplicationServerTypeEnqueueReplicator1), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Hostname: to.Ptr("vh-ers1"), + // InstanceNo: to.Ptr("00"), + // IPAddress: to.Ptr("10.0.0.5"), + // KernelPatch: to.Ptr("patch 300"), + // KernelVersion: to.Ptr("777"), + // }, + // EnqueueServerProperties: &armworkloadssapvirtualinstance.EnqueueServerProperties{ + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // Hostname: to.Ptr("vh-ascs1"), + // IPAddress: to.Ptr("10.0.0.5"), + // Port: to.Ptr[int64](3600), + // }, + // GatewayServerProperties: &armworkloadssapvirtualinstance.GatewayServerProperties{ + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateDegraded), + // Port: to.Ptr[int64](3300), + // }, + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // InstanceNo: to.Ptr("00"), + // KernelPatch: to.Ptr("patch 300"), + // KernelVersion: to.Ptr("777"), + // MessageServerProperties: &armworkloadssapvirtualinstance.MessageServerProperties{ + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnhealthy), + // Hostname: to.Ptr("vh-ascs1"), + // HTTPPort: to.Ptr[int64](8100), + // HTTPSPort: to.Ptr[int64](44400), + // InternalMsPort: to.Ptr[int64](3900), + // IPAddress: to.Ptr("10.0.0.5"), + // MSPort: to.Ptr[int64](3600), + // }, + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), + // VMDetails: []*armworkloadssapvirtualinstance.CentralServerVMDetails{ + // { + // Type: to.Ptr(armworkloadssapvirtualinstance.CentralServerVirtualMachineTypePrimary), + // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/cs-vm"), + // }, + // }, + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapCentralServerInstances_ListBySapVirtualInstance.json +func ExampleSAPCentralServerInstancesClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("6d875e77-e412-4d7d-9af4-8895278b4443", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewSAPCentralServerInstancesClient().NewListPager("test-rg", "X00", 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 = armworkloadssapvirtualinstance.SAPCentralServerInstancesClientListResponse{ + // SAPCentralServerInstanceListResult: armworkloadssapvirtualinstance.SAPCentralServerInstanceListResult{ + // Value: []*armworkloadssapvirtualinstance.SAPCentralServerInstance{ + // { + // Name: to.Ptr("centralServer"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/centralInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPCentralServerProperties{ + // EnqueueReplicationServerProperties: &armworkloadssapvirtualinstance.EnqueueReplicationServerProperties{ + // ErsVersion: to.Ptr(armworkloadssapvirtualinstance.EnqueueReplicationServerTypeEnqueueReplicator1), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Hostname: to.Ptr("vh-ers1"), + // InstanceNo: to.Ptr("00"), + // IPAddress: to.Ptr("10.0.0.5"), + // KernelPatch: to.Ptr("patch 300"), + // KernelVersion: to.Ptr("777"), + // }, + // EnqueueServerProperties: &armworkloadssapvirtualinstance.EnqueueServerProperties{ + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Hostname: to.Ptr("vh-ascs1"), + // IPAddress: to.Ptr("10.0.0.5"), + // Port: to.Ptr[int64](3600), + // }, + // GatewayServerProperties: &armworkloadssapvirtualinstance.GatewayServerProperties{ + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Port: to.Ptr[int64](3300), + // }, + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // InstanceNo: to.Ptr("00"), + // KernelPatch: to.Ptr("patch 300"), + // KernelVersion: to.Ptr("777"), + // MessageServerProperties: &armworkloadssapvirtualinstance.MessageServerProperties{ + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Hostname: to.Ptr("vh-ascs1"), + // HTTPPort: to.Ptr[int64](8100), + // HTTPSPort: to.Ptr[int64](44400), + // InternalMsPort: to.Ptr[int64](3900), + // IPAddress: to.Ptr("10.0.0.5"), + // MSPort: to.Ptr[int64](3600), + // }, + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), + // VMDetails: []*armworkloadssapvirtualinstance.CentralServerVMDetails{ + // { + // Type: to.Ptr(armworkloadssapvirtualinstance.CentralServerVirtualMachineTypePrimary), + // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/cs-vm"), + // }, + // }, + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2024-09-01/SapCentralInstances_StartInstance.json +func ExampleSAPCentralServerInstancesClient_BeginStart_startTheSapCentralServicesInstance() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSAPCentralServerInstancesClient().BeginStart(ctx, "test-rg", "X00", "centralServer", &SAPCentralServerInstancesClientBeginStartOptions{ + body: &armworkloadssapvirtualinstance.StartRequest{}}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %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 = armworkloadssapvirtualinstance.SAPCentralServerInstancesClientStartResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("centralServer"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapCentralInstances_StartInstanceVM.json +func ExampleSAPCentralServerInstancesClient_BeginStart_startTheVirtualMachineSAndTheSapCentralServicesInstanceOnIt() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSAPCentralServerInstancesClient().BeginStart(ctx, "test-rg", "X00", "centralServer", &SAPCentralServerInstancesClientBeginStartOptions{ + body: &armworkloadssapvirtualinstance.StartRequest{ + StartVM: to.Ptr(true), + }}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %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 = armworkloadssapvirtualinstance.SAPCentralServerInstancesClientStartResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("centralServer"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapCentralInstances_StopInstance.json +func ExampleSAPCentralServerInstancesClient_BeginStop_stopTheSapCentralServicesInstance() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSAPCentralServerInstancesClient().BeginStop(ctx, "test-rg", "X00", "centralServer", &SAPCentralServerInstancesClientBeginStopOptions{ + body: &armworkloadssapvirtualinstance.StopRequest{ + SoftStopTimeoutSeconds: to.Ptr[int64](1200), + }}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %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 = armworkloadssapvirtualinstance.SAPCentralServerInstancesClientStopResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("centralServer"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapCentralInstances_StopInstanceVM.json +func ExampleSAPCentralServerInstancesClient_BeginStop_stopTheSapCentralServicesInstanceAndItsUnderlyingVirtualMachineS() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSAPCentralServerInstancesClient().BeginStop(ctx, "test-rg", "X00", "centralServer", &SAPCentralServerInstancesClientBeginStopOptions{ + body: &armworkloadssapvirtualinstance.StopRequest{ + DeallocateVM: to.Ptr(true), + }}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %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 = armworkloadssapvirtualinstance.SAPCentralServerInstancesClientStopResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("centralServer"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapCentralInstances_Update.json +func ExampleSAPCentralServerInstancesClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("6d875e77-e412-4d7d-9af4-8895278b4443", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSAPCentralServerInstancesClient().Update(ctx, "test-rg", "X00", "centralServer", armworkloadssapvirtualinstance.UpdateSAPCentralInstanceRequest{ + Tags: map[string]*string{ + "tag1": to.Ptr("value1"), + }, + }, 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 = armworkloadssapvirtualinstance.SAPCentralServerInstancesClientUpdateResponse{ + // SAPCentralServerInstance: &armworkloadssapvirtualinstance.SAPCentralServerInstance{ + // Name: to.Ptr("centralServer"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/centralInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPCentralServerProperties{ + // EnqueueReplicationServerProperties: &armworkloadssapvirtualinstance.EnqueueReplicationServerProperties{ + // ErsVersion: to.Ptr(armworkloadssapvirtualinstance.EnqueueReplicationServerTypeEnqueueReplicator1), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Hostname: to.Ptr("vh-ers1"), + // InstanceNo: to.Ptr("00"), + // IPAddress: to.Ptr("10.0.0.5"), + // KernelPatch: to.Ptr("patch 300"), + // KernelVersion: to.Ptr("777"), + // }, + // EnqueueServerProperties: &armworkloadssapvirtualinstance.EnqueueServerProperties{ + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Hostname: to.Ptr("vh-ascs1"), + // IPAddress: to.Ptr("10.0.0.5"), + // Port: to.Ptr[int64](3600), + // }, + // GatewayServerProperties: &armworkloadssapvirtualinstance.GatewayServerProperties{ + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Port: to.Ptr[int64](3300), + // }, + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // InstanceNo: to.Ptr("00"), + // KernelPatch: to.Ptr("patch 300"), + // KernelVersion: to.Ptr("777"), + // MessageServerProperties: &armworkloadssapvirtualinstance.MessageServerProperties{ + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Hostname: to.Ptr("vh-ascs1"), + // HTTPPort: to.Ptr[int64](8100), + // HTTPSPort: to.Ptr[int64](44400), + // InternalMsPort: to.Ptr[int64](3900), + // IPAddress: to.Ptr("10.0.0.5"), + // MSPort: to.Ptr[int64](3600), + // }, + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), + // VMDetails: []*armworkloadssapvirtualinstance.CentralServerVMDetails{ + // { + // Type: to.Ptr(armworkloadssapvirtualinstance.CentralServerVirtualMachineTypePrimary), + // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/cs-vm"), + // }, + // }, + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapdatabaseinstances_client.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapdatabaseinstances_client.go index 82161ffb0f2a..db0c2fe0240e 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapdatabaseinstances_client.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapdatabaseinstances_client.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armworkloadssapvirtualinstance @@ -28,7 +24,7 @@ type SAPDatabaseInstancesClient struct { } // NewSAPDatabaseInstancesClient creates a new instance of SAPDatabaseInstancesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewSAPDatabaseInstancesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SAPDatabaseInstancesClient, error) { @@ -43,26 +39,25 @@ func NewSAPDatabaseInstancesClient(subscriptionID string, credential azcore.Toke return client, nil } -// BeginCreate - Creates the Database resource corresponding to the Virtual Instance for SAP solutions resource. -// This will be used by service only. PUT by end user will return a Bad Request error. +// BeginCreate - Creates the Database resource corresponding to the Virtual Instance for SAP solutions resource. <br><br>This +// will be used by service only. PUT by end user will return a Bad Request error. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - databaseInstanceName - Database resource name string modeled as parameter for auto generation to work correctly. -// - body - Request body of Database resource of a SAP system. +// - resource - Request body of Database resource of a SAP system. // - options - SAPDatabaseInstancesClientBeginCreateOptions contains the optional parameters for the SAPDatabaseInstancesClient.BeginCreate // method. -func (client *SAPDatabaseInstancesClient) BeginCreate(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, body SAPDatabaseInstance, options *SAPDatabaseInstancesClientBeginCreateOptions) (*runtime.Poller[SAPDatabaseInstancesClientCreateResponse], error) { +func (client *SAPDatabaseInstancesClient) BeginCreate(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, resource SAPDatabaseInstance, options *SAPDatabaseInstancesClientBeginCreateOptions) (*runtime.Poller[SAPDatabaseInstancesClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, resourceGroupName, sapVirtualInstanceName, databaseInstanceName, body, options) + resp, err := client.create(ctx, resourceGroupName, sapVirtualInstanceName, databaseInstanceName, resource, options) if err != nil { return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPDatabaseInstancesClientCreateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -72,18 +67,18 @@ func (client *SAPDatabaseInstancesClient) BeginCreate(ctx context.Context, resou } } -// Create - Creates the Database resource corresponding to the Virtual Instance for SAP solutions resource. -// This will be used by service only. PUT by end user will return a Bad Request error. +// Create - Creates the Database resource corresponding to the Virtual Instance for SAP solutions resource. <br><br>This +// will be used by service only. PUT by end user will return a Bad Request error. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview -func (client *SAPDatabaseInstancesClient) create(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, body SAPDatabaseInstance, options *SAPDatabaseInstancesClientBeginCreateOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *SAPDatabaseInstancesClient) create(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, resource SAPDatabaseInstance, options *SAPDatabaseInstancesClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "SAPDatabaseInstancesClient.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, sapVirtualInstanceName, databaseInstanceName, body, options) + req, err := client.createCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, databaseInstanceName, resource, options) if err != nil { return nil, err } @@ -99,7 +94,7 @@ func (client *SAPDatabaseInstancesClient) create(ctx context.Context, resourceGr } // createCreateRequest creates the Create request. -func (client *SAPDatabaseInstancesClient) createCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, body SAPDatabaseInstance, options *SAPDatabaseInstancesClientBeginCreateOptions) (*policy.Request, error) { +func (client *SAPDatabaseInstancesClient) createCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, resource SAPDatabaseInstance, _ *SAPDatabaseInstancesClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -122,20 +117,21 @@ func (client *SAPDatabaseInstancesClient) createCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, body); err != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } return req, nil } -// BeginDelete - Deletes the Database resource corresponding to a Virtual Instance for SAP solutions resource. -// This will be used by service only. Delete by end user will return a Bad Request error. +// BeginDelete - Deletes the Database resource corresponding to a Virtual Instance for SAP solutions resource. <br><br>This +// will be used by service only. Delete by end user will return a Bad Request error. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - databaseInstanceName - Database resource name string modeled as parameter for auto generation to work correctly. @@ -148,8 +144,7 @@ func (client *SAPDatabaseInstancesClient) BeginDelete(ctx context.Context, resou return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPDatabaseInstancesClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -159,11 +154,11 @@ func (client *SAPDatabaseInstancesClient) BeginDelete(ctx context.Context, resou } } -// Delete - Deletes the Database resource corresponding to a Virtual Instance for SAP solutions resource. -// This will be used by service only. Delete by end user will return a Bad Request error. +// Delete - Deletes the Database resource corresponding to a Virtual Instance for SAP solutions resource. <br><br>This +// will be used by service only. Delete by end user will return a Bad Request error. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 func (client *SAPDatabaseInstancesClient) deleteOperation(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, options *SAPDatabaseInstancesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "SAPDatabaseInstancesClient.BeginDelete" @@ -186,7 +181,7 @@ func (client *SAPDatabaseInstancesClient) deleteOperation(ctx context.Context, r } // deleteCreateRequest creates the Delete request. -func (client *SAPDatabaseInstancesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, options *SAPDatabaseInstancesClientBeginDeleteOptions) (*policy.Request, error) { +func (client *SAPDatabaseInstancesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, _ *SAPDatabaseInstancesClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -209,7 +204,7 @@ func (client *SAPDatabaseInstancesClient) deleteCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -218,7 +213,7 @@ func (client *SAPDatabaseInstancesClient) deleteCreateRequest(ctx context.Contex // Get - Gets the SAP Database Instance resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - databaseInstanceName - Database resource name string modeled as parameter for auto generation to work correctly. @@ -247,7 +242,7 @@ func (client *SAPDatabaseInstancesClient) Get(ctx context.Context, resourceGroup } // getCreateRequest creates the Get request. -func (client *SAPDatabaseInstancesClient) getCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, options *SAPDatabaseInstancesClientGetOptions) (*policy.Request, error) { +func (client *SAPDatabaseInstancesClient) getCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, _ *SAPDatabaseInstancesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -270,7 +265,7 @@ func (client *SAPDatabaseInstancesClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -287,7 +282,7 @@ func (client *SAPDatabaseInstancesClient) getHandleResponse(resp *http.Response) // NewListPager - Lists the Database resources associated with a Virtual Instance for SAP solutions resource. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - options - SAPDatabaseInstancesClientListOptions contains the optional parameters for the SAPDatabaseInstancesClient.NewListPager @@ -316,7 +311,7 @@ func (client *SAPDatabaseInstancesClient) NewListPager(resourceGroupName string, } // listCreateRequest creates the List request. -func (client *SAPDatabaseInstancesClient) listCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, options *SAPDatabaseInstancesClientListOptions) (*policy.Request, error) { +func (client *SAPDatabaseInstancesClient) listCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, _ *SAPDatabaseInstancesClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -335,7 +330,7 @@ func (client *SAPDatabaseInstancesClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -344,50 +339,49 @@ func (client *SAPDatabaseInstancesClient) listCreateRequest(ctx context.Context, // listHandleResponse handles the List response. func (client *SAPDatabaseInstancesClient) listHandleResponse(resp *http.Response) (SAPDatabaseInstancesClientListResponse, error) { result := SAPDatabaseInstancesClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SAPDatabaseInstanceList); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.SAPDatabaseInstanceListResult); err != nil { return SAPDatabaseInstancesClientListResponse{}, err } return result, nil } -// BeginStartInstance - Starts the database instance of the SAP system. +// BeginStart - Starts the database instance of the SAP system. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - databaseInstanceName - Database resource name string modeled as parameter for auto generation to work correctly. -// - options - SAPDatabaseInstancesClientBeginStartInstanceOptions contains the optional parameters for the SAPDatabaseInstancesClient.BeginStartInstance +// - options - SAPDatabaseInstancesClientBeginStartOptions contains the optional parameters for the SAPDatabaseInstancesClient.BeginStart // method. -func (client *SAPDatabaseInstancesClient) BeginStartInstance(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, options *SAPDatabaseInstancesClientBeginStartInstanceOptions) (*runtime.Poller[SAPDatabaseInstancesClientStartInstanceResponse], error) { +func (client *SAPDatabaseInstancesClient) BeginStart(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, options *SAPDatabaseInstancesClientBeginStartOptions) (*runtime.Poller[SAPDatabaseInstancesClientStartResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.startInstance(ctx, resourceGroupName, sapVirtualInstanceName, databaseInstanceName, options) + resp, err := client.start(ctx, resourceGroupName, sapVirtualInstanceName, databaseInstanceName, options) if err != nil { return nil, err } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPDatabaseInstancesClientStartInstanceResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPDatabaseInstancesClientStartResponse]{ + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SAPDatabaseInstancesClientStartInstanceResponse]{ + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SAPDatabaseInstancesClientStartResponse]{ Tracer: client.internal.Tracer(), }) } } -// StartInstance - Starts the database instance of the SAP system. +// Start - Starts the database instance of the SAP system. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview -func (client *SAPDatabaseInstancesClient) startInstance(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, options *SAPDatabaseInstancesClientBeginStartInstanceOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *SAPDatabaseInstancesClient) start(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, options *SAPDatabaseInstancesClientBeginStartOptions) (*http.Response, error) { var err error - const operationName = "SAPDatabaseInstancesClient.BeginStartInstance" + const operationName = "SAPDatabaseInstancesClient.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.startInstanceCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, databaseInstanceName, options) + req, err := client.startCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, databaseInstanceName, options) if err != nil { return nil, err } @@ -402,8 +396,8 @@ func (client *SAPDatabaseInstancesClient) startInstance(ctx context.Context, res return httpResp, nil } -// startInstanceCreateRequest creates the StartInstance request. -func (client *SAPDatabaseInstancesClient) startInstanceCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, options *SAPDatabaseInstancesClientBeginStartInstanceOptions) (*policy.Request, error) { +// startCreateRequest creates the Start request. +func (client *SAPDatabaseInstancesClient) startCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, options *SAPDatabaseInstancesClientBeginStartOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}/start" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -426,10 +420,11 @@ func (client *SAPDatabaseInstancesClient) startInstanceCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Body != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { return nil, err } @@ -438,44 +433,43 @@ func (client *SAPDatabaseInstancesClient) startInstanceCreateRequest(ctx context return req, nil } -// BeginStopInstance - Stops the database instance of the SAP system. +// BeginStop - Stops the database instance of the SAP system. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - databaseInstanceName - Database resource name string modeled as parameter for auto generation to work correctly. -// - options - SAPDatabaseInstancesClientBeginStopInstanceOptions contains the optional parameters for the SAPDatabaseInstancesClient.BeginStopInstance +// - options - SAPDatabaseInstancesClientBeginStopOptions contains the optional parameters for the SAPDatabaseInstancesClient.BeginStop // method. -func (client *SAPDatabaseInstancesClient) BeginStopInstance(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, options *SAPDatabaseInstancesClientBeginStopInstanceOptions) (*runtime.Poller[SAPDatabaseInstancesClientStopInstanceResponse], error) { +func (client *SAPDatabaseInstancesClient) BeginStop(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, options *SAPDatabaseInstancesClientBeginStopOptions) (*runtime.Poller[SAPDatabaseInstancesClientStopResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.stopInstance(ctx, resourceGroupName, sapVirtualInstanceName, databaseInstanceName, options) + resp, err := client.stop(ctx, resourceGroupName, sapVirtualInstanceName, databaseInstanceName, options) if err != nil { return nil, err } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPDatabaseInstancesClientStopInstanceResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPDatabaseInstancesClientStopResponse]{ + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SAPDatabaseInstancesClientStopInstanceResponse]{ + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SAPDatabaseInstancesClientStopResponse]{ Tracer: client.internal.Tracer(), }) } } -// StopInstance - Stops the database instance of the SAP system. +// Stop - Stops the database instance of the SAP system. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview -func (client *SAPDatabaseInstancesClient) stopInstance(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, options *SAPDatabaseInstancesClientBeginStopInstanceOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *SAPDatabaseInstancesClient) stop(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, options *SAPDatabaseInstancesClientBeginStopOptions) (*http.Response, error) { var err error - const operationName = "SAPDatabaseInstancesClient.BeginStopInstance" + const operationName = "SAPDatabaseInstancesClient.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.stopInstanceCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, databaseInstanceName, options) + req, err := client.stopCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, databaseInstanceName, options) if err != nil { return nil, err } @@ -490,8 +484,8 @@ func (client *SAPDatabaseInstancesClient) stopInstance(ctx context.Context, reso return httpResp, nil } -// stopInstanceCreateRequest creates the StopInstance request. -func (client *SAPDatabaseInstancesClient) stopInstanceCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, options *SAPDatabaseInstancesClientBeginStopInstanceOptions) (*policy.Request, error) { +// stopCreateRequest creates the Stop request. +func (client *SAPDatabaseInstancesClient) stopCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, options *SAPDatabaseInstancesClientBeginStopOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}/stop" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -514,10 +508,11 @@ func (client *SAPDatabaseInstancesClient) stopInstanceCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Body != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { return nil, err } @@ -526,23 +521,23 @@ func (client *SAPDatabaseInstancesClient) stopInstanceCreateRequest(ctx context. return req, nil } -// Update - Updates the Database instance resource. This can be used to update tags on the resource. +// Update - Updates the Database resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - databaseInstanceName - Database resource name string modeled as parameter for auto generation to work correctly. -// - body - Database resource update request body. +// - properties - Database resource update request body. // - options - SAPDatabaseInstancesClientUpdateOptions contains the optional parameters for the SAPDatabaseInstancesClient.Update // method. -func (client *SAPDatabaseInstancesClient) Update(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, body UpdateSAPDatabaseInstanceRequest, options *SAPDatabaseInstancesClientUpdateOptions) (SAPDatabaseInstancesClientUpdateResponse, error) { +func (client *SAPDatabaseInstancesClient) Update(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, properties UpdateSAPDatabaseInstanceRequest, options *SAPDatabaseInstancesClientUpdateOptions) (SAPDatabaseInstancesClientUpdateResponse, error) { var err error const operationName = "SAPDatabaseInstancesClient.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, sapVirtualInstanceName, databaseInstanceName, body, options) + req, err := client.updateCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, databaseInstanceName, properties, options) if err != nil { return SAPDatabaseInstancesClientUpdateResponse{}, err } @@ -559,7 +554,7 @@ func (client *SAPDatabaseInstancesClient) Update(ctx context.Context, resourceGr } // updateCreateRequest creates the Update request. -func (client *SAPDatabaseInstancesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, body UpdateSAPDatabaseInstanceRequest, options *SAPDatabaseInstancesClientUpdateOptions) (*policy.Request, error) { +func (client *SAPDatabaseInstancesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, properties UpdateSAPDatabaseInstanceRequest, _ *SAPDatabaseInstancesClientUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -582,10 +577,11 @@ func (client *SAPDatabaseInstancesClient) updateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, body); err != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { return nil, err } return req, nil diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapdatabaseinstances_client_example_test.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapdatabaseinstances_client_example_test.go index 05c7f04b06f0..1a21f88cb51b 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapdatabaseinstances_client_example_test.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapdatabaseinstances_client_example_test.go @@ -1,78 +1,91 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armworkloadssapvirtualinstance_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/workloadssapvirtualinstance/armworkloadssapvirtualinstance" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapdatabaseinstances/SAPDatabaseInstances_Get.json -func ExampleSAPDatabaseInstancesClient_Get() { +// Generated from example definition: 2024-09-01/SapDatabaseInstances_Create.json +func ExampleSAPDatabaseInstancesClient_BeginCreate_sapDatabaseInstancesCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("6d875e77-e412-4d7d-9af4-8895278b4443", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewSAPDatabaseInstancesClient().Get(ctx, "test-rg", "X00", "databaseServer", nil) + poller, err := clientFactory.NewSAPDatabaseInstancesClient().BeginCreate(ctx, "test-rg", "X00", "databaseServer", armworkloadssapvirtualinstance.SAPDatabaseInstance{ + Location: to.Ptr("westcentralus"), + Properties: &armworkloadssapvirtualinstance.SAPDatabaseProperties{}, + Tags: map[string]*string{}, + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %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.SAPDatabaseInstance = armworkloadssapvirtualinstance.SAPDatabaseInstance{ - // Name: to.Ptr("databaseServer"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/databaseInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/databaseInstances/databaseServer"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPDatabaseProperties{ - // DatabaseSid: to.Ptr("X00"), - // DatabaseType: to.Ptr("hdb"), - // IPAddress: to.Ptr("10.0.0.5"), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), - // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // VMDetails: []*armworkloadssapvirtualinstance.DatabaseVMDetails{ - // { - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/db-vm"), - // }}, + // res = armworkloadssapvirtualinstance.SAPDatabaseInstancesClientCreateResponse{ + // SAPDatabaseInstance: &armworkloadssapvirtualinstance.SAPDatabaseInstance{ + // Name: to.Ptr("databaseServer"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/databaseInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/databaseInstances/databaseServer"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPDatabaseProperties{ + // DatabaseSid: to.Ptr("X00"), + // DatabaseType: to.Ptr("hdb"), + // IPAddress: to.Ptr("10.0.0.5"), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), + // VMDetails: []*armworkloadssapvirtualinstance.DatabaseVMDetails{ + // { + // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/db-vm"), + // }, + // }, + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapdatabaseinstances/SAPDatabaseInstances_Create_HA_AvSet.json +// Generated from example definition: 2024-09-01/SapDatabaseInstances_CreateForHaWithAvailabilitySet.json func ExampleSAPDatabaseInstancesClient_BeginCreate_createSapDatabaseInstancesForHaSystemWithAvailabilitySet() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("6d875e77-e412-4d7d-9af4-8895278b4443", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPDatabaseInstancesClient().BeginCreate(ctx, "test-rg", "X00", "databaseServer", armworkloadssapvirtualinstance.SAPDatabaseInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPDatabaseProperties{}, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -84,243 +97,292 @@ func ExampleSAPDatabaseInstancesClient_BeginCreate_createSapDatabaseInstancesFor // 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.SAPDatabaseInstance = armworkloadssapvirtualinstance.SAPDatabaseInstance{ - // Name: to.Ptr("databaseServer"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/databaseInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/databaseInstances/databaseServer"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPDatabaseProperties{ - // DatabaseSid: to.Ptr("X00"), - // DatabaseType: to.Ptr("hdb"), - // IPAddress: to.Ptr("10.0.0.5"), - // LoadBalancerDetails: &armworkloadssapvirtualinstance.LoadBalancerDetails{ - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Network/loadBalancers/db-loadBalancer"), + // res = armworkloadssapvirtualinstance.SAPDatabaseInstancesClientCreateResponse{ + // SAPDatabaseInstance: &armworkloadssapvirtualinstance.SAPDatabaseInstance{ + // Name: to.Ptr("databaseServer"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/databaseInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/databaseInstances/databaseServer"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPDatabaseProperties{ + // DatabaseSid: to.Ptr("X00"), + // DatabaseType: to.Ptr("hdb"), + // IPAddress: to.Ptr("10.0.0.5"), + // LoadBalancerDetails: &armworkloadssapvirtualinstance.LoadBalancerDetails{ + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Network/loadBalancers/db-loadBalancer"), + // }, + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), + // VMDetails: []*armworkloadssapvirtualinstance.DatabaseVMDetails{ + // { + // StorageDetails: []*armworkloadssapvirtualinstance.StorageInformation{ + // { + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/nfsstorageaccount"), + // }, + // }, + // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/db-vm"), + // }, + // }, + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), - // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // VMDetails: []*armworkloadssapvirtualinstance.DatabaseVMDetails{ - // { - // StorageDetails: []*armworkloadssapvirtualinstance.StorageInformation{ - // { - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/nfsstorageaccount"), - // }}, - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/db-vm"), - // }}, // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapdatabaseinstances/SAPDatabaseInstances_Create.json -func ExampleSAPDatabaseInstancesClient_BeginCreate_sapDatabaseInstancesCreate() { +// Generated from example definition: 2024-09-01/SapDatabaseInstances_Delete.json +func ExampleSAPDatabaseInstancesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("6d875e77-e412-4d7d-9af4-8895278b4443", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPDatabaseInstancesClient().BeginCreate(ctx, "test-rg", "X00", "databaseServer", armworkloadssapvirtualinstance.SAPDatabaseInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, - Properties: &armworkloadssapvirtualinstance.SAPDatabaseProperties{}, - }, nil) + poller, err := clientFactory.NewSAPDatabaseInstancesClient().BeginDelete(ctx, "test-rg", "X00", "databaseServer", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - res, err := poller.PollUntilDone(ctx, nil) + _, err = poller.PollUntilDone(ctx, nil) if err != nil { log.Fatalf("failed to pull the result: %v", err) } +} + +// Generated from example definition: 2024-09-01/SapDatabaseInstances_Get.json +func ExampleSAPDatabaseInstancesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("6d875e77-e412-4d7d-9af4-8895278b4443", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSAPDatabaseInstancesClient().Get(ctx, "test-rg", "X00", "databaseServer", 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.SAPDatabaseInstance = armworkloadssapvirtualinstance.SAPDatabaseInstance{ - // Name: to.Ptr("databaseServer"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/databaseInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/databaseInstances/databaseServer"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPDatabaseProperties{ - // DatabaseSid: to.Ptr("X00"), - // DatabaseType: to.Ptr("hdb"), - // IPAddress: to.Ptr("10.0.0.5"), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), - // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // VMDetails: []*armworkloadssapvirtualinstance.DatabaseVMDetails{ - // { - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/db-vm"), - // }}, + // res = armworkloadssapvirtualinstance.SAPDatabaseInstancesClientGetResponse{ + // SAPDatabaseInstance: &armworkloadssapvirtualinstance.SAPDatabaseInstance{ + // Name: to.Ptr("databaseServer"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/databaseInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/databaseInstances/databaseServer"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPDatabaseProperties{ + // DatabaseSid: to.Ptr("X00"), + // DatabaseType: to.Ptr("hdb"), + // IPAddress: to.Ptr("10.0.0.5"), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), + // VMDetails: []*armworkloadssapvirtualinstance.DatabaseVMDetails{ + // { + // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/db-vm"), + // }, + // }, + // }, + // Tags: map[string]*string{ + // }, // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapdatabaseinstances/SAPDatabaseInstances_Update.json -func ExampleSAPDatabaseInstancesClient_Update() { +// Generated from example definition: 2024-09-01/SapDatabaseInstances_List.json +func ExampleSAPDatabaseInstancesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("6d875e77-e412-4d7d-9af4-8895278b4443", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewSAPDatabaseInstancesClient().Update(ctx, "test-rg", "X00", "databaseServer", armworkloadssapvirtualinstance.UpdateSAPDatabaseInstanceRequest{ - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - }, nil) + pager := clientFactory.NewSAPDatabaseInstancesClient().NewListPager("test-rg", "X00", 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 = armworkloadssapvirtualinstance.SAPDatabaseInstancesClientListResponse{ + // SAPDatabaseInstanceListResult: armworkloadssapvirtualinstance.SAPDatabaseInstanceListResult{ + // Value: []*armworkloadssapvirtualinstance.SAPDatabaseInstance{ + // { + // Name: to.Ptr("databaseServer"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/databaseInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/databaseInstances/databaseServer"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPDatabaseProperties{ + // DatabaseSid: to.Ptr("X00"), + // DatabaseType: to.Ptr("hdb"), + // IPAddress: to.Ptr("10.0.0.5"), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), + // VMDetails: []*armworkloadssapvirtualinstance.DatabaseVMDetails{ + // { + // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/db-vm"), + // }, + // }, + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2024-09-01/SapDatabaseInstances_StartInstance.json +func ExampleSAPDatabaseInstancesClient_BeginStart_startTheDatabaseInstanceOfTheSapSystem() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSAPDatabaseInstancesClient().BeginStart(ctx, "test-rg", "X00", "db0", &SAPDatabaseInstancesClientBeginStartOptions{ + body: &armworkloadssapvirtualinstance.StartRequest{}}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %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.SAPDatabaseInstance = armworkloadssapvirtualinstance.SAPDatabaseInstance{ - // Name: to.Ptr("databaseServer"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/databaseInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/databaseInstances/databaseServer"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPDatabaseProperties{ - // DatabaseSid: to.Ptr("X00"), - // DatabaseType: to.Ptr("hdb"), - // IPAddress: to.Ptr("10.0.0.5"), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), - // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // VMDetails: []*armworkloadssapvirtualinstance.DatabaseVMDetails{ - // { - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/db-vm"), - // }}, + // res = armworkloadssapvirtualinstance.SAPDatabaseInstancesClientStartResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("db0"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/db0"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapdatabaseinstances/SAPDatabaseInstances_Delete.json -func ExampleSAPDatabaseInstancesClient_BeginDelete() { +// Generated from example definition: 2024-09-01/SapDatabaseInstances_StartInstanceVM.json +func ExampleSAPDatabaseInstancesClient_BeginStart_startVirtualMachineAndTheDatabaseInstanceOfTheSapSystemOnIt() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPDatabaseInstancesClient().BeginDelete(ctx, "test-rg", "X00", "databaseServer", nil) + poller, err := clientFactory.NewSAPDatabaseInstancesClient().BeginStart(ctx, "test-rg", "X00", "db0", &SAPDatabaseInstancesClientBeginStartOptions{ + body: &armworkloadssapvirtualinstance.StartRequest{ + StartVM: to.Ptr(true), + }}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - _, err = poller.PollUntilDone(ctx, nil) + res, err := poller.PollUntilDone(ctx, nil) if err != nil { log.Fatalf("failed to pull the result: %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 = armworkloadssapvirtualinstance.SAPDatabaseInstancesClientStartResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("db0"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/db0"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapdatabaseinstances/SAPDatabaseInstances_List.json -func ExampleSAPDatabaseInstancesClient_NewListPager() { +// Generated from example definition: 2024-09-01/SapDatabaseInstances_StopInstance.json +func ExampleSAPDatabaseInstancesClient_BeginStop_stopTheDatabaseInstanceOfTheSapSystem() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewSAPDatabaseInstancesClient().NewListPager("test-rg", "X00", 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.SAPDatabaseInstanceList = armworkloadssapvirtualinstance.SAPDatabaseInstanceList{ - // Value: []*armworkloadssapvirtualinstance.SAPDatabaseInstance{ - // { - // Name: to.Ptr("databaseServer"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/databaseInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/databaseInstances/databaseServer"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPDatabaseProperties{ - // DatabaseSid: to.Ptr("X00"), - // DatabaseType: to.Ptr("hdb"), - // IPAddress: to.Ptr("10.0.0.5"), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), - // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // VMDetails: []*armworkloadssapvirtualinstance.DatabaseVMDetails{ - // { - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/db-vm"), - // }}, - // }, - // }}, - // } + poller, err := clientFactory.NewSAPDatabaseInstancesClient().BeginStop(ctx, "test-rg", "X00", "db0", &SAPDatabaseInstancesClientBeginStopOptions{ + body: &armworkloadssapvirtualinstance.StopRequest{ + SoftStopTimeoutSeconds: to.Ptr[int64](0), + }}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %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 = armworkloadssapvirtualinstance.SAPDatabaseInstancesClientStopResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("db0"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/db0"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapdatabaseinstances/SAPDatabaseInstances_StartInstance_WithInfraOperations.json -func ExampleSAPDatabaseInstancesClient_BeginStartInstance_startVirtualMachineAndTheDatabaseInstanceOfTheSapSystemOnIt() { +// Generated from example definition: 2024-09-01/SapDatabaseInstances_StopInstanceSoft.json +func ExampleSAPDatabaseInstancesClient_BeginStop_softStopTheDatabaseInstanceOfTheSapSystem() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPDatabaseInstancesClient().BeginStartInstance(ctx, "test-rg", "X00", "db0", &armworkloadssapvirtualinstance.SAPDatabaseInstancesClientBeginStartInstanceOptions{Body: &armworkloadssapvirtualinstance.StartRequest{ - StartVM: to.Ptr(true), - }, - }) + poller, err := clientFactory.NewSAPDatabaseInstancesClient().BeginStop(ctx, "test-rg", "X00", "db0", &SAPDatabaseInstancesClientBeginStopOptions{ + body: &armworkloadssapvirtualinstance.StopRequest{ + SoftStopTimeoutSeconds: to.Ptr[int64](300), + }}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -331,27 +393,33 @@ func ExampleSAPDatabaseInstancesClient_BeginStartInstance_startVirtualMachineAnd // 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.OperationStatusResult = armworkloadssapvirtualinstance.OperationStatusResult{ - // Name: to.Ptr("db0"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/db0"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), + // res = armworkloadssapvirtualinstance.SAPDatabaseInstancesClientStopResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("db0"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/db0"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), + // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapdatabaseinstances/SAPDatabaseInstances_StartInstance.json -func ExampleSAPDatabaseInstancesClient_BeginStartInstance_startTheDatabaseInstanceOfTheSapSystem() { +// Generated from example definition: 2024-09-01/SapDatabaseInstances_StopInstanceSoftVM.json +func ExampleSAPDatabaseInstancesClient_BeginStop_softStopTheDatabaseInstanceOfTheSapSystemAndTheUnderlyingVirtualMachineS() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPDatabaseInstancesClient().BeginStartInstance(ctx, "test-rg", "X00", "db0", &armworkloadssapvirtualinstance.SAPDatabaseInstancesClientBeginStartInstanceOptions{Body: nil}) + poller, err := clientFactory.NewSAPDatabaseInstancesClient().BeginStop(ctx, "test-rg", "X00", "db0", &SAPDatabaseInstancesClientBeginStopOptions{ + body: &armworkloadssapvirtualinstance.StopRequest{ + DeallocateVM: to.Ptr(true), + SoftStopTimeoutSeconds: to.Ptr[int64](300), + }}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -362,31 +430,33 @@ func ExampleSAPDatabaseInstancesClient_BeginStartInstance_startTheDatabaseInstan // 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.OperationStatusResult = armworkloadssapvirtualinstance.OperationStatusResult{ - // Name: to.Ptr("db0"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/db0"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), + // res = armworkloadssapvirtualinstance.SAPDatabaseInstancesClientStopResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("db0"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/db0"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), + // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapdatabaseinstances/SAPDatabaseInstances_StopInstance_WithInfraOperations.json -func ExampleSAPDatabaseInstancesClient_BeginStopInstance_stopTheDatabaseInstanceOfTheSapSystemAndTheUnderlyingVirtualMachineS() { +// Generated from example definition: 2024-09-01/SapDatabaseInstances_StopInstanceVM.json +func ExampleSAPDatabaseInstancesClient_BeginStop_stopTheDatabaseInstanceOfTheSapSystemAndTheUnderlyingVirtualMachineS() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPDatabaseInstancesClient().BeginStopInstance(ctx, "test-rg", "X00", "db0", &armworkloadssapvirtualinstance.SAPDatabaseInstancesClientBeginStopInstanceOptions{Body: &armworkloadssapvirtualinstance.StopRequest{ - DeallocateVM: to.Ptr(true), - SoftStopTimeoutSeconds: to.Ptr[int64](0), - }, - }) + poller, err := clientFactory.NewSAPDatabaseInstancesClient().BeginStop(ctx, "test-rg", "X00", "db0", &SAPDatabaseInstancesClientBeginStopOptions{ + body: &armworkloadssapvirtualinstance.StopRequest{ + DeallocateVM: to.Ptr(true), + SoftStopTimeoutSeconds: to.Ptr[int64](0), + }}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -397,45 +467,68 @@ func ExampleSAPDatabaseInstancesClient_BeginStopInstance_stopTheDatabaseInstance // 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.OperationStatusResult = armworkloadssapvirtualinstance.OperationStatusResult{ - // Name: to.Ptr("db0"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/db0"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), + // res = armworkloadssapvirtualinstance.SAPDatabaseInstancesClientStopResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("db0"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/db0"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), + // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapdatabaseinstances/SAPDatabaseInstances_StopInstance.json -func ExampleSAPDatabaseInstancesClient_BeginStopInstance_stopTheDatabaseInstanceOfTheSapSystem() { +// Generated from example definition: 2024-09-01/SapDatabaseInstances_Update.json +func ExampleSAPDatabaseInstancesClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("6d875e77-e412-4d7d-9af4-8895278b4443", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPDatabaseInstancesClient().BeginStopInstance(ctx, "test-rg", "X00", "db0", &armworkloadssapvirtualinstance.SAPDatabaseInstancesClientBeginStopInstanceOptions{Body: &armworkloadssapvirtualinstance.StopRequest{ - SoftStopTimeoutSeconds: to.Ptr[int64](0), - }, - }) + res, err := clientFactory.NewSAPDatabaseInstancesClient().Update(ctx, "test-rg", "X00", "databaseServer", armworkloadssapvirtualinstance.UpdateSAPDatabaseInstanceRequest{ + Tags: map[string]*string{ + "key1": to.Ptr("value1"), + }, + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %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.OperationStatusResult = armworkloadssapvirtualinstance.OperationStatusResult{ - // Name: to.Ptr("db0"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/db0"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), + // res = armworkloadssapvirtualinstance.SAPDatabaseInstancesClientUpdateResponse{ + // SAPDatabaseInstance: &armworkloadssapvirtualinstance.SAPDatabaseInstance{ + // Name: to.Ptr("databaseServer"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/databaseInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/databaseInstances/databaseServer"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPDatabaseProperties{ + // DatabaseSid: to.Ptr("X00"), + // DatabaseType: to.Ptr("hdb"), + // IPAddress: to.Ptr("10.0.0.5"), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), + // VMDetails: []*armworkloadssapvirtualinstance.DatabaseVMDetails{ + // { + // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/db-vm"), + // }, + // }, + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, + // }, // } } diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapvirtualinstances_client.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapvirtualinstances_client.go index 41aa288ee716..c11ecdd67200 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapvirtualinstances_client.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapvirtualinstances_client.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armworkloadssapvirtualinstance @@ -28,7 +24,7 @@ type SAPVirtualInstancesClient struct { } // NewSAPVirtualInstancesClient creates a new instance of SAPVirtualInstancesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewSAPVirtualInstancesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SAPVirtualInstancesClient, error) { @@ -46,21 +42,20 @@ func NewSAPVirtualInstancesClient(subscriptionID string, credential azcore.Token // BeginCreate - Creates a Virtual Instance for SAP solutions (VIS) resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource -// - body - Virtual Instance for SAP solutions resource request body. +// - resource - Virtual Instance for SAP solutions resource request body. // - options - SAPVirtualInstancesClientBeginCreateOptions contains the optional parameters for the SAPVirtualInstancesClient.BeginCreate // method. -func (client *SAPVirtualInstancesClient) BeginCreate(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, body SAPVirtualInstance, options *SAPVirtualInstancesClientBeginCreateOptions) (*runtime.Poller[SAPVirtualInstancesClientCreateResponse], error) { +func (client *SAPVirtualInstancesClient) BeginCreate(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, resource SAPVirtualInstance, options *SAPVirtualInstancesClientBeginCreateOptions) (*runtime.Poller[SAPVirtualInstancesClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, resourceGroupName, sapVirtualInstanceName, body, options) + resp, err := client.create(ctx, resourceGroupName, sapVirtualInstanceName, resource, options) if err != nil { return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPVirtualInstancesClientCreateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -73,14 +68,14 @@ func (client *SAPVirtualInstancesClient) BeginCreate(ctx context.Context, resour // Create - Creates a Virtual Instance for SAP solutions (VIS) resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview -func (client *SAPVirtualInstancesClient) create(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, body SAPVirtualInstance, options *SAPVirtualInstancesClientBeginCreateOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *SAPVirtualInstancesClient) create(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, resource SAPVirtualInstance, options *SAPVirtualInstancesClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "SAPVirtualInstancesClient.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, sapVirtualInstanceName, body, options) + req, err := client.createCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, resource, options) if err != nil { return nil, err } @@ -96,7 +91,7 @@ func (client *SAPVirtualInstancesClient) create(ctx context.Context, resourceGro } // createCreateRequest creates the Create request. -func (client *SAPVirtualInstancesClient) createCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, body SAPVirtualInstance, options *SAPVirtualInstancesClientBeginCreateOptions) (*policy.Request, error) { +func (client *SAPVirtualInstancesClient) createCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, resource SAPVirtualInstance, _ *SAPVirtualInstancesClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -115,10 +110,11 @@ func (client *SAPVirtualInstancesClient) createCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, body); err != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } return req, nil @@ -128,7 +124,7 @@ func (client *SAPVirtualInstancesClient) createCreateRequest(ctx context.Context // Services Instance, Application Server Instances and Database Instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - options - SAPVirtualInstancesClientBeginDeleteOptions contains the optional parameters for the SAPVirtualInstancesClient.BeginDelete @@ -140,8 +136,7 @@ func (client *SAPVirtualInstancesClient) BeginDelete(ctx context.Context, resour return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPVirtualInstancesClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -155,7 +150,7 @@ func (client *SAPVirtualInstancesClient) BeginDelete(ctx context.Context, resour // Services Instance, Application Server Instances and Database Instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 func (client *SAPVirtualInstancesClient) deleteOperation(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, options *SAPVirtualInstancesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "SAPVirtualInstancesClient.BeginDelete" @@ -178,7 +173,7 @@ func (client *SAPVirtualInstancesClient) deleteOperation(ctx context.Context, re } // deleteCreateRequest creates the Delete request. -func (client *SAPVirtualInstancesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, options *SAPVirtualInstancesClientBeginDeleteOptions) (*policy.Request, error) { +func (client *SAPVirtualInstancesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, _ *SAPVirtualInstancesClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -197,7 +192,7 @@ func (client *SAPVirtualInstancesClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -206,7 +201,7 @@ func (client *SAPVirtualInstancesClient) deleteCreateRequest(ctx context.Context // Get - Gets a Virtual Instance for SAP solutions resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - options - SAPVirtualInstancesClientGetOptions contains the optional parameters for the SAPVirtualInstancesClient.Get method. @@ -233,7 +228,7 @@ func (client *SAPVirtualInstancesClient) Get(ctx context.Context, resourceGroupN } // getCreateRequest creates the Get request. -func (client *SAPVirtualInstancesClient) getCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, options *SAPVirtualInstancesClientGetOptions) (*policy.Request, error) { +func (client *SAPVirtualInstancesClient) getCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, _ *SAPVirtualInstancesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -252,7 +247,7 @@ func (client *SAPVirtualInstancesClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -267,9 +262,269 @@ func (client *SAPVirtualInstancesClient) getHandleResponse(resp *http.Response) return result, nil } +// GetAvailabilityZoneDetails - Get the recommended SAP Availability Zone Pair Details for your region. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +// - location - The name of the Azure region. +// - body - The content of the action request +// - options - SAPVirtualInstancesClientGetAvailabilityZoneDetailsOptions contains the optional parameters for the SAPVirtualInstancesClient.GetAvailabilityZoneDetails +// method. +func (client *SAPVirtualInstancesClient) GetAvailabilityZoneDetails(ctx context.Context, location string, body SAPAvailabilityZoneDetailsRequest, options *SAPVirtualInstancesClientGetAvailabilityZoneDetailsOptions) (SAPVirtualInstancesClientGetAvailabilityZoneDetailsResponse, error) { + var err error + const operationName = "SAPVirtualInstancesClient.GetAvailabilityZoneDetails" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getAvailabilityZoneDetailsCreateRequest(ctx, location, body, options) + if err != nil { + return SAPVirtualInstancesClientGetAvailabilityZoneDetailsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SAPVirtualInstancesClientGetAvailabilityZoneDetailsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SAPVirtualInstancesClientGetAvailabilityZoneDetailsResponse{}, err + } + resp, err := client.getAvailabilityZoneDetailsHandleResponse(httpResp) + return resp, err +} + +// getAvailabilityZoneDetailsCreateRequest creates the GetAvailabilityZoneDetails request. +func (client *SAPVirtualInstancesClient) getAvailabilityZoneDetailsCreateRequest(ctx context.Context, location string, body SAPAvailabilityZoneDetailsRequest, _ *SAPVirtualInstancesClientGetAvailabilityZoneDetailsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getAvailabilityZoneDetails" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + 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", "2024-09-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// getAvailabilityZoneDetailsHandleResponse handles the GetAvailabilityZoneDetails response. +func (client *SAPVirtualInstancesClient) getAvailabilityZoneDetailsHandleResponse(resp *http.Response) (SAPVirtualInstancesClientGetAvailabilityZoneDetailsResponse, error) { + result := SAPVirtualInstancesClientGetAvailabilityZoneDetailsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SAPAvailabilityZoneDetailsResult); err != nil { + return SAPVirtualInstancesClientGetAvailabilityZoneDetailsResponse{}, err + } + return result, nil +} + +// GetDiskConfigurations - Get the SAP Disk Configuration Layout prod/non-prod SAP System. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +// - location - The name of the Azure region. +// - body - The content of the action request +// - options - SAPVirtualInstancesClientGetDiskConfigurationsOptions contains the optional parameters for the SAPVirtualInstancesClient.GetDiskConfigurations +// method. +func (client *SAPVirtualInstancesClient) GetDiskConfigurations(ctx context.Context, location string, body SAPDiskConfigurationsRequest, options *SAPVirtualInstancesClientGetDiskConfigurationsOptions) (SAPVirtualInstancesClientGetDiskConfigurationsResponse, error) { + var err error + const operationName = "SAPVirtualInstancesClient.GetDiskConfigurations" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getDiskConfigurationsCreateRequest(ctx, location, body, options) + if err != nil { + return SAPVirtualInstancesClientGetDiskConfigurationsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SAPVirtualInstancesClientGetDiskConfigurationsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SAPVirtualInstancesClientGetDiskConfigurationsResponse{}, err + } + resp, err := client.getDiskConfigurationsHandleResponse(httpResp) + return resp, err +} + +// getDiskConfigurationsCreateRequest creates the GetDiskConfigurations request. +func (client *SAPVirtualInstancesClient) getDiskConfigurationsCreateRequest(ctx context.Context, location string, body SAPDiskConfigurationsRequest, _ *SAPVirtualInstancesClientGetDiskConfigurationsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getDiskConfigurations" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + 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", "2024-09-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// getDiskConfigurationsHandleResponse handles the GetDiskConfigurations response. +func (client *SAPVirtualInstancesClient) getDiskConfigurationsHandleResponse(resp *http.Response) (SAPVirtualInstancesClientGetDiskConfigurationsResponse, error) { + result := SAPVirtualInstancesClientGetDiskConfigurationsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SAPDiskConfigurationsResult); err != nil { + return SAPVirtualInstancesClientGetDiskConfigurationsResponse{}, err + } + return result, nil +} + +// GetSapSupportedSKU - Get a list of SAP supported SKUs for ASCS, Application and Database tier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +// - location - The name of the Azure region. +// - body - The content of the action request +// - options - SAPVirtualInstancesClientGetSapSupportedSKUOptions contains the optional parameters for the SAPVirtualInstancesClient.GetSapSupportedSKU +// method. +func (client *SAPVirtualInstancesClient) GetSapSupportedSKU(ctx context.Context, location string, body SAPSupportedSKUsRequest, options *SAPVirtualInstancesClientGetSapSupportedSKUOptions) (SAPVirtualInstancesClientGetSapSupportedSKUResponse, error) { + var err error + const operationName = "SAPVirtualInstancesClient.GetSapSupportedSKU" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getSapSupportedSKUCreateRequest(ctx, location, body, options) + if err != nil { + return SAPVirtualInstancesClientGetSapSupportedSKUResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SAPVirtualInstancesClientGetSapSupportedSKUResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SAPVirtualInstancesClientGetSapSupportedSKUResponse{}, err + } + resp, err := client.getSapSupportedSKUHandleResponse(httpResp) + return resp, err +} + +// getSapSupportedSKUCreateRequest creates the GetSapSupportedSKU request. +func (client *SAPVirtualInstancesClient) getSapSupportedSKUCreateRequest(ctx context.Context, location string, body SAPSupportedSKUsRequest, _ *SAPVirtualInstancesClientGetSapSupportedSKUOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getSapSupportedSku" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + 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", "2024-09-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// getSapSupportedSKUHandleResponse handles the GetSapSupportedSKU response. +func (client *SAPVirtualInstancesClient) getSapSupportedSKUHandleResponse(resp *http.Response) (SAPVirtualInstancesClientGetSapSupportedSKUResponse, error) { + result := SAPVirtualInstancesClientGetSapSupportedSKUResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SAPSupportedResourceSKUsResult); err != nil { + return SAPVirtualInstancesClientGetSapSupportedSKUResponse{}, err + } + return result, nil +} + +// GetSizingRecommendations - Gets the sizing recommendations. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +// - location - The name of the Azure region. +// - body - The content of the action request +// - options - SAPVirtualInstancesClientGetSizingRecommendationsOptions contains the optional parameters for the SAPVirtualInstancesClient.GetSizingRecommendations +// method. +func (client *SAPVirtualInstancesClient) GetSizingRecommendations(ctx context.Context, location string, body SAPSizingRecommendationRequest, options *SAPVirtualInstancesClientGetSizingRecommendationsOptions) (SAPVirtualInstancesClientGetSizingRecommendationsResponse, error) { + var err error + const operationName = "SAPVirtualInstancesClient.GetSizingRecommendations" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getSizingRecommendationsCreateRequest(ctx, location, body, options) + if err != nil { + return SAPVirtualInstancesClientGetSizingRecommendationsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SAPVirtualInstancesClientGetSizingRecommendationsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SAPVirtualInstancesClientGetSizingRecommendationsResponse{}, err + } + resp, err := client.getSizingRecommendationsHandleResponse(httpResp) + return resp, err +} + +// getSizingRecommendationsCreateRequest creates the GetSizingRecommendations request. +func (client *SAPVirtualInstancesClient) getSizingRecommendationsCreateRequest(ctx context.Context, location string, body SAPSizingRecommendationRequest, _ *SAPVirtualInstancesClientGetSizingRecommendationsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getSizingRecommendations" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + 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", "2024-09-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// getSizingRecommendationsHandleResponse handles the GetSizingRecommendations response. +func (client *SAPVirtualInstancesClient) getSizingRecommendationsHandleResponse(resp *http.Response) (SAPVirtualInstancesClientGetSizingRecommendationsResponse, error) { + result := SAPVirtualInstancesClientGetSizingRecommendationsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result); err != nil { + return SAPVirtualInstancesClientGetSizingRecommendationsResponse{}, err + } + return result, nil +} + // NewListByResourceGroupPager - Gets all Virtual Instances for SAP solutions resources in a Resource Group. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - SAPVirtualInstancesClientListByResourceGroupOptions contains the optional parameters for the SAPVirtualInstancesClient.NewListByResourceGroupPager // method. @@ -297,7 +552,7 @@ func (client *SAPVirtualInstancesClient) NewListByResourceGroupPager(resourceGro } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *SAPVirtualInstancesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *SAPVirtualInstancesClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *SAPVirtualInstancesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *SAPVirtualInstancesClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -312,7 +567,7 @@ func (client *SAPVirtualInstancesClient) listByResourceGroupCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -321,7 +576,7 @@ func (client *SAPVirtualInstancesClient) listByResourceGroupCreateRequest(ctx co // listByResourceGroupHandleResponse handles the ListByResourceGroup response. func (client *SAPVirtualInstancesClient) listByResourceGroupHandleResponse(resp *http.Response) (SAPVirtualInstancesClientListByResourceGroupResponse, error) { result := SAPVirtualInstancesClientListByResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SAPVirtualInstanceList); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.SAPVirtualInstanceListResult); err != nil { return SAPVirtualInstancesClientListByResourceGroupResponse{}, err } return result, nil @@ -329,7 +584,7 @@ func (client *SAPVirtualInstancesClient) listByResourceGroupHandleResponse(resp // NewListBySubscriptionPager - Gets all Virtual Instances for SAP solutions resources in a Subscription. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - options - SAPVirtualInstancesClientListBySubscriptionOptions contains the optional parameters for the SAPVirtualInstancesClient.NewListBySubscriptionPager // method. func (client *SAPVirtualInstancesClient) NewListBySubscriptionPager(options *SAPVirtualInstancesClientListBySubscriptionOptions) *runtime.Pager[SAPVirtualInstancesClientListBySubscriptionResponse] { @@ -356,7 +611,7 @@ func (client *SAPVirtualInstancesClient) NewListBySubscriptionPager(options *SAP } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *SAPVirtualInstancesClient) listBySubscriptionCreateRequest(ctx context.Context, options *SAPVirtualInstancesClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *SAPVirtualInstancesClient) listBySubscriptionCreateRequest(ctx context.Context, _ *SAPVirtualInstancesClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/sapVirtualInstances" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -367,7 +622,7 @@ func (client *SAPVirtualInstancesClient) listBySubscriptionCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -376,7 +631,7 @@ func (client *SAPVirtualInstancesClient) listBySubscriptionCreateRequest(ctx con // listBySubscriptionHandleResponse handles the ListBySubscription response. func (client *SAPVirtualInstancesClient) listBySubscriptionHandleResponse(resp *http.Response) (SAPVirtualInstancesClientListBySubscriptionResponse, error) { result := SAPVirtualInstancesClientListBySubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SAPVirtualInstanceList); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.SAPVirtualInstanceListResult); err != nil { return SAPVirtualInstancesClientListBySubscriptionResponse{}, err } return result, nil @@ -385,7 +640,7 @@ func (client *SAPVirtualInstancesClient) listBySubscriptionHandleResponse(resp * // BeginStart - Starts the SAP application, that is the Central Services instance and Application server instances. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - options - SAPVirtualInstancesClientBeginStartOptions contains the optional parameters for the SAPVirtualInstancesClient.BeginStart @@ -397,8 +652,7 @@ func (client *SAPVirtualInstancesClient) BeginStart(ctx context.Context, resourc return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPVirtualInstancesClientStartResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -411,7 +665,7 @@ func (client *SAPVirtualInstancesClient) BeginStart(ctx context.Context, resourc // Start - Starts the SAP application, that is the Central Services instance and Application server instances. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 func (client *SAPVirtualInstancesClient) start(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, options *SAPVirtualInstancesClientBeginStartOptions) (*http.Response, error) { var err error const operationName = "SAPVirtualInstancesClient.BeginStart" @@ -453,10 +707,11 @@ func (client *SAPVirtualInstancesClient) startCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Body != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { return nil, err } @@ -468,7 +723,7 @@ func (client *SAPVirtualInstancesClient) startCreateRequest(ctx context.Context, // BeginStop - Stops the SAP Application, that is the Application server instances and Central Services instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - options - SAPVirtualInstancesClientBeginStopOptions contains the optional parameters for the SAPVirtualInstancesClient.BeginStop @@ -480,8 +735,7 @@ func (client *SAPVirtualInstancesClient) BeginStop(ctx context.Context, resource return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPVirtualInstancesClientStopResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -494,7 +748,7 @@ func (client *SAPVirtualInstancesClient) BeginStop(ctx context.Context, resource // Stop - Stops the SAP Application, that is the Application server instances and Central Services instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 func (client *SAPVirtualInstancesClient) stop(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, options *SAPVirtualInstancesClientBeginStopOptions) (*http.Response, error) { var err error const operationName = "SAPVirtualInstancesClient.BeginStop" @@ -536,10 +790,11 @@ func (client *SAPVirtualInstancesClient) stopCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Body != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { return nil, err } @@ -551,21 +806,20 @@ func (client *SAPVirtualInstancesClient) stopCreateRequest(ctx context.Context, // BeginUpdate - Updates a Virtual Instance for SAP solutions resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource -// - body - Request body to update a Virtual Instance for SAP solutions resource. +// - properties - Request body to update a Virtual Instance for SAP solutions resource. // - options - SAPVirtualInstancesClientBeginUpdateOptions contains the optional parameters for the SAPVirtualInstancesClient.BeginUpdate // method. -func (client *SAPVirtualInstancesClient) BeginUpdate(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, body UpdateSAPVirtualInstanceRequest, options *SAPVirtualInstancesClientBeginUpdateOptions) (*runtime.Poller[SAPVirtualInstancesClientUpdateResponse], error) { +func (client *SAPVirtualInstancesClient) BeginUpdate(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, properties UpdateSAPVirtualInstanceRequest, options *SAPVirtualInstancesClientBeginUpdateOptions) (*runtime.Poller[SAPVirtualInstancesClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, sapVirtualInstanceName, body, options) + resp, err := client.update(ctx, resourceGroupName, sapVirtualInstanceName, properties, options) if err != nil { return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPVirtualInstancesClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -578,14 +832,14 @@ func (client *SAPVirtualInstancesClient) BeginUpdate(ctx context.Context, resour // Update - Updates a Virtual Instance for SAP solutions resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview -func (client *SAPVirtualInstancesClient) update(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, body UpdateSAPVirtualInstanceRequest, options *SAPVirtualInstancesClientBeginUpdateOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *SAPVirtualInstancesClient) update(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, properties UpdateSAPVirtualInstanceRequest, options *SAPVirtualInstancesClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "SAPVirtualInstancesClient.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, sapVirtualInstanceName, body, options) + req, err := client.updateCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, properties, options) if err != nil { return nil, err } @@ -601,7 +855,7 @@ func (client *SAPVirtualInstancesClient) update(ctx context.Context, resourceGro } // updateCreateRequest creates the Update request. -func (client *SAPVirtualInstancesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, body UpdateSAPVirtualInstanceRequest, options *SAPVirtualInstancesClientBeginUpdateOptions) (*policy.Request, error) { +func (client *SAPVirtualInstancesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, properties UpdateSAPVirtualInstanceRequest, _ *SAPVirtualInstancesClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -620,10 +874,11 @@ func (client *SAPVirtualInstancesClient) updateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, body); err != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { return nil, err } return req, nil diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapvirtualinstances_client_example_test.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapvirtualinstances_client_example_test.go index 98ebd270b844..de17c597f870 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapvirtualinstances_client_example_test.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapvirtualinstances_client_example_test.go @@ -1,122 +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. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armworkloadssapvirtualinstance_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/workloadssapvirtualinstance/armworkloadssapvirtualinstance" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_Custom_Image.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConfigurationWithAzureComputeGalleryImage() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateDetectDS.json +func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationOnADistributedSystem() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("eastus2"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), + Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + AppResourceGroup: to.Ptr("{{resourcegrp}}"), ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - InstanceCount: to.Ptr[int64](6), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + InstanceCount: to.Ptr[int64](2), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/galleries/testgallery/images/rhelimagetest/versions/0.0.1"), + Offer: to.Ptr("RHEL-SAP-HA"), + Publisher: to.Ptr("RedHat"), + SKU: to.Ptr("84sapha-gen2"), + Version: to.Ptr("latest"), }, OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), + AdminUsername: to.Ptr("azureuser"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), - SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - { - KeyData: to.Ptr("ssh-rsa public key"), - }}, + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + PrivateKey: to.Ptr("{{privateKey}}"), + PublicKey: to.Ptr("{{sshkey}}"), }, }, }, - VMSize: to.Ptr("Standard_E32ds_v4"), + VMSize: to.Ptr("Standard_E4ds_v4"), }, }, CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + InstanceCount: to.Ptr[int64](1), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/galleries/testgallery/images/rhelimagetest/versions/0.0.1"), + Offer: to.Ptr("RHEL-SAP-HA"), + Publisher: to.Ptr("RedHat"), + SKU: to.Ptr("84sapha-gen2"), + Version: to.Ptr("latest"), }, OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), + AdminUsername: to.Ptr("azureuser"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), - SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - { - KeyData: to.Ptr("ssh-rsa public key"), - }}, + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + PrivateKey: to.Ptr("{{privateKey}}"), + PublicKey: to.Ptr("{{sshkey}}"), }, }, }, - VMSize: to.Ptr("Standard_E16ds_v4"), + VMSize: to.Ptr("Standard_E4ds_v4"), }, }, DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + InstanceCount: to.Ptr[int64](1), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/galleries/testgallery/images/rhelimagetest/versions/0.0.1"), + Offer: to.Ptr("RHEL-SAP-HA"), + Publisher: to.Ptr("RedHat"), + SKU: to.Ptr("84sapha-gen2"), + Version: to.Ptr("latest"), }, OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), + AdminUsername: to.Ptr("azureuser"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), - SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - { - KeyData: to.Ptr("ssh-rsa public key"), - }}, + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + PrivateKey: to.Ptr("{{privateKey}}"), + PublicKey: to.Ptr("{{sshkey}}"), }, }, }, VMSize: to.Ptr("Standard_M32ts"), }, }, - HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ - HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ + IsSecondaryIPEnabled: to.Ptr(true), }, }, + OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + SapFqdn: to.Ptr("sap.bpaas.com"), + }, + SoftwareConfiguration: &armworkloadssapvirtualinstance.ExternalInstallationSoftwareConfiguration{ + CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), + SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeExternal), + }, }, Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{ + "created by": to.Ptr("azureuser"), + }, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -128,140 +133,145 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/galleries/testgallery/images/rhelimagetest/versions/0.0.1"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("microsoft.workloads/sapvirtualinstances"), + // ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("eastus2"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("aa-rg"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP-HA"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("azureuser"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E4ds_v4"), // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/galleries/testgallery/images/rhelimagetest/versions/0.0.1"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP-HA"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("azureuser"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E4ds_v4"), // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/galleries/testgallery/images/rhelimagetest/versions/0.0.1"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP-HA"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("azureuser"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_M32ts"), // }, - // VMSize: to.Ptr("Standard_M32ts"), + // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ + // IsSecondaryIPEnabled: to.Ptr(true), // }, // }, - // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ - // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("sap.bpaas.com"), + // }, + // SoftwareConfiguration: &armworkloadssapvirtualinstance.ExternalInstallationSoftwareConfiguration{ + // CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), + // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeExternal), // }, // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-18T18:25:55.2406546Z"); return t}()), + // CreatedBy: to.Ptr("f1bc9460-9d57-4c16-99a8-5a19378a3a93"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeApplication), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-18T18:50:59.1945444Z"); return t}()), + // LastModifiedBy: to.Ptr("f1bc9460-9d57-4c16-99a8-5a19378a3a93"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeApplication), + // }, + // Tags: map[string]*string{ + // "created by": to.Ptr("azureuser"), // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_CustomFullResourceNames_Distributed.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConfigurationWithCustomResourceNamesForDistributedSystem() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateDetectHaAvailabilitySet.json +func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationOnAnHaSystemWithAvailabilitySet() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ InstanceCount: to.Ptr[int64](6), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), + Offer: to.Ptr("RHEL-SAP-HA"), Publisher: to.Ptr("RedHat"), SKU: to.Ptr("84sapha-gen2"), Version: to.Ptr("latest"), @@ -269,8 +279,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -281,11 +291,11 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf }, }, CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - InstanceCount: to.Ptr[int64](1), + InstanceCount: to.Ptr[int64](2), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), + Offer: to.Ptr("RHEL-SAP-HA"), Publisher: to.Ptr("RedHat"), SKU: to.Ptr("84sapha-gen2"), Version: to.Ptr("latest"), @@ -293,8 +303,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -304,92 +314,13 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf VMSize: to.Ptr("Standard_E16ds_v4"), }, }, - CustomResourceNames: &armworkloadssapvirtualinstance.ThreeTierFullResourceNames{ - NamingPatternType: to.Ptr(armworkloadssapvirtualinstance.NamingPatternTypeFullResourceName), - ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerFullResourceNames{ - AvailabilitySetName: to.Ptr("appAvSet"), - VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ - { - DataDiskNames: map[string][]*string{ - "default": { - to.Ptr("app0disk0")}, - }, - HostName: to.Ptr("apphostName0"), - NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("appnic0"), - }}, - OSDiskName: to.Ptr("app0osdisk"), - VMName: to.Ptr("appvm0"), - }, - { - DataDiskNames: map[string][]*string{ - "default": { - to.Ptr("app1disk0")}, - }, - HostName: to.Ptr("apphostName1"), - NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("appnic1"), - }}, - OSDiskName: to.Ptr("app1osdisk"), - VMName: to.Ptr("appvm1"), - }}, - }, - CentralServer: &armworkloadssapvirtualinstance.CentralServerFullResourceNames{ - VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ - { - DataDiskNames: map[string][]*string{ - "default": { - to.Ptr("ascsdisk0")}, - }, - HostName: to.Ptr("ascshostName"), - NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("ascsnic"), - }}, - OSDiskName: to.Ptr("ascsosdisk"), - VMName: to.Ptr("ascsvm"), - }}, - }, - DatabaseServer: &armworkloadssapvirtualinstance.DatabaseServerFullResourceNames{ - VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ - { - DataDiskNames: map[string][]*string{ - "hanaData": { - to.Ptr("hanadata0"), - to.Ptr("hanadata1")}, - "hanaLog": { - to.Ptr("hanalog0"), - to.Ptr("hanalog1"), - to.Ptr("hanalog2")}, - "hanaShared": { - to.Ptr("hanashared0"), - to.Ptr("hanashared1")}, - "usrSap": { - to.Ptr("usrsap0")}, - }, - HostName: to.Ptr("dbhostName"), - NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("dbnic"), - }}, - OSDiskName: to.Ptr("dbosdisk"), - VMName: to.Ptr("dbvm"), - }}, - }, - SharedStorage: &armworkloadssapvirtualinstance.SharedStorageResourceNames{ - SharedStorageAccountName: to.Ptr("storageacc"), - SharedStorageAccountPrivateEndPointName: to.Ptr("peForxNFS"), - }, - }, DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - InstanceCount: to.Ptr[int64](1), + InstanceCount: to.Ptr[int64](2), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), + Offer: to.Ptr("RHEL-SAP-HA"), Publisher: to.Ptr("RedHat"), SKU: to.Ptr("84sapha-gen2"), Version: to.Ptr("latest"), @@ -397,8 +328,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -408,17 +339,23 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf VMSize: to.Ptr("Standard_M32ts"), }, }, + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ + HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilitySet), + }, }, OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ SapFqdn: to.Ptr("xyz.test.com"), }, + SoftwareConfiguration: &armworkloadssapvirtualinstance.ExternalInstallationSoftwareConfiguration{ + CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), + SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeExternal), + }, }, Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ - Name: to.Ptr("mrg-X00-8e17e36c-42e9-4cd5-a078-7b44883414e0"), - }, - SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -430,222 +367,145 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](6), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP-HA"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), // }, - // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), - // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // }, - // CustomResourceNames: &armworkloadssapvirtualinstance.ThreeTierFullResourceNames{ - // NamingPatternType: to.Ptr(armworkloadssapvirtualinstance.NamingPatternTypeFullResourceName), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerFullResourceNames{ - // AvailabilitySetName: to.Ptr("appAvSet"), - // VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ - // { - // DataDiskNames: map[string][]*string{ - // "default": []*string{ - // to.Ptr("app0disk0")}, + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP-HA"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), // }, - // HostName: to.Ptr("apphostName0"), - // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("appnic0"), - // }}, - // OSDiskName: to.Ptr("app0osdisk"), - // VMName: to.Ptr("appvm0"), // }, - // { - // DataDiskNames: map[string][]*string{ - // "default": []*string{ - // to.Ptr("app1disk0")}, - // }, - // HostName: to.Ptr("apphostName1"), - // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("appnic1"), - // }}, - // OSDiskName: to.Ptr("app1osdisk"), - // VMName: to.Ptr("appvm1"), - // }}, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerFullResourceNames{ - // VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ - // { - // DataDiskNames: map[string][]*string{ - // "default": []*string{ - // to.Ptr("ascsdisk0")}, - // }, - // HostName: to.Ptr("ascshostName"), - // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("ascsnic"), - // }}, - // OSDiskName: to.Ptr("ascsosdisk"), - // VMName: to.Ptr("ascsvm"), - // }}, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseServerFullResourceNames{ - // VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ - // { - // DataDiskNames: map[string][]*string{ - // "hanaData": []*string{ - // to.Ptr("hanadata0"), - // to.Ptr("hanadata1")}, - // "hanaLog": []*string{ - // to.Ptr("hanalog0"), - // to.Ptr("hanalog1"), - // to.Ptr("hanalog2")}, - // "hanaShared": []*string{ - // to.Ptr("hanashared0"), - // to.Ptr("hanashared1")}, - // "usrSap": []*string{ - // to.Ptr("usrsap0")}, - // }, - // HostName: to.Ptr("dbhostName"), - // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("dbnic"), - // }}, - // OSDiskName: to.Ptr("dbosdisk"), - // VMName: to.Ptr("dbvm"), - // }}, - // }, - // SharedStorage: &armworkloadssapvirtualinstance.SharedStorageResourceNames{ - // SharedStorageAccountName: to.Ptr("storageacc"), - // SharedStorageAccountPrivateEndPointName: to.Ptr("peForxNFS"), - // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_M32ts"), - // }, - // }, - // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, - // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ - // Name: to.Ptr("mrg-X00-8e17e36c-42e9-4cd5-a078-7b44883414e0"), + // }, + // VMSize: to.Ptr("Standard_E16ds_v4"), + // }, + // }, + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP-HA"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), // }, - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), // }, - // } + // }, + // VMSize: to.Ptr("Standard_M32ts"), + // }, + // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ + // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilitySet), + // }, + // }, + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("xyz.test.com"), + // }, + // SoftwareConfiguration: &armworkloadssapvirtualinstance.ExternalInstallationSoftwareConfiguration{ + // CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), + // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeExternal), + // }, + // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_CustomFullResourceNames_HA_AvSet.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConfigurationWithCustomResourceNamesForHaSystemWithAvailabilitySet() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateDetectHaAvailabilityZone.json +func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationOnAnHaSystemWithAvailabilityZone() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ InstanceCount: to.Ptr[int64](6), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), + Offer: to.Ptr("RHEL-SAP-HA"), Publisher: to.Ptr("RedHat"), SKU: to.Ptr("84sapha-gen2"), Version: to.Ptr("latest"), @@ -653,8 +513,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -669,7 +529,7 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), + Offer: to.Ptr("RHEL-SAP-HA"), Publisher: to.Ptr("RedHat"), SKU: to.Ptr("84sapha-gen2"), Version: to.Ptr("latest"), @@ -677,8 +537,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -688,142 +548,13 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf VMSize: to.Ptr("Standard_E16ds_v4"), }, }, - CustomResourceNames: &armworkloadssapvirtualinstance.ThreeTierFullResourceNames{ - NamingPatternType: to.Ptr(armworkloadssapvirtualinstance.NamingPatternTypeFullResourceName), - ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerFullResourceNames{ - AvailabilitySetName: to.Ptr("appAvSet"), - VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ - { - DataDiskNames: map[string][]*string{ - "default": { - to.Ptr("app0disk0")}, - }, - HostName: to.Ptr("apphostName0"), - NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("appnic0"), - }}, - OSDiskName: to.Ptr("app0osdisk"), - VMName: to.Ptr("appvm0"), - }, - { - DataDiskNames: map[string][]*string{ - "default": { - to.Ptr("app1disk0")}, - }, - HostName: to.Ptr("apphostName1"), - NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("appnic1"), - }}, - OSDiskName: to.Ptr("app1osdisk"), - VMName: to.Ptr("appvm1"), - }}, - }, - CentralServer: &armworkloadssapvirtualinstance.CentralServerFullResourceNames{ - AvailabilitySetName: to.Ptr("csAvSet"), - LoadBalancer: &armworkloadssapvirtualinstance.LoadBalancerResourceNames{ - BackendPoolNames: []*string{ - to.Ptr("ascsBackendPool")}, - FrontendIPConfigurationNames: []*string{ - to.Ptr("ascsip0"), - to.Ptr("ersip0")}, - HealthProbeNames: []*string{ - to.Ptr("ascsHealthProbe"), - to.Ptr("ersHealthProbe")}, - LoadBalancerName: to.Ptr("ascslb"), - }, - VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ - { - HostName: to.Ptr("ascshostName"), - NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("ascsnic"), - }}, - OSDiskName: to.Ptr("ascsosdisk"), - VMName: to.Ptr("ascsvm"), - }, - { - HostName: to.Ptr("ershostName"), - NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("ersnic"), - }}, - OSDiskName: to.Ptr("ersosdisk"), - VMName: to.Ptr("ersvm"), - }}, - }, - DatabaseServer: &armworkloadssapvirtualinstance.DatabaseServerFullResourceNames{ - AvailabilitySetName: to.Ptr("dbAvSet"), - LoadBalancer: &armworkloadssapvirtualinstance.LoadBalancerResourceNames{ - BackendPoolNames: []*string{ - to.Ptr("dbBackendPool")}, - FrontendIPConfigurationNames: []*string{ - to.Ptr("dbip")}, - HealthProbeNames: []*string{ - to.Ptr("dbHealthProbe")}, - LoadBalancerName: to.Ptr("dblb"), - }, - VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ - { - DataDiskNames: map[string][]*string{ - "hanaData": { - to.Ptr("hanadatapr0"), - to.Ptr("hanadatapr1")}, - "hanaLog": { - to.Ptr("hanalogpr0"), - to.Ptr("hanalogpr1"), - to.Ptr("hanalogpr2")}, - "hanaShared": { - to.Ptr("hanasharedpr0"), - to.Ptr("hanasharedpr1")}, - "usrSap": { - to.Ptr("usrsappr0")}, - }, - HostName: to.Ptr("dbprhostName"), - NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("dbprnic"), - }}, - OSDiskName: to.Ptr("dbprosdisk"), - VMName: to.Ptr("dbvmpr"), - }, - { - DataDiskNames: map[string][]*string{ - "hanaData": { - to.Ptr("hanadatasr0"), - to.Ptr("hanadatasr1")}, - "hanaLog": { - to.Ptr("hanalogsr0"), - to.Ptr("hanalogsr1"), - to.Ptr("hanalogsr2")}, - "hanaShared": { - to.Ptr("hanasharedsr0"), - to.Ptr("hanasharedsr1")}, - "usrSap": { - to.Ptr("usrsapsr0")}, - }, - HostName: to.Ptr("dbsrhostName"), - NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("dbsrnic"), - }}, - OSDiskName: to.Ptr("dbsrosdisk"), - VMName: to.Ptr("dbvmsr"), - }}, - }, - SharedStorage: &armworkloadssapvirtualinstance.SharedStorageResourceNames{ - SharedStorageAccountName: to.Ptr("storageacc"), - SharedStorageAccountPrivateEndPointName: to.Ptr("peForxNFS"), - }, - }, DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), InstanceCount: to.Ptr[int64](2), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), + Offer: to.Ptr("RHEL-SAP-HA"), Publisher: to.Ptr("RedHat"), SKU: to.Ptr("84sapha-gen2"), Version: to.Ptr("latest"), @@ -831,8 +562,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -842,20 +573,23 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf VMSize: to.Ptr("Standard_M32ts"), }, }, + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ - HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilitySet), + HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), }, }, OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ SapFqdn: to.Ptr("xyz.test.com"), }, + SoftwareConfiguration: &armworkloadssapvirtualinstance.ExternalInstallationSoftwareConfiguration{ + CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), + SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeExternal), + }, }, Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ - Name: to.Ptr("mrg-X00-8e17e36c-42e9-4cd5-a078-7b44883414e0"), - }, - SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -867,270 +601,274 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](6), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP-HA"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP-HA"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // }, - // CustomResourceNames: &armworkloadssapvirtualinstance.ThreeTierFullResourceNames{ - // NamingPatternType: to.Ptr(armworkloadssapvirtualinstance.NamingPatternTypeFullResourceName), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerFullResourceNames{ - // AvailabilitySetName: to.Ptr("appAvSet"), - // VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ - // { - // DataDiskNames: map[string][]*string{ - // "default": []*string{ - // to.Ptr("app0disk0")}, + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP-HA"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), // }, - // HostName: to.Ptr("apphostName0"), - // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("appnic0"), - // }}, - // OSDiskName: to.Ptr("app0osdisk"), - // VMName: to.Ptr("appvm0"), // }, - // { - // DataDiskNames: map[string][]*string{ - // "default": []*string{ - // to.Ptr("app1disk0")}, - // }, - // HostName: to.Ptr("apphostName1"), - // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("appnic1"), - // }}, - // OSDiskName: to.Ptr("app1osdisk"), - // VMName: to.Ptr("appvm1"), - // }}, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerFullResourceNames{ - // AvailabilitySetName: to.Ptr("csAvSet"), - // LoadBalancer: &armworkloadssapvirtualinstance.LoadBalancerResourceNames{ - // BackendPoolNames: []*string{ - // to.Ptr("ascsBackendPool")}, - // FrontendIPConfigurationNames: []*string{ - // to.Ptr("ascsip0"), - // to.Ptr("ersip0")}, - // HealthProbeNames: []*string{ - // to.Ptr("ascsHealthProbe"), - // to.Ptr("ersHealthProbe")}, - // LoadBalancerName: to.Ptr("ascslb"), - // }, - // VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ - // { - // HostName: to.Ptr("ascshostName"), - // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("ascsnic"), - // }}, - // OSDiskName: to.Ptr("ascsosdisk"), - // VMName: to.Ptr("ascsvm"), - // }, - // { - // HostName: to.Ptr("ershostName"), - // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("ersnic"), - // }}, - // OSDiskName: to.Ptr("ersosdisk"), - // VMName: to.Ptr("ersvm"), - // }}, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseServerFullResourceNames{ - // AvailabilitySetName: to.Ptr("dbAvSet"), - // LoadBalancer: &armworkloadssapvirtualinstance.LoadBalancerResourceNames{ - // BackendPoolNames: []*string{ - // to.Ptr("dbBackendPool")}, - // FrontendIPConfigurationNames: []*string{ - // to.Ptr("dbip")}, - // HealthProbeNames: []*string{ - // to.Ptr("dbHealthProbe")}, - // LoadBalancerName: to.Ptr("dblb"), - // }, - // VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ - // { - // DataDiskNames: map[string][]*string{ - // "hanaData": []*string{ - // to.Ptr("hanadatapr0"), - // to.Ptr("hanadatapr1")}, - // "hanaLog": []*string{ - // to.Ptr("hanalogpr0"), - // to.Ptr("hanalogpr1"), - // to.Ptr("hanalogpr2")}, - // "hanaShared": []*string{ - // to.Ptr("hanasharedpr0"), - // to.Ptr("hanasharedpr1")}, - // "usrSap": []*string{ - // to.Ptr("usrsappr0")}, - // }, - // HostName: to.Ptr("dbprhostName"), - // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("dbprnic"), - // }}, - // OSDiskName: to.Ptr("dbprosdisk"), - // VMName: to.Ptr("dbvmpr"), - // }, - // { - // DataDiskNames: map[string][]*string{ - // "hanaData": []*string{ - // to.Ptr("hanadatasr0"), - // to.Ptr("hanadatasr1")}, - // "hanaLog": []*string{ - // to.Ptr("hanalogsr0"), - // to.Ptr("hanalogsr1"), - // to.Ptr("hanalogsr2")}, - // "hanaShared": []*string{ - // to.Ptr("hanasharedsr0"), - // to.Ptr("hanasharedsr1")}, - // "usrSap": []*string{ - // to.Ptr("usrsapsr0")}, - // }, - // HostName: to.Ptr("dbsrhostName"), - // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("dbsrnic"), - // }}, - // OSDiskName: to.Ptr("dbsrosdisk"), - // VMName: to.Ptr("dbvmsr"), - // }}, - // }, - // SharedStorage: &armworkloadssapvirtualinstance.SharedStorageResourceNames{ - // SharedStorageAccountName: to.Ptr("storageacc"), - // SharedStorageAccountPrivateEndPointName: to.Ptr("peForxNFS"), - // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_M32ts"), - // }, - // }, - // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ - // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilitySet), - // }, - // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, - // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ - // Name: to.Ptr("mrg-X00-8e17e36c-42e9-4cd5-a078-7b44883414e0"), - // }, - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), - // }, - // } + // }, + // VMSize: to.Ptr("Standard_M32ts"), + // }, + // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ + // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), + // }, + // }, + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("xyz.test.com"), + // }, + // SoftwareConfiguration: &armworkloadssapvirtualinstance.ExternalInstallationSoftwareConfiguration{ + // CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), + // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeExternal), + // }, + // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_CustomFullResourceNames_HA_AvZone.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConfigurationWithCustomResourceNamesForHaSystemWithAvailabilityZone() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateDetectSingleServer.json +func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationOnASingleServerSystem() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), AppLocation: to.Ptr("eastus"), - InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + InfrastructureConfiguration: &armworkloadssapvirtualinstance.SingleServerConfiguration{ AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), + NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ + IsSecondaryIPEnabled: to.Ptr(true), + }, + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + Offer: to.Ptr("RHEL-SAP-HA"), + Publisher: to.Ptr("RedHat"), + SKU: to.Ptr("84sapha-gen2"), + Version: to.Ptr("latest"), + }, + OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + AdminUsername: to.Ptr("{your-username}"), + OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + PrivateKey: to.Ptr("xyz"), + PublicKey: to.Ptr("abc"), + }, + }, + }, + VMSize: to.Ptr("Standard_E32ds_v4"), + }, + }, + OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + SapFqdn: to.Ptr("xyz.test.com"), + }, + SoftwareConfiguration: &armworkloadssapvirtualinstance.ExternalInstallationSoftwareConfiguration{ + CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), + SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeExternal), + }, + }, + Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + }, + Tags: map[string]*string{}, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %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 = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.SingleServerConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), + // NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ + // IsSecondaryIPEnabled: to.Ptr(true), + // }, + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP-HA"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), + // }, + // }, + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("xyz.test.com"), + // }, + // SoftwareConfiguration: &armworkloadssapvirtualinstance.ExternalInstallationSoftwareConfiguration{ + // CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), + // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeExternal), + // }, + // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInfraDS.json +func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForDistributedSystem() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ + Location: to.Ptr("westcentralus"), + Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ + AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), + InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + AppResourceGroup: to.Ptr("X00-RG"), + ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ InstanceCount: to.Ptr[int64](6), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ @@ -1143,11 +881,14 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + { + KeyData: to.Ptr("ssh-rsa public key"), + }, + }, }, }, }, @@ -1155,7 +896,7 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf }, }, CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - InstanceCount: to.Ptr[int64](2), + InstanceCount: to.Ptr[int64](1), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ @@ -1167,146 +908,23 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + { + KeyData: to.Ptr("ssh-rsa public key"), + }, + }, }, }, }, VMSize: to.Ptr("Standard_E16ds_v4"), }, }, - CustomResourceNames: &armworkloadssapvirtualinstance.ThreeTierFullResourceNames{ - NamingPatternType: to.Ptr(armworkloadssapvirtualinstance.NamingPatternTypeFullResourceName), - ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerFullResourceNames{ - VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ - { - DataDiskNames: map[string][]*string{ - "default": { - to.Ptr("app0disk0")}, - }, - HostName: to.Ptr("apphostName0"), - NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("appnic0"), - }}, - OSDiskName: to.Ptr("app0osdisk"), - VMName: to.Ptr("appvm0"), - }, - { - DataDiskNames: map[string][]*string{ - "default": { - to.Ptr("app1disk0")}, - }, - HostName: to.Ptr("apphostName1"), - NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("appnic1"), - }}, - OSDiskName: to.Ptr("app1osdisk"), - VMName: to.Ptr("appvm1"), - }}, - }, - CentralServer: &armworkloadssapvirtualinstance.CentralServerFullResourceNames{ - LoadBalancer: &armworkloadssapvirtualinstance.LoadBalancerResourceNames{ - BackendPoolNames: []*string{ - to.Ptr("ascsBackendPool")}, - FrontendIPConfigurationNames: []*string{ - to.Ptr("ascsip0"), - to.Ptr("ersip0")}, - HealthProbeNames: []*string{ - to.Ptr("ascsHealthProbe"), - to.Ptr("ersHealthProbe")}, - LoadBalancerName: to.Ptr("ascslb"), - }, - VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ - { - HostName: to.Ptr("ascshostName"), - NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("ascsnic"), - }}, - OSDiskName: to.Ptr("ascsosdisk"), - VMName: to.Ptr("ascsvm"), - }, - { - HostName: to.Ptr("ershostName"), - NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("ersnic"), - }}, - OSDiskName: to.Ptr("ersosdisk"), - VMName: to.Ptr("ersvm"), - }}, - }, - DatabaseServer: &armworkloadssapvirtualinstance.DatabaseServerFullResourceNames{ - LoadBalancer: &armworkloadssapvirtualinstance.LoadBalancerResourceNames{ - BackendPoolNames: []*string{ - to.Ptr("dbBackendPool")}, - FrontendIPConfigurationNames: []*string{ - to.Ptr("dbip")}, - HealthProbeNames: []*string{ - to.Ptr("dbHealthProbe")}, - LoadBalancerName: to.Ptr("dblb"), - }, - VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ - { - DataDiskNames: map[string][]*string{ - "hanaData": { - to.Ptr("hanadatapr0"), - to.Ptr("hanadatapr1")}, - "hanaLog": { - to.Ptr("hanalogpr0"), - to.Ptr("hanalogpr1"), - to.Ptr("hanalogpr2")}, - "hanaShared": { - to.Ptr("hanasharedpr0"), - to.Ptr("hanasharedpr1")}, - "usrSap": { - to.Ptr("usrsappr0")}, - }, - HostName: to.Ptr("dbprhostName"), - NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("dbprnic"), - }}, - OSDiskName: to.Ptr("dbprosdisk"), - VMName: to.Ptr("dbvmpr"), - }, - { - DataDiskNames: map[string][]*string{ - "hanaData": { - to.Ptr("hanadatasr0"), - to.Ptr("hanadatasr1")}, - "hanaLog": { - to.Ptr("hanalogsr0"), - to.Ptr("hanalogsr1"), - to.Ptr("hanalogsr2")}, - "hanaShared": { - to.Ptr("hanasharedsr0"), - to.Ptr("hanasharedsr1")}, - "usrSap": { - to.Ptr("usrsapsr0")}, - }, - HostName: to.Ptr("dbsrhostName"), - NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("dbsrnic"), - }}, - OSDiskName: to.Ptr("dbsrosdisk"), - VMName: to.Ptr("dbvmsr"), - }}, - }, - SharedStorage: &armworkloadssapvirtualinstance.SharedStorageResourceNames{ - SharedStorageAccountName: to.Ptr("storageacc"), - SharedStorageAccountPrivateEndPointName: to.Ptr("peForxNFS"), - }, - }, DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - InstanceCount: to.Ptr[int64](2), + InstanceCount: to.Ptr[int64](1), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ @@ -1318,31 +936,27 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + { + KeyData: to.Ptr("ssh-rsa public key"), + }, + }, }, }, }, VMSize: to.Ptr("Standard_M32ts"), }, }, - HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ - HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), - }, - }, - OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - SapFqdn: to.Ptr("xyz.test.com"), + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), }, }, Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ - Name: to.Ptr("mrg-X00-8e17e36c-42e9-4cd5-a078-7b44883414e0"), - }, - SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -1354,427 +968,145 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](6), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + // { + // KeyData: to.Ptr("ssh-rsa public key"), + // }, + // }, + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), // }, - // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), - // }, - // }, - // CustomResourceNames: &armworkloadssapvirtualinstance.ThreeTierFullResourceNames{ - // NamingPatternType: to.Ptr(armworkloadssapvirtualinstance.NamingPatternTypeFullResourceName), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerFullResourceNames{ - // VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ - // { - // DataDiskNames: map[string][]*string{ - // "default": []*string{ - // to.Ptr("app0disk0")}, - // }, - // HostName: to.Ptr("apphostName0"), - // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("appnic0"), - // }}, - // OSDiskName: to.Ptr("app0osdisk"), - // VMName: to.Ptr("appvm0"), - // }, - // { - // DataDiskNames: map[string][]*string{ - // "default": []*string{ - // to.Ptr("app1disk0")}, - // }, - // HostName: to.Ptr("apphostName1"), - // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ // { - // NetworkInterfaceName: to.Ptr("appnic1"), - // }}, - // OSDiskName: to.Ptr("app1osdisk"), - // VMName: to.Ptr("appvm1"), - // }}, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerFullResourceNames{ - // LoadBalancer: &armworkloadssapvirtualinstance.LoadBalancerResourceNames{ - // BackendPoolNames: []*string{ - // to.Ptr("ascsBackendPool")}, - // FrontendIPConfigurationNames: []*string{ - // to.Ptr("ascsip0"), - // to.Ptr("ersip0")}, - // HealthProbeNames: []*string{ - // to.Ptr("ascsHealthProbe"), - // to.Ptr("ersHealthProbe")}, - // LoadBalancerName: to.Ptr("ascslb"), + // KeyData: to.Ptr("ssh-rsa public key"), // }, - // VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ - // { - // HostName: to.Ptr("ascshostName"), - // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("ascsnic"), - // }}, - // OSDiskName: to.Ptr("ascsosdisk"), - // VMName: to.Ptr("ascsvm"), - // }, - // { - // HostName: to.Ptr("ershostName"), - // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("ersnic"), - // }}, - // OSDiskName: to.Ptr("ersosdisk"), - // VMName: to.Ptr("ersvm"), - // }}, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseServerFullResourceNames{ - // LoadBalancer: &armworkloadssapvirtualinstance.LoadBalancerResourceNames{ - // BackendPoolNames: []*string{ - // to.Ptr("dbBackendPool")}, - // FrontendIPConfigurationNames: []*string{ - // to.Ptr("dbip")}, - // HealthProbeNames: []*string{ - // to.Ptr("dbHealthProbe")}, - // LoadBalancerName: to.Ptr("dblb"), - // }, - // VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ - // { - // DataDiskNames: map[string][]*string{ - // "hanaData": []*string{ - // to.Ptr("hanadatapr0"), - // to.Ptr("hanadatapr1")}, - // "hanaLog": []*string{ - // to.Ptr("hanalogpr0"), - // to.Ptr("hanalogpr1"), - // to.Ptr("hanalogpr2")}, - // "hanaShared": []*string{ - // to.Ptr("hanasharedpr0"), - // to.Ptr("hanasharedpr1")}, - // "usrSap": []*string{ - // to.Ptr("usrsappr0")}, - // }, - // HostName: to.Ptr("dbprhostName"), - // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("dbprnic"), - // }}, - // OSDiskName: to.Ptr("dbprosdisk"), - // VMName: to.Ptr("dbvmpr"), - // }, - // { - // DataDiskNames: map[string][]*string{ - // "hanaData": []*string{ - // to.Ptr("hanadatasr0"), - // to.Ptr("hanadatasr1")}, - // "hanaLog": []*string{ - // to.Ptr("hanalogsr0"), - // to.Ptr("hanalogsr1"), - // to.Ptr("hanalogsr2")}, - // "hanaShared": []*string{ - // to.Ptr("hanasharedsr0"), - // to.Ptr("hanasharedsr1")}, - // "usrSap": []*string{ - // to.Ptr("usrsapsr0")}, - // }, - // HostName: to.Ptr("dbsrhostName"), - // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("dbsrnic"), - // }}, - // OSDiskName: to.Ptr("dbsrosdisk"), - // VMName: to.Ptr("dbvmsr"), - // }}, - // }, - // SharedStorage: &armworkloadssapvirtualinstance.SharedStorageResourceNames{ - // SharedStorageAccountName: to.Ptr("storageacc"), - // SharedStorageAccountPrivateEndPointName: to.Ptr("peForxNFS"), - // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_M32ts"), - // }, - // }, - // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ - // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), - // }, - // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, - // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ - // Name: to.Ptr("mrg-X00-8e17e36c-42e9-4cd5-a078-7b44883414e0"), - // }, - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_CustomFullResourceNames_SingleServer.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConfigurationWithCustomResourceNamesForSingleServerSystem() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, - Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - AppLocation: to.Ptr("eastus"), - InfrastructureConfiguration: &armworkloadssapvirtualinstance.SingleServerConfiguration{ - AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), - DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ - IsSecondaryIPEnabled: to.Ptr(true), - }, - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_E32ds_v4"), - }, - }, - OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - SapFqdn: to.Ptr("xyz.test.com"), - }, - }, - Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), - ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ - Name: to.Ptr("mrg-X00-8e17e36c-42e9-4cd5-a078-7b44883414e0"), - }, - SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.SingleServerConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), - // CustomResourceNames: &armworkloadssapvirtualinstance.SingleServerFullResourceNames{ - // NamingPatternType: to.Ptr(armworkloadssapvirtualinstance.NamingPatternTypeFullResourceName), - // VirtualMachine: &armworkloadssapvirtualinstance.VirtualMachineResourceNames{ - // DataDiskNames: map[string][]*string{ - // "hanaData": []*string{ - // to.Ptr("hanadata0"), - // to.Ptr("hanadata1")}, - // "hanaLog": []*string{ - // to.Ptr("hanalog0"), - // to.Ptr("hanalog1"), - // to.Ptr("hanalog2")}, - // "hanaShared": []*string{ - // to.Ptr("hanashared0"), - // to.Ptr("hanashared1")}, - // "usrSap": []*string{ - // to.Ptr("usrsap0")}, // }, - // HostName: to.Ptr("sshostName"), - // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("ssnic"), - // }}, - // OSDiskName: to.Ptr("ssosdisk"), - // VMName: to.Ptr("ssvm"), // }, // }, - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ - // IsSecondaryIPEnabled: to.Ptr(true), - // }, - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // }, + // VMSize: to.Ptr("Standard_E16ds_v4"), + // }, + // }, + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + // { + // KeyData: to.Ptr("ssh-rsa public key"), // }, // }, // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), // }, // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, - // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ - // Name: to.Ptr("mrg-X00-8e17e36c-42e9-4cd5-a078-7b44883414e0"), + // VMSize: to.Ptr("Standard_M32ts"), // }, - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), // }, - // } + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // }, + // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_WithTrustedAccess.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConfigurationWithTrustedAccessEnabled() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInfraDiskOsDSRecommended.json +func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAndOSConfigurationForDistributedSystemRecommended() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ InstanceCount: to.Ptr[int64](6), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ Offer: to.Ptr("RHEL-SAP"), @@ -1785,8 +1117,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -1798,7 +1130,7 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf }, CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ InstanceCount: to.Ptr[int64](1), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ Offer: to.Ptr("RHEL-SAP"), @@ -1809,8 +1141,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -1821,9 +1153,55 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf }, }, DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + DiskConfiguration: &armworkloadssapvirtualinstance.DiskConfiguration{ + DiskVolumeConfigurations: map[string]*armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + "backup": { + Count: to.Ptr[int64](2), + SizeGB: to.Ptr[int64](256), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + }, + }, + "hana/data": { + Count: to.Ptr[int64](4), + SizeGB: to.Ptr[int64](128), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + }, + }, + "hana/log": { + Count: to.Ptr[int64](3), + SizeGB: to.Ptr[int64](128), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + }, + }, + "hana/shared": { + Count: to.Ptr[int64](1), + SizeGB: to.Ptr[int64](256), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + }, + }, + "os": { + Count: to.Ptr[int64](1), + SizeGB: to.Ptr[int64](64), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + }, + }, + "usr/sap": { + Count: to.Ptr[int64](1), + SizeGB: to.Ptr[int64](128), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + }, + }, + }, + }, InstanceCount: to.Ptr[int64](1), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ Offer: to.Ptr("RHEL-SAP"), @@ -1834,8 +1212,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -1845,15 +1223,16 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf VMSize: to.Ptr("Standard_M32ts"), }, }, + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), }, OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ SapFqdn: to.Ptr("xyz.test.com"), }, }, - Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - ManagedResourcesNetworkAccessType: to.Ptr(armworkloadssapvirtualinstance.ManagedResourcesNetworkAccessTypePrivate), - SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -1865,138 +1244,182 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](6), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // }, + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // DiskConfiguration: &armworkloadssapvirtualinstance.DiskConfiguration{ + // DiskVolumeConfigurations: map[string]*armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // "backup": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](2), + // SizeGB: to.Ptr[int64](256), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // }, + // "hana/data": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](4), + // SizeGB: to.Ptr[int64](128), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // }, + // "hana/log": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](3), + // SizeGB: to.Ptr[int64](128), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // }, + // "hana/shared": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](1), + // SizeGB: to.Ptr[int64](256), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // }, + // "os": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](1), + // SizeGB: to.Ptr[int64](64), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // }, + // "usr/sap": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](1), + // SizeGB: to.Ptr[int64](128), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // }, + // }, // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_M32ts"), // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_M32ts"), - // }, + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("xyz.test.com"), // }, // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ManagedResourcesNetworkAccessType: to.Ptr(armworkloadssapvirtualinstance.ManagedResourcesNetworkAccessTypePrivate), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_Distributed.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForDistributedSystem() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInfraDiskOsHaAvailabilitySetRecommended.json +func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAndOSConfigurationForHaSystemWithAvailabilitySetRecommended() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), + Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ InstanceCount: to.Ptr[int64](6), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ Offer: to.Ptr("RHEL-SAP"), @@ -2007,13 +1430,11 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForDis OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), - SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - { - KeyData: to.Ptr("ssh-rsa public key"), - }}, + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + PrivateKey: to.Ptr("xyz"), + PublicKey: to.Ptr("abc"), }, }, }, @@ -2021,8 +1442,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForDis }, }, CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - InstanceCount: to.Ptr[int64](1), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + InstanceCount: to.Ptr[int64](2), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ Offer: to.Ptr("RHEL-SAP"), @@ -2033,13 +1454,11 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForDis OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), - SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - { - KeyData: to.Ptr("ssh-rsa public key"), - }}, + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + PrivateKey: to.Ptr("xyz"), + PublicKey: to.Ptr("abc"), }, }, }, @@ -2047,9 +1466,55 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForDis }, }, DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - InstanceCount: to.Ptr[int64](1), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + DiskConfiguration: &armworkloadssapvirtualinstance.DiskConfiguration{ + DiskVolumeConfigurations: map[string]*armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + "backup": { + Count: to.Ptr[int64](2), + SizeGB: to.Ptr[int64](256), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + }, + }, + "hana/data": { + Count: to.Ptr[int64](4), + SizeGB: to.Ptr[int64](128), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + }, + }, + "hana/log": { + Count: to.Ptr[int64](3), + SizeGB: to.Ptr[int64](128), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + }, + }, + "hana/shared": { + Count: to.Ptr[int64](1), + SizeGB: to.Ptr[int64](256), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + }, + }, + "os": { + Count: to.Ptr[int64](1), + SizeGB: to.Ptr[int64](64), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + }, + }, + "usr/sap": { + Count: to.Ptr[int64](1), + SizeGB: to.Ptr[int64](128), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + }, + }, + }, + }, + InstanceCount: to.Ptr[int64](2), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ Offer: to.Ptr("RHEL-SAP"), @@ -2060,24 +1525,30 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForDis OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), - SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - { - KeyData: to.Ptr("ssh-rsa public key"), - }}, + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + PrivateKey: to.Ptr("xyz"), + PublicKey: to.Ptr("abc"), }, }, }, VMSize: to.Ptr("Standard_M32ts"), }, }, + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ + HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilitySet), + }, + }, + OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + SapFqdn: to.Ptr("xyz.test.com"), }, }, Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -2089,143 +1560,185 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForDis // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](6), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // DiskConfiguration: &armworkloadssapvirtualinstance.DiskConfiguration{ + // DiskVolumeConfigurations: map[string]*armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // "backup": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](2), + // SizeGB: to.Ptr[int64](256), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // }, + // "hana/data": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](4), + // SizeGB: to.Ptr[int64](128), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // }, + // "hana/log": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](3), + // SizeGB: to.Ptr[int64](128), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // }, + // "hana/shared": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](1), + // SizeGB: to.Ptr[int64](256), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // }, + // "os": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](1), + // SizeGB: to.Ptr[int64](64), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // }, + // "usr/sap": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](1), + // SizeGB: to.Ptr[int64](128), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // }, + // }, // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_M32ts"), // }, - // VMSize: to.Ptr("Standard_M32ts"), // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ + // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilitySet), + // }, + // }, + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("xyz.test.com"), // }, // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_HA_AvSet.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForHaSystemWithAvailabilitySet() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInfraDiskOsHaAvailabilityZoneRecommended.json +func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAndOSConfigurationForHaSystemWithAvailabilityZoneRecommended() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), + Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - InstanceCount: to.Ptr[int64](5), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + InstanceCount: to.Ptr[int64](6), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ Offer: to.Ptr("RHEL-SAP"), @@ -2236,13 +1749,11 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForHaS OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), - SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - { - KeyData: to.Ptr("ssh-rsa public key"), - }}, + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + PrivateKey: to.Ptr("xyz"), + PublicKey: to.Ptr("abc"), }, }, }, @@ -2251,7 +1762,7 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForHaS }, CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ Offer: to.Ptr("RHEL-SAP"), @@ -2262,13 +1773,11 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForHaS OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), - SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - { - KeyData: to.Ptr("ssh-rsa public key"), - }}, + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + PrivateKey: to.Ptr("xyz"), + PublicKey: to.Ptr("abc"), }, }, }, @@ -2276,40 +1785,89 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForHaS }, }, DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - { - KeyData: to.Ptr("ssh-rsa public key"), - }}, + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + DiskConfiguration: &armworkloadssapvirtualinstance.DiskConfiguration{ + DiskVolumeConfigurations: map[string]*armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + "backup": { + Count: to.Ptr[int64](2), + SizeGB: to.Ptr[int64](256), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), }, }, - }, - VMSize: to.Ptr("Standard_M32ts"), - }, - }, - HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ - HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilitySet), - }, - }, - }, - Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - }, + "hana/data": { + Count: to.Ptr[int64](4), + SizeGB: to.Ptr[int64](128), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + }, + }, + "hana/log": { + Count: to.Ptr[int64](3), + SizeGB: to.Ptr[int64](128), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + }, + }, + "hana/shared": { + Count: to.Ptr[int64](1), + SizeGB: to.Ptr[int64](256), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + }, + }, + "os": { + Count: to.Ptr[int64](1), + SizeGB: to.Ptr[int64](64), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + }, + }, + "usr/sap": { + Count: to.Ptr[int64](1), + SizeGB: to.Ptr[int64](128), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + }, + }, + }, + }, + InstanceCount: to.Ptr[int64](2), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + Offer: to.Ptr("RHEL-SAP"), + Publisher: to.Ptr("RedHat"), + SKU: to.Ptr("84sapha-gen2"), + Version: to.Ptr("latest"), + }, + OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + AdminUsername: to.Ptr("{your-username}"), + OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + PrivateKey: to.Ptr("xyz"), + PublicKey: to.Ptr("abc"), + }, + }, + }, + VMSize: to.Ptr("Standard_M32ts"), + }, + }, + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ + HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), + }, + }, + OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + SapFqdn: to.Ptr("xyz.test.com"), + }, + }, + Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -2321,230 +1879,263 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForHaS // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](5), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](6), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // DiskConfiguration: &armworkloadssapvirtualinstance.DiskConfiguration{ + // DiskVolumeConfigurations: map[string]*armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // "backup": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](2), + // SizeGB: to.Ptr[int64](256), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // }, + // "hana/data": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](4), + // SizeGB: to.Ptr[int64](128), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // }, + // "hana/log": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](3), + // SizeGB: to.Ptr[int64](128), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // }, + // "hana/shared": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](1), + // SizeGB: to.Ptr[int64](256), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // }, + // "os": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](1), + // SizeGB: to.Ptr[int64](64), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // }, + // "usr/sap": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](1), + // SizeGB: to.Ptr[int64](128), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // }, + // }, // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_M32ts"), // }, - // VMSize: to.Ptr("Standard_M32ts"), + // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ + // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), // }, // }, - // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ - // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilitySet), + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("xyz.test.com"), // }, // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_HA_AvZone.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForHaSystemWithAvailabilityZone() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInfraDiskOsSingleServerRecommended.json +func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAndOSConfigurationsForSingleServerSystemRecommended() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), + Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ AppLocation: to.Ptr("eastus"), - InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + InfrastructureConfiguration: &armworkloadssapvirtualinstance.SingleServerConfiguration{ AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - InstanceCount: to.Ptr[int64](6), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + DbDiskConfiguration: &armworkloadssapvirtualinstance.DiskConfiguration{ + DiskVolumeConfigurations: map[string]*armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + "backup": { + Count: to.Ptr[int64](2), + SizeGB: to.Ptr[int64](256), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + }, }, - OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - { - KeyData: to.Ptr("ssh-rsa public key"), - }}, - }, + "hana/data": { + Count: to.Ptr[int64](4), + SizeGB: to.Ptr[int64](128), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), }, }, - VMSize: to.Ptr("Standard_E32ds_v4"), - }, - }, - CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), + "hana/log": { + Count: to.Ptr[int64](3), + SizeGB: to.Ptr[int64](128), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + }, }, - OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - { - KeyData: to.Ptr("ssh-rsa public key"), - }}, - }, + "hana/shared": { + Count: to.Ptr[int64](1), + SizeGB: to.Ptr[int64](256), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), }, }, - VMSize: to.Ptr("Standard_E16ds_v4"), - }, - }, - DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), + "os": { + Count: to.Ptr[int64](1), + SizeGB: to.Ptr[int64](64), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + }, }, - OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - { - KeyData: to.Ptr("ssh-rsa public key"), - }}, - }, + "usr/sap": { + Count: to.Ptr[int64](1), + SizeGB: to.Ptr[int64](128), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), }, }, - VMSize: to.Ptr("Standard_M32ts"), }, }, - HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ - HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), + NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ + IsSecondaryIPEnabled: to.Ptr(true), + }, + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + Offer: to.Ptr("RHEL-SAP"), + Publisher: to.Ptr("RedHat"), + SKU: to.Ptr("84sapha-gen2"), + Version: to.Ptr("latest"), + }, + OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + AdminUsername: to.Ptr("{your-username}"), + OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + PrivateKey: to.Ptr("xyz"), + PublicKey: to.Ptr("abc"), + }, + }, + }, + VMSize: to.Ptr("Standard_E32ds_v4"), }, }, + OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + SapFqdn: to.Ptr("xyz.test.com"), + }, }, - Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -2556,84 +2147,70 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForHaS // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.SingleServerConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // DbDiskConfiguration: &armworkloadssapvirtualinstance.DiskConfiguration{ + // DiskVolumeConfigurations: map[string]*armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // "backup": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](2), + // SizeGB: to.Ptr[int64](256), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), // }, // }, - // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), - // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // "hana/data": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](4), + // SizeGB: to.Ptr[int64](128), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // }, + // "hana/log": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](3), + // SizeGB: to.Ptr[int64](128), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // }, + // "hana/shared": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](1), + // SizeGB: to.Ptr[int64](256), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // }, + // "os": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](1), + // SizeGB: to.Ptr[int64](64), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // }, + // "usr/sap": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](1), + // SizeGB: to.Ptr[int64](128), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), // }, // }, // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), + // NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ + // IsSecondaryIPEnabled: to.Ptr(true), + // }, + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ // Offer: to.Ptr("RHEL-SAP"), @@ -2644,180 +2221,62 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForHaS // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ // AdminUsername: to.Ptr("{your-username}"), // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), // }, // }, // }, - // VMSize: to.Ptr("Standard_M32ts"), + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, // }, - // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ - // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("xyz.test.com"), // }, // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_SingleServer.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForSingleServerSystem() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, - Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), - AppLocation: to.Ptr("eastus"), - InfrastructureConfiguration: &armworkloadssapvirtualinstance.SingleServerConfiguration{ - AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), - DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ - IsSecondaryIPEnabled: to.Ptr(true), - }, - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - { - KeyData: to.Ptr("ssh-rsa public key"), - }}, - }, - }, - }, - VMSize: to.Ptr("Standard_E32ds_v4"), - }, - }, - }, - Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), - SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.SingleServerConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), - // }, - // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_DiskDetails_Distributed.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAndOsConfigurationForDistributedSystemRecommended() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInfraHaAvailabilitySet.json +func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForHaSystemWithAvailabilitySet() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - InstanceCount: to.Ptr[int64](6), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + InstanceCount: to.Ptr[int64](5), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ Offer: to.Ptr("RHEL-SAP"), @@ -2828,11 +2287,14 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAn OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + { + KeyData: to.Ptr("ssh-rsa public key"), + }, + }, }, }, }, @@ -2840,8 +2302,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAn }, }, CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - InstanceCount: to.Ptr[int64](1), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + InstanceCount: to.Ptr[int64](2), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ Offer: to.Ptr("RHEL-SAP"), @@ -2852,11 +2314,14 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAn OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + { + KeyData: to.Ptr("ssh-rsa public key"), + }, + }, }, }, }, @@ -2864,84 +2329,43 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAn }, }, DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - DiskConfiguration: &armworkloadssapvirtualinstance.DiskConfiguration{ - DiskVolumeConfigurations: map[string]*armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - "backup": { - Count: to.Ptr[int64](2), - SizeGB: to.Ptr[int64](256), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - }, - }, - "hana/data": { - Count: to.Ptr[int64](4), - SizeGB: to.Ptr[int64](128), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - }, - }, - "hana/log": { - Count: to.Ptr[int64](3), - SizeGB: to.Ptr[int64](128), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - }, - }, - "hana/shared": { - Count: to.Ptr[int64](1), - SizeGB: to.Ptr[int64](256), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - }, - }, - "os": { - Count: to.Ptr[int64](1), - SizeGB: to.Ptr[int64](64), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - }, - }, - "usr/sap": { - Count: to.Ptr[int64](1), - SizeGB: to.Ptr[int64](128), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - }, - }, - }, - }, - InstanceCount: to.Ptr[int64](1), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + InstanceCount: to.Ptr[int64](2), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + Offer: to.Ptr("RHEL-SAP"), + Publisher: to.Ptr("RedHat"), + SKU: to.Ptr("84sapha-gen2"), + Version: to.Ptr("latest"), + }, + OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + AdminUsername: to.Ptr("{your-username}"), + OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + { + KeyData: to.Ptr("ssh-rsa public key"), + }, + }, }, }, }, VMSize: to.Ptr("Standard_M32ts"), }, }, - }, - OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - SapFqdn: to.Ptr("xyz.test.com"), + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ + HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilitySet), + }, }, }, Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -2953,183 +2377,148 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAn // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](5), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), // }, - // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), - // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + // { + // KeyData: to.Ptr("ssh-rsa public key"), + // }, + // }, + // }, // }, // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // DiskConfiguration: &armworkloadssapvirtualinstance.DiskConfiguration{ - // DiskVolumeConfigurations: map[string]*armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // "backup": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](2), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // "hana/data": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](4), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // "hana/log": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](3), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // "hana/shared": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // "os": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](64), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), // }, - // "usr/sap": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + // { + // KeyData: to.Ptr("ssh-rsa public key"), + // }, + // }, + // }, // }, // }, + // VMSize: to.Ptr("Standard_E16ds_v4"), // }, // }, - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + // { + // KeyData: to.Ptr("ssh-rsa public key"), + // }, + // }, + // }, // }, // }, + // VMSize: to.Ptr("Standard_M32ts"), // }, - // VMSize: to.Ptr("Standard_M32ts"), + // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ + // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilitySet), // }, // }, // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_DiskDetails_HA_AvSet.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAndOsConfigurationForHaSystemWithAvailabilitySetRecommended() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInfraHaAvailabilityZone.json +func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForHaSystemWithAvailabilityZone() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ InstanceCount: to.Ptr[int64](6), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ Offer: to.Ptr("RHEL-SAP"), @@ -3140,11 +2529,14 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAn OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + { + KeyData: to.Ptr("ssh-rsa public key"), + }, + }, }, }, }, @@ -3153,7 +2545,7 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAn }, CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ Offer: to.Ptr("RHEL-SAP"), @@ -3164,11 +2556,14 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAn OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + { + KeyData: to.Ptr("ssh-rsa public key"), + }, + }, }, }, }, @@ -3176,55 +2571,9 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAn }, }, DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - DiskConfiguration: &armworkloadssapvirtualinstance.DiskConfiguration{ - DiskVolumeConfigurations: map[string]*armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - "backup": { - Count: to.Ptr[int64](2), - SizeGB: to.Ptr[int64](256), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - }, - }, - "hana/data": { - Count: to.Ptr[int64](4), - SizeGB: to.Ptr[int64](128), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - }, - }, - "hana/log": { - Count: to.Ptr[int64](3), - SizeGB: to.Ptr[int64](128), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - }, - }, - "hana/shared": { - Count: to.Ptr[int64](1), - SizeGB: to.Ptr[int64](256), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - }, - }, - "os": { - Count: to.Ptr[int64](1), - SizeGB: to.Ptr[int64](64), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - }, - }, - "usr/sap": { - Count: to.Ptr[int64](1), - SizeGB: to.Ptr[int64](128), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - }, - }, - }, - }, + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ Offer: to.Ptr("RHEL-SAP"), @@ -3235,28 +2584,30 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAn OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + { + KeyData: to.Ptr("ssh-rsa public key"), + }, + }, }, }, }, VMSize: to.Ptr("Standard_M32ts"), }, }, + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ - HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilitySet), + HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), }, }, - OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - SapFqdn: to.Ptr("xyz.test.com"), - }, }, Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -3268,201 +2619,163 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAn // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](6), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), // }, - // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), - // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + // { + // KeyData: to.Ptr("ssh-rsa public key"), + // }, + // }, + // }, // }, // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // DiskConfiguration: &armworkloadssapvirtualinstance.DiskConfiguration{ - // DiskVolumeConfigurations: map[string]*armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // "backup": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](2), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // "hana/data": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](4), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // "hana/log": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](3), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), // }, - // "hana/shared": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // "os": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](64), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // "usr/sap": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + // { + // KeyData: to.Ptr("ssh-rsa public key"), + // }, + // }, + // }, // }, // }, + // VMSize: to.Ptr("Standard_E16ds_v4"), // }, // }, - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + // { + // KeyData: to.Ptr("ssh-rsa public key"), + // }, + // }, + // }, // }, // }, + // VMSize: to.Ptr("Standard_M32ts"), // }, - // VMSize: to.Ptr("Standard_M32ts"), // }, - // }, - // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ - // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilitySet), + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ + // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), + // }, // }, // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_DiskDetails_HA_AvZone.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAndOsConfigurationForHaSystemWithAvailabilityZoneRecommended() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInfraOsComputeGalleryImage.json +func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOSConfigurationWithAzureComputeGalleryImage() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ InstanceCount: to.Ptr[int64](6), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), + ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/galleries/testgallery/images/rhelimagetest/versions/0.0.1"), }, OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + { + KeyData: to.Ptr("ssh-rsa public key"), + }, + }, }, }, }, @@ -3471,22 +2784,22 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAn }, CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), + ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/galleries/testgallery/images/rhelimagetest/versions/0.0.1"), }, OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + { + KeyData: to.Ptr("ssh-rsa public key"), + }, + }, }, }, }, @@ -3494,87 +2807,40 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAn }, }, DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - DiskConfiguration: &armworkloadssapvirtualinstance.DiskConfiguration{ - DiskVolumeConfigurations: map[string]*armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - "backup": { - Count: to.Ptr[int64](2), - SizeGB: to.Ptr[int64](256), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - }, - }, - "hana/data": { - Count: to.Ptr[int64](4), - SizeGB: to.Ptr[int64](128), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - }, - }, - "hana/log": { - Count: to.Ptr[int64](3), - SizeGB: to.Ptr[int64](128), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - }, - }, - "hana/shared": { - Count: to.Ptr[int64](1), - SizeGB: to.Ptr[int64](256), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - }, - }, - "os": { - Count: to.Ptr[int64](1), - SizeGB: to.Ptr[int64](64), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - }, - }, - "usr/sap": { - Count: to.Ptr[int64](1), - SizeGB: to.Ptr[int64](128), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - }, - }, - }, - }, + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), + ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/galleries/testgallery/images/rhelimagetest/versions/0.0.1"), }, OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + { + KeyData: to.Ptr("ssh-rsa public key"), + }, + }, }, }, }, VMSize: to.Ptr("Standard_M32ts"), }, }, + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), }, }, - OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - SapFqdn: to.Ptr("xyz.test.com"), - }, }, Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -3586,401 +2852,136 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAn // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](6), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/galleries/testgallery/images/rhelimagetest/versions/0.0.1"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + // { + // KeyData: to.Ptr("ssh-rsa public key"), + // }, + // }, + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // }, + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/galleries/testgallery/images/rhelimagetest/versions/0.0.1"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + // { + // KeyData: to.Ptr("ssh-rsa public key"), + // }, + // }, + // }, // }, // }, + // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), + // }, + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/galleries/testgallery/images/rhelimagetest/versions/0.0.1"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + // { + // KeyData: to.Ptr("ssh-rsa public key"), + // }, + // }, + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_M32ts"), + // }, + // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ + // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), // }, // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), - // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // DiskConfiguration: &armworkloadssapvirtualinstance.DiskConfiguration{ - // DiskVolumeConfigurations: map[string]*armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // "backup": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](2), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // "hana/data": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](4), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // "hana/log": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](3), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // "hana/shared": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // "os": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](64), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // "usr/sap": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // }, - // }, - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_M32ts"), - // }, - // }, - // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ - // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), - // }, - // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_DiskDetails_SingleServer.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAndOsConfigurationsForSingleServerSystemRecommended() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, - Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - AppLocation: to.Ptr("eastus"), - InfrastructureConfiguration: &armworkloadssapvirtualinstance.SingleServerConfiguration{ - AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), - DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - DbDiskConfiguration: &armworkloadssapvirtualinstance.DiskConfiguration{ - DiskVolumeConfigurations: map[string]*armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - "backup": { - Count: to.Ptr[int64](2), - SizeGB: to.Ptr[int64](256), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - }, - }, - "hana/data": { - Count: to.Ptr[int64](4), - SizeGB: to.Ptr[int64](128), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - }, - }, - "hana/log": { - Count: to.Ptr[int64](3), - SizeGB: to.Ptr[int64](128), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - }, - }, - "hana/shared": { - Count: to.Ptr[int64](1), - SizeGB: to.Ptr[int64](256), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - }, - }, - "os": { - Count: to.Ptr[int64](1), - SizeGB: to.Ptr[int64](64), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - }, - }, - "usr/sap": { - Count: to.Ptr[int64](1), - SizeGB: to.Ptr[int64](128), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - }, - }, - }, - }, - NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ - IsSecondaryIPEnabled: to.Ptr(true), - }, - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_E32ds_v4"), - }, - }, - OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - SapFqdn: to.Ptr("xyz.test.com"), - }, - }, - Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), - SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.SingleServerConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // DbDiskConfiguration: &armworkloadssapvirtualinstance.DiskConfiguration{ - // DiskVolumeConfigurations: map[string]*armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // "backup": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](2), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // "hana/data": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](4), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // "hana/log": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](3), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // "hana/shared": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // "os": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](64), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // "usr/sap": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // }, - // }, - // NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ - // IsSecondaryIPEnabled: to.Ptr(true), - // }, - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), - // }, - // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_Distributed.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConfigurationForDistributedSystemRecommended() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInfraOsCustomResourceNamesDS.json +func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOSConfigurationWithCustomResourceNamesForDistributedSystem() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ InstanceCount: to.Ptr[int64](6), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), @@ -3994,8 +2995,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -4018,8 +3019,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -4029,31 +3030,125 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf VMSize: to.Ptr("Standard_E16ds_v4"), }, }, - DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - InstanceCount: to.Ptr[int64](1), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), + CustomResourceNames: &armworkloadssapvirtualinstance.ThreeTierFullResourceNames{ + ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerFullResourceNames{ + AvailabilitySetName: to.Ptr("appAvSet"), + VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ + { + DataDiskNames: map[string][]*string{ + "default": { + to.Ptr("app0disk0"), + }, }, - }, - }, - VMSize: to.Ptr("Standard_M32ts"), - }, + HostName: to.Ptr("apphostName0"), + NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + { + NetworkInterfaceName: to.Ptr("appnic0"), + }, + }, + OSDiskName: to.Ptr("app0osdisk"), + VMName: to.Ptr("appvm0"), + }, + { + DataDiskNames: map[string][]*string{ + "default": { + to.Ptr("app1disk0"), + }, + }, + HostName: to.Ptr("apphostName1"), + NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + { + NetworkInterfaceName: to.Ptr("appnic1"), + }, + }, + OSDiskName: to.Ptr("app1osdisk"), + VMName: to.Ptr("appvm1"), + }, + }, + }, + CentralServer: &armworkloadssapvirtualinstance.CentralServerFullResourceNames{ + VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ + { + DataDiskNames: map[string][]*string{ + "default": { + to.Ptr("ascsdisk0"), + }, + }, + HostName: to.Ptr("ascshostName"), + NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + { + NetworkInterfaceName: to.Ptr("ascsnic"), + }, + }, + OSDiskName: to.Ptr("ascsosdisk"), + VMName: to.Ptr("ascsvm"), + }, + }, + }, + DatabaseServer: &armworkloadssapvirtualinstance.DatabaseServerFullResourceNames{ + VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ + { + DataDiskNames: map[string][]*string{ + "hanaData": { + to.Ptr("hanadata0"), + to.Ptr("hanadata1"), + }, + "hanaLog": { + to.Ptr("hanalog0"), + to.Ptr("hanalog1"), + to.Ptr("hanalog2"), + }, + "hanaShared": { + to.Ptr("hanashared0"), + to.Ptr("hanashared1"), + }, + "usrSap": { + to.Ptr("usrsap0"), + }, + }, + HostName: to.Ptr("dbhostName"), + NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + { + NetworkInterfaceName: to.Ptr("dbnic"), + }, + }, + OSDiskName: to.Ptr("dbosdisk"), + VMName: to.Ptr("dbvm"), + }, + }, + }, + NamingPatternType: to.Ptr(armworkloadssapvirtualinstance.NamingPatternTypeFullResourceName), + SharedStorage: &armworkloadssapvirtualinstance.SharedStorageResourceNames{ + SharedStorageAccountName: to.Ptr("storageacc"), + SharedStorageAccountPrivateEndPointName: to.Ptr("peForxNFS"), + }, + }, + DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + InstanceCount: to.Ptr[int64](1), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + Offer: to.Ptr("RHEL-SAP"), + Publisher: to.Ptr("RedHat"), + SKU: to.Ptr("84sapha-gen2"), + Version: to.Ptr("latest"), + }, + OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + AdminUsername: to.Ptr("{your-username}"), + OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + PrivateKey: to.Ptr("xyz"), + PublicKey: to.Ptr("abc"), + }, + }, + }, + VMSize: to.Ptr("Standard_M32ts"), + }, }, + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), }, OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ SapFqdn: to.Ptr("xyz.test.com"), @@ -4062,6 +3157,7 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -4073,134 +3169,226 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](6), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // }, + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), + // CustomResourceNames: &armworkloadssapvirtualinstance.ThreeTierFullResourceNames{ + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerFullResourceNames{ + // AvailabilitySetName: to.Ptr("appAvSet"), + // VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ + // { + // DataDiskNames: map[string][]*string{ + // "default": []*string{ + // to.Ptr("app0disk0"), + // }, + // }, + // HostName: to.Ptr("apphostName0"), + // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + // { + // NetworkInterfaceName: to.Ptr("appnic0"), + // }, + // }, + // OSDiskName: to.Ptr("app0osdisk"), + // VMName: to.Ptr("appvm0"), + // }, + // { + // DataDiskNames: map[string][]*string{ + // "default": []*string{ + // to.Ptr("app1disk0"), + // }, + // }, + // HostName: to.Ptr("apphostName1"), + // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + // { + // NetworkInterfaceName: to.Ptr("appnic1"), + // }, + // }, + // OSDiskName: to.Ptr("app1osdisk"), + // VMName: to.Ptr("appvm1"), + // }, + // }, // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // CentralServer: &armworkloadssapvirtualinstance.CentralServerFullResourceNames{ + // VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ + // { + // DataDiskNames: map[string][]*string{ + // "default": []*string{ + // to.Ptr("ascsdisk0"), + // }, + // }, + // HostName: to.Ptr("ascshostName"), + // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + // { + // NetworkInterfaceName: to.Ptr("ascsnic"), + // }, + // }, + // OSDiskName: to.Ptr("ascsosdisk"), + // VMName: to.Ptr("ascsvm"), // }, // }, // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), - // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseServerFullResourceNames{ + // VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ + // { + // DataDiskNames: map[string][]*string{ + // "hanaData": []*string{ + // to.Ptr("hanadata0"), + // to.Ptr("hanadata1"), + // }, + // "hanaLog": []*string{ + // to.Ptr("hanalog0"), + // to.Ptr("hanalog1"), + // to.Ptr("hanalog2"), + // }, + // "hanaShared": []*string{ + // to.Ptr("hanashared0"), + // to.Ptr("hanashared1"), + // }, + // "usrSap": []*string{ + // to.Ptr("usrsap0"), + // }, + // }, + // HostName: to.Ptr("dbhostName"), + // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + // { + // NetworkInterfaceName: to.Ptr("dbnic"), + // }, + // }, + // OSDiskName: to.Ptr("dbosdisk"), + // VMName: to.Ptr("dbvm"), + // }, + // }, // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // NamingPatternType: to.Ptr(armworkloadssapvirtualinstance.NamingPatternTypeFullResourceName), + // SharedStorage: &armworkloadssapvirtualinstance.SharedStorageResourceNames{ + // SharedStorageAccountName: to.Ptr("storageacc"), + // SharedStorageAccountPrivateEndPointName: to.Ptr("peForxNFS"), + // }, + // }, + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_M32ts"), // }, - // VMSize: to.Ptr("Standard_M32ts"), // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // }, + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("xyz.test.com"), // }, // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_HA_AvSet.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConfigurationForHaSystemWithAvailabilitySetRecommended() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInfraOsCustomResourceNamesHaAvailabilitySet.json +func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOSConfigurationWithCustomResourceNamesForHaSystemWithAvailabilitySet() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ InstanceCount: to.Ptr[int64](6), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), @@ -4214,8 +3402,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -4238,8 +3426,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -4249,32 +3437,187 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf VMSize: to.Ptr("Standard_E16ds_v4"), }, }, - DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), + CustomResourceNames: &armworkloadssapvirtualinstance.ThreeTierFullResourceNames{ + ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerFullResourceNames{ + AvailabilitySetName: to.Ptr("appAvSet"), + VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ + { + DataDiskNames: map[string][]*string{ + "default": { + to.Ptr("app0disk0"), + }, + }, + HostName: to.Ptr("apphostName0"), + NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + { + NetworkInterfaceName: to.Ptr("appnic0"), + }, + }, + OSDiskName: to.Ptr("app0osdisk"), + VMName: to.Ptr("appvm0"), + }, + { + DataDiskNames: map[string][]*string{ + "default": { + to.Ptr("app1disk0"), + }, + }, + HostName: to.Ptr("apphostName1"), + NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + { + NetworkInterfaceName: to.Ptr("appnic1"), + }, }, + OSDiskName: to.Ptr("app1osdisk"), + VMName: to.Ptr("appvm1"), }, }, - VMSize: to.Ptr("Standard_M32ts"), }, - }, - HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ + CentralServer: &armworkloadssapvirtualinstance.CentralServerFullResourceNames{ + AvailabilitySetName: to.Ptr("csAvSet"), + LoadBalancer: &armworkloadssapvirtualinstance.LoadBalancerResourceNames{ + BackendPoolNames: []*string{ + to.Ptr("ascsBackendPool"), + }, + FrontendIPConfigurationNames: []*string{ + to.Ptr("ascsip0"), + to.Ptr("ersip0"), + }, + HealthProbeNames: []*string{ + to.Ptr("ascsHealthProbe"), + to.Ptr("ersHealthProbe"), + }, + LoadBalancerName: to.Ptr("ascslb"), + }, + VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ + { + HostName: to.Ptr("ascshostName"), + NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + { + NetworkInterfaceName: to.Ptr("ascsnic"), + }, + }, + OSDiskName: to.Ptr("ascsosdisk"), + VMName: to.Ptr("ascsvm"), + }, + { + HostName: to.Ptr("ershostName"), + NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + { + NetworkInterfaceName: to.Ptr("ersnic"), + }, + }, + OSDiskName: to.Ptr("ersosdisk"), + VMName: to.Ptr("ersvm"), + }, + }, + }, + DatabaseServer: &armworkloadssapvirtualinstance.DatabaseServerFullResourceNames{ + AvailabilitySetName: to.Ptr("dbAvSet"), + LoadBalancer: &armworkloadssapvirtualinstance.LoadBalancerResourceNames{ + BackendPoolNames: []*string{ + to.Ptr("dbBackendPool"), + }, + FrontendIPConfigurationNames: []*string{ + to.Ptr("dbip"), + }, + HealthProbeNames: []*string{ + to.Ptr("dbHealthProbe"), + }, + LoadBalancerName: to.Ptr("dblb"), + }, + VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ + { + DataDiskNames: map[string][]*string{ + "hanaData": { + to.Ptr("hanadatapr0"), + to.Ptr("hanadatapr1"), + }, + "hanaLog": { + to.Ptr("hanalogpr0"), + to.Ptr("hanalogpr1"), + to.Ptr("hanalogpr2"), + }, + "hanaShared": { + to.Ptr("hanasharedpr0"), + to.Ptr("hanasharedpr1"), + }, + "usrSap": { + to.Ptr("usrsappr0"), + }, + }, + HostName: to.Ptr("dbprhostName"), + NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + { + NetworkInterfaceName: to.Ptr("dbprnic"), + }, + }, + OSDiskName: to.Ptr("dbprosdisk"), + VMName: to.Ptr("dbvmpr"), + }, + { + DataDiskNames: map[string][]*string{ + "hanaData": { + to.Ptr("hanadatasr0"), + to.Ptr("hanadatasr1"), + }, + "hanaLog": { + to.Ptr("hanalogsr0"), + to.Ptr("hanalogsr1"), + to.Ptr("hanalogsr2"), + }, + "hanaShared": { + to.Ptr("hanasharedsr0"), + to.Ptr("hanasharedsr1"), + }, + "usrSap": { + to.Ptr("usrsapsr0"), + }, + }, + HostName: to.Ptr("dbsrhostName"), + NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + { + NetworkInterfaceName: to.Ptr("dbsrnic"), + }, + }, + OSDiskName: to.Ptr("dbsrosdisk"), + VMName: to.Ptr("dbvmsr"), + }, + }, + }, + NamingPatternType: to.Ptr(armworkloadssapvirtualinstance.NamingPatternTypeFullResourceName), + SharedStorage: &armworkloadssapvirtualinstance.SharedStorageResourceNames{ + SharedStorageAccountName: to.Ptr("storageacc"), + SharedStorageAccountPrivateEndPointName: to.Ptr("peForxNFS"), + }, + }, + DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + InstanceCount: to.Ptr[int64](2), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + Offer: to.Ptr("RHEL-SAP"), + Publisher: to.Ptr("RedHat"), + SKU: to.Ptr("84sapha-gen2"), + Version: to.Ptr("latest"), + }, + OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + AdminUsername: to.Ptr("{your-username}"), + OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + PrivateKey: to.Ptr("xyz"), + PublicKey: to.Ptr("abc"), + }, + }, + }, + VMSize: to.Ptr("Standard_M32ts"), + }, + }, + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilitySet), }, }, @@ -4285,6 +3628,7 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -4296,137 +3640,290 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](6), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // }, + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), + // CustomResourceNames: &armworkloadssapvirtualinstance.ThreeTierFullResourceNames{ + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerFullResourceNames{ + // AvailabilitySetName: to.Ptr("appAvSet"), + // VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ + // { + // DataDiskNames: map[string][]*string{ + // "default": []*string{ + // to.Ptr("app0disk0"), + // }, + // }, + // HostName: to.Ptr("apphostName0"), + // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + // { + // NetworkInterfaceName: to.Ptr("appnic0"), + // }, + // }, + // OSDiskName: to.Ptr("app0osdisk"), + // VMName: to.Ptr("appvm0"), + // }, + // { + // DataDiskNames: map[string][]*string{ + // "default": []*string{ + // to.Ptr("app1disk0"), + // }, + // }, + // HostName: to.Ptr("apphostName1"), + // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + // { + // NetworkInterfaceName: to.Ptr("appnic1"), + // }, + // }, + // OSDiskName: to.Ptr("app1osdisk"), + // VMName: to.Ptr("appvm1"), + // }, + // }, // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // CentralServer: &armworkloadssapvirtualinstance.CentralServerFullResourceNames{ + // AvailabilitySetName: to.Ptr("csAvSet"), + // LoadBalancer: &armworkloadssapvirtualinstance.LoadBalancerResourceNames{ + // BackendPoolNames: []*string{ + // to.Ptr("ascsBackendPool"), + // }, + // FrontendIPConfigurationNames: []*string{ + // to.Ptr("ascsip0"), + // to.Ptr("ersip0"), + // }, + // HealthProbeNames: []*string{ + // to.Ptr("ascsHealthProbe"), + // to.Ptr("ersHealthProbe"), + // }, + // LoadBalancerName: to.Ptr("ascslb"), + // }, + // VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ + // { + // HostName: to.Ptr("ascshostName"), + // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + // { + // NetworkInterfaceName: to.Ptr("ascsnic"), + // }, + // }, + // OSDiskName: to.Ptr("ascsosdisk"), + // VMName: to.Ptr("ascsvm"), + // }, + // { + // HostName: to.Ptr("ershostName"), + // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + // { + // NetworkInterfaceName: to.Ptr("ersnic"), + // }, + // }, + // OSDiskName: to.Ptr("ersosdisk"), + // VMName: to.Ptr("ersvm"), // }, // }, // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), - // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseServerFullResourceNames{ + // AvailabilitySetName: to.Ptr("dbAvSet"), + // LoadBalancer: &armworkloadssapvirtualinstance.LoadBalancerResourceNames{ + // BackendPoolNames: []*string{ + // to.Ptr("dbBackendPool"), + // }, + // FrontendIPConfigurationNames: []*string{ + // to.Ptr("dbip"), + // }, + // HealthProbeNames: []*string{ + // to.Ptr("dbHealthProbe"), + // }, + // LoadBalancerName: to.Ptr("dblb"), + // }, + // VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ + // { + // DataDiskNames: map[string][]*string{ + // "hanaData": []*string{ + // to.Ptr("hanadatapr0"), + // to.Ptr("hanadatapr1"), + // }, + // "hanaLog": []*string{ + // to.Ptr("hanalogpr0"), + // to.Ptr("hanalogpr1"), + // to.Ptr("hanalogpr2"), + // }, + // "hanaShared": []*string{ + // to.Ptr("hanasharedpr0"), + // to.Ptr("hanasharedpr1"), + // }, + // "usrSap": []*string{ + // to.Ptr("usrsappr0"), + // }, + // }, + // HostName: to.Ptr("dbprhostName"), + // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + // { + // NetworkInterfaceName: to.Ptr("dbprnic"), + // }, + // }, + // OSDiskName: to.Ptr("dbprosdisk"), + // VMName: to.Ptr("dbvmpr"), + // }, + // { + // DataDiskNames: map[string][]*string{ + // "hanaData": []*string{ + // to.Ptr("hanadatasr0"), + // to.Ptr("hanadatasr1"), + // }, + // "hanaLog": []*string{ + // to.Ptr("hanalogsr0"), + // to.Ptr("hanalogsr1"), + // to.Ptr("hanalogsr2"), + // }, + // "hanaShared": []*string{ + // to.Ptr("hanasharedsr0"), + // to.Ptr("hanasharedsr1"), + // }, + // "usrSap": []*string{ + // to.Ptr("usrsapsr0"), + // }, + // }, + // HostName: to.Ptr("dbsrhostName"), + // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + // { + // NetworkInterfaceName: to.Ptr("dbsrnic"), + // }, + // }, + // OSDiskName: to.Ptr("dbsrosdisk"), + // VMName: to.Ptr("dbvmsr"), + // }, + // }, // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // NamingPatternType: to.Ptr(armworkloadssapvirtualinstance.NamingPatternTypeFullResourceName), + // SharedStorage: &armworkloadssapvirtualinstance.SharedStorageResourceNames{ + // SharedStorageAccountName: to.Ptr("storageacc"), + // SharedStorageAccountPrivateEndPointName: to.Ptr("peForxNFS"), + // }, + // }, + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_M32ts"), // }, - // VMSize: to.Ptr("Standard_M32ts"), + // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ + // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilitySet), // }, // }, - // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ - // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilitySet), + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("xyz.test.com"), // }, // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_HA_AvZone.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConfigurationForHaSystemWithAvailabilityZoneRecommended() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInfraOsCustomResourceNamesHaAvailabilityZone.json +func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOSConfigurationWithCustomResourceNamesForHaSystemWithAvailabilityZone() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ InstanceCount: to.Ptr[int64](6), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), @@ -4440,8 +3937,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -4464,8 +3961,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -4475,6 +3972,157 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf VMSize: to.Ptr("Standard_E16ds_v4"), }, }, + CustomResourceNames: &armworkloadssapvirtualinstance.ThreeTierFullResourceNames{ + ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerFullResourceNames{ + VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ + { + DataDiskNames: map[string][]*string{ + "default": { + to.Ptr("app0disk0"), + }, + }, + HostName: to.Ptr("apphostName0"), + NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + { + NetworkInterfaceName: to.Ptr("appnic0"), + }, + }, + OSDiskName: to.Ptr("app0osdisk"), + VMName: to.Ptr("appvm0"), + }, + { + DataDiskNames: map[string][]*string{ + "default": { + to.Ptr("app1disk0"), + }, + }, + HostName: to.Ptr("apphostName1"), + NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + { + NetworkInterfaceName: to.Ptr("appnic1"), + }, + }, + OSDiskName: to.Ptr("app1osdisk"), + VMName: to.Ptr("appvm1"), + }, + }, + }, + CentralServer: &armworkloadssapvirtualinstance.CentralServerFullResourceNames{ + LoadBalancer: &armworkloadssapvirtualinstance.LoadBalancerResourceNames{ + BackendPoolNames: []*string{ + to.Ptr("ascsBackendPool"), + }, + FrontendIPConfigurationNames: []*string{ + to.Ptr("ascsip0"), + to.Ptr("ersip0"), + }, + HealthProbeNames: []*string{ + to.Ptr("ascsHealthProbe"), + to.Ptr("ersHealthProbe"), + }, + LoadBalancerName: to.Ptr("ascslb"), + }, + VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ + { + HostName: to.Ptr("ascshostName"), + NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + { + NetworkInterfaceName: to.Ptr("ascsnic"), + }, + }, + OSDiskName: to.Ptr("ascsosdisk"), + VMName: to.Ptr("ascsvm"), + }, + { + HostName: to.Ptr("ershostName"), + NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + { + NetworkInterfaceName: to.Ptr("ersnic"), + }, + }, + OSDiskName: to.Ptr("ersosdisk"), + VMName: to.Ptr("ersvm"), + }, + }, + }, + DatabaseServer: &armworkloadssapvirtualinstance.DatabaseServerFullResourceNames{ + LoadBalancer: &armworkloadssapvirtualinstance.LoadBalancerResourceNames{ + BackendPoolNames: []*string{ + to.Ptr("dbBackendPool"), + }, + FrontendIPConfigurationNames: []*string{ + to.Ptr("dbip"), + }, + HealthProbeNames: []*string{ + to.Ptr("dbHealthProbe"), + }, + LoadBalancerName: to.Ptr("dblb"), + }, + VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ + { + DataDiskNames: map[string][]*string{ + "hanaData": { + to.Ptr("hanadatapr0"), + to.Ptr("hanadatapr1"), + }, + "hanaLog": { + to.Ptr("hanalogpr0"), + to.Ptr("hanalogpr1"), + to.Ptr("hanalogpr2"), + }, + "hanaShared": { + to.Ptr("hanasharedpr0"), + to.Ptr("hanasharedpr1"), + }, + "usrSap": { + to.Ptr("usrsappr0"), + }, + }, + HostName: to.Ptr("dbprhostName"), + NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + { + NetworkInterfaceName: to.Ptr("dbprnic"), + }, + }, + OSDiskName: to.Ptr("dbprosdisk"), + VMName: to.Ptr("dbvmpr"), + }, + { + DataDiskNames: map[string][]*string{ + "hanaData": { + to.Ptr("hanadatasr0"), + to.Ptr("hanadatasr1"), + }, + "hanaLog": { + to.Ptr("hanalogsr0"), + to.Ptr("hanalogsr1"), + to.Ptr("hanalogsr2"), + }, + "hanaShared": { + to.Ptr("hanasharedsr0"), + to.Ptr("hanasharedsr1"), + }, + "usrSap": { + to.Ptr("usrsapsr0"), + }, + }, + HostName: to.Ptr("dbsrhostName"), + NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + { + NetworkInterfaceName: to.Ptr("dbsrnic"), + }, + }, + OSDiskName: to.Ptr("dbsrosdisk"), + VMName: to.Ptr("dbvmsr"), + }, + }, + }, + NamingPatternType: to.Ptr(armworkloadssapvirtualinstance.NamingPatternTypeFullResourceName), + SharedStorage: &armworkloadssapvirtualinstance.SharedStorageResourceNames{ + SharedStorageAccountName: to.Ptr("storageacc"), + SharedStorageAccountPrivateEndPointName: to.Ptr("peForxNFS"), + }, + }, DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), InstanceCount: to.Ptr[int64](2), @@ -4489,8 +4137,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -4500,6 +4148,7 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf VMSize: to.Ptr("Standard_M32ts"), }, }, + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), }, @@ -4511,6 +4160,7 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -4522,138 +4172,289 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](6), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // }, + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), + // CustomResourceNames: &armworkloadssapvirtualinstance.ThreeTierFullResourceNames{ + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerFullResourceNames{ + // VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ + // { + // DataDiskNames: map[string][]*string{ + // "default": []*string{ + // to.Ptr("app0disk0"), + // }, + // }, + // HostName: to.Ptr("apphostName0"), + // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + // { + // NetworkInterfaceName: to.Ptr("appnic0"), + // }, + // }, + // OSDiskName: to.Ptr("app0osdisk"), + // VMName: to.Ptr("appvm0"), + // }, + // { + // DataDiskNames: map[string][]*string{ + // "default": []*string{ + // to.Ptr("app1disk0"), + // }, + // }, + // HostName: to.Ptr("apphostName1"), + // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + // { + // NetworkInterfaceName: to.Ptr("appnic1"), + // }, + // }, + // OSDiskName: to.Ptr("app1osdisk"), + // VMName: to.Ptr("appvm1"), + // }, + // }, // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // CentralServer: &armworkloadssapvirtualinstance.CentralServerFullResourceNames{ + // LoadBalancer: &armworkloadssapvirtualinstance.LoadBalancerResourceNames{ + // BackendPoolNames: []*string{ + // to.Ptr("ascsBackendPool"), + // }, + // FrontendIPConfigurationNames: []*string{ + // to.Ptr("ascsip0"), + // to.Ptr("ersip0"), + // }, + // HealthProbeNames: []*string{ + // to.Ptr("ascsHealthProbe"), + // to.Ptr("ersHealthProbe"), + // }, + // LoadBalancerName: to.Ptr("ascslb"), + // }, + // VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ + // { + // HostName: to.Ptr("ascshostName"), + // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + // { + // NetworkInterfaceName: to.Ptr("ascsnic"), + // }, + // }, + // OSDiskName: to.Ptr("ascsosdisk"), + // VMName: to.Ptr("ascsvm"), + // }, + // { + // HostName: to.Ptr("ershostName"), + // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + // { + // NetworkInterfaceName: to.Ptr("ersnic"), + // }, + // }, + // OSDiskName: to.Ptr("ersosdisk"), + // VMName: to.Ptr("ersvm"), // }, // }, // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), - // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseServerFullResourceNames{ + // LoadBalancer: &armworkloadssapvirtualinstance.LoadBalancerResourceNames{ + // BackendPoolNames: []*string{ + // to.Ptr("dbBackendPool"), + // }, + // FrontendIPConfigurationNames: []*string{ + // to.Ptr("dbip"), + // }, + // HealthProbeNames: []*string{ + // to.Ptr("dbHealthProbe"), + // }, + // LoadBalancerName: to.Ptr("dblb"), + // }, + // VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ + // { + // DataDiskNames: map[string][]*string{ + // "hanaData": []*string{ + // to.Ptr("hanadatapr0"), + // to.Ptr("hanadatapr1"), + // }, + // "hanaLog": []*string{ + // to.Ptr("hanalogpr0"), + // to.Ptr("hanalogpr1"), + // to.Ptr("hanalogpr2"), + // }, + // "hanaShared": []*string{ + // to.Ptr("hanasharedpr0"), + // to.Ptr("hanasharedpr1"), + // }, + // "usrSap": []*string{ + // to.Ptr("usrsappr0"), + // }, + // }, + // HostName: to.Ptr("dbprhostName"), + // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + // { + // NetworkInterfaceName: to.Ptr("dbprnic"), + // }, + // }, + // OSDiskName: to.Ptr("dbprosdisk"), + // VMName: to.Ptr("dbvmpr"), + // }, + // { + // DataDiskNames: map[string][]*string{ + // "hanaData": []*string{ + // to.Ptr("hanadatasr0"), + // to.Ptr("hanadatasr1"), + // }, + // "hanaLog": []*string{ + // to.Ptr("hanalogsr0"), + // to.Ptr("hanalogsr1"), + // to.Ptr("hanalogsr2"), + // }, + // "hanaShared": []*string{ + // to.Ptr("hanasharedsr0"), + // to.Ptr("hanasharedsr1"), + // }, + // "usrSap": []*string{ + // to.Ptr("usrsapsr0"), + // }, + // }, + // HostName: to.Ptr("dbsrhostName"), + // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + // { + // NetworkInterfaceName: to.Ptr("dbsrnic"), + // }, + // }, + // OSDiskName: to.Ptr("dbsrosdisk"), + // VMName: to.Ptr("dbvmsr"), + // }, + // }, // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // NamingPatternType: to.Ptr(armworkloadssapvirtualinstance.NamingPatternTypeFullResourceName), + // SharedStorage: &armworkloadssapvirtualinstance.SharedStorageResourceNames{ + // SharedStorageAccountName: to.Ptr("storageacc"), + // SharedStorageAccountPrivateEndPointName: to.Ptr("peForxNFS"), + // }, + // }, + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_M32ts"), // }, - // VMSize: to.Ptr("Standard_M32ts"), + // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ + // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), // }, // }, - // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ - // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("xyz.test.com"), // }, // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), - // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, + // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_SingleServer.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConfigurationForSingleServerSystemRecommended() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInfraOsCustomResourceNamesSingleServer.json +func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOSConfigurationWithCustomResourceNamesForSingleServerSystem() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), InfrastructureConfiguration: &armworkloadssapvirtualinstance.SingleServerConfiguration{ AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ IsSecondaryIPEnabled: to.Ptr(true), }, @@ -4668,8 +4469,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -4686,6 +4487,7 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -4697,88 +4499,118 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.SingleServerConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ - // IsSecondaryIPEnabled: to.Ptr(true), - // }, - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.SingleServerConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // CustomResourceNames: &armworkloadssapvirtualinstance.SingleServerFullResourceNames{ + // NamingPatternType: to.Ptr(armworkloadssapvirtualinstance.NamingPatternTypeFullResourceName), + // VirtualMachine: &armworkloadssapvirtualinstance.VirtualMachineResourceNames{ + // DataDiskNames: map[string][]*string{ + // "hanaData": []*string{ + // to.Ptr("hanadata0"), + // to.Ptr("hanadata1"), + // }, + // "hanaLog": []*string{ + // to.Ptr("hanalog0"), + // to.Ptr("hanalog1"), + // to.Ptr("hanalog2"), + // }, + // "hanaShared": []*string{ + // to.Ptr("hanashared0"), + // to.Ptr("hanashared1"), + // }, + // "usrSap": []*string{ + // to.Ptr("usrsap0"), + // }, + // }, + // HostName: to.Ptr("sshostName"), + // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + // { + // NetworkInterfaceName: to.Ptr("ssnic"), + // }, + // }, + // OSDiskName: to.Ptr("ssosdisk"), + // VMName: to.Ptr("ssvm"), + // }, // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), + // NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ + // IsSecondaryIPEnabled: to.Ptr(true), + // }, + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), + // }, + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("xyz.test.com"), // }, // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_Distributed_CreateTransport.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithANewSapTransportDirectoryFileshare() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInfraOsDSRecommended.json +func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOSConfigurationForDistributedSystemRecommended() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ InstanceCount: to.Ptr[int64](6), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), @@ -4792,8 +4624,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithANewSa OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -4816,8 +4648,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithANewSa OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -4841,8 +4673,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithANewSa OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -4852,13 +4684,7 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithANewSa VMSize: to.Ptr("Standard_M32ts"), }, }, - StorageConfiguration: &armworkloadssapvirtualinstance.StorageConfiguration{ - TransportFileShareConfiguration: &armworkloadssapvirtualinstance.CreateAndMountFileShareConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.ConfigurationTypeCreateAndMount), - ResourceGroup: to.Ptr("rgName"), - StorageAccountName: to.Ptr("storageName"), - }, - }, + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), }, OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ SapFqdn: to.Ptr("xyz.test.com"), @@ -4867,6 +4693,7 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithANewSa Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -4878,141 +4705,133 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithANewSa // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](6), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_M32ts"), // }, - // VMSize: to.Ptr("Standard_M32ts"), // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), // }, - // StorageConfiguration: &armworkloadssapvirtualinstance.StorageConfiguration{ - // TransportFileShareConfiguration: &armworkloadssapvirtualinstance.CreateAndMountFileShareConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.ConfigurationTypeCreateAndMount), - // ResourceGroup: to.Ptr("rgName"), - // StorageAccountName: to.Ptr("storageName"), - // }, + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("xyz.test.com"), // }, // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_Distributed_MountTransport.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithAnExistingSapTransportDirectoryFileshare() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInfraOsHaAvailabilitySetRecommended.json +func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOSConfigurationForHaSystemWithAvailabilitySetRecommended() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ InstanceCount: to.Ptr[int64](6), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), @@ -5026,8 +4845,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithAnExis OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -5038,7 +4857,7 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithAnExis }, }, CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - InstanceCount: to.Ptr[int64](1), + InstanceCount: to.Ptr[int64](2), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ @@ -5050,8 +4869,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithAnExis OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -5063,7 +4882,7 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithAnExis }, DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - InstanceCount: to.Ptr[int64](1), + InstanceCount: to.Ptr[int64](2), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ @@ -5075,8 +4894,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithAnExis OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -5086,12 +4905,9 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithAnExis VMSize: to.Ptr("Standard_M32ts"), }, }, - StorageConfiguration: &armworkloadssapvirtualinstance.StorageConfiguration{ - TransportFileShareConfiguration: &armworkloadssapvirtualinstance.MountFileShareConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.ConfigurationTypeMount), - ID: to.Ptr("/subscriptions/49d64d54-e888-4c46-a868-1936802b762c/resourceGroups/testrg/providers/Microsoft.Network/privateEndpoints/endpoint"), - PrivateEndpointID: to.Ptr("/subscriptions/49d64d54-e888-4c46-a868-1936802b762c/resourceGroups/testrg/providers/Microsoft.Network/privateEndpoints/endpoint"), - }, + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ + HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilitySet), }, }, OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ @@ -5101,6 +4917,7 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithAnExis Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -5112,141 +4929,136 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithAnExis // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](6), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_M32ts"), // }, - // VMSize: to.Ptr("Standard_M32ts"), // }, - // }, - // StorageConfiguration: &armworkloadssapvirtualinstance.StorageConfiguration{ - // TransportFileShareConfiguration: &armworkloadssapvirtualinstance.MountFileShareConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.ConfigurationTypeMount), - // ID: to.Ptr("/subscriptions/49d64d54-e888-4c46-a868-1936802b762c/resourceGroups/testrg/providers/Microsoft.Network/privateEndpoints/endpoint"), - // PrivateEndpointID: to.Ptr("/subscriptions/49d64d54-e888-4c46-a868-1936802b762c/resourceGroups/testrg/providers/Microsoft.Network/privateEndpoints/endpoint"), + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ + // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilitySet), // }, // }, + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("xyz.test.com"), + // }, // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_Distributed_SkipTransport.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithoutASapTransportDirectoryFileshare() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInfraOsHaAvailabilityZoneRecommended.json +func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOSConfigurationForHaSystemWithAvailabilityZoneRecommended() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ InstanceCount: to.Ptr[int64](6), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), @@ -5260,8 +5072,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithoutASa OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -5272,7 +5084,7 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithoutASa }, }, CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - InstanceCount: to.Ptr[int64](1), + InstanceCount: to.Ptr[int64](2), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ @@ -5284,8 +5096,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithoutASa OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -5297,7 +5109,7 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithoutASa }, DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - InstanceCount: to.Ptr[int64](1), + InstanceCount: to.Ptr[int64](2), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ @@ -5309,8 +5121,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithoutASa OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -5320,10 +5132,9 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithoutASa VMSize: to.Ptr("Standard_M32ts"), }, }, - StorageConfiguration: &armworkloadssapvirtualinstance.StorageConfiguration{ - TransportFileShareConfiguration: &armworkloadssapvirtualinstance.SkipFileShareConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.ConfigurationTypeSkip), - }, + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ + HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), }, }, OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ @@ -5333,6 +5144,7 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithoutASa Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -5344,228 +5156,171 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithoutASa // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](6), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // }, + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), + // }, + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_M32ts"), + // }, + // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ + // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), // }, // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), - // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_M32ts"), - // }, - // }, - // StorageConfiguration: &armworkloadssapvirtualinstance.StorageConfiguration{ - // TransportFileShareConfiguration: &armworkloadssapvirtualinstance.SkipFileShareConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.ConfigurationTypeSkip), - // }, + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("xyz.test.com"), // }, // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_Distributed.json -func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationOnADistributedSystem() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInfraOsSIngleServerRecommended.json +func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOSConfigurationForSingleServerSystemRecommended() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus2"), - Tags: map[string]*string{ - "created by": to.Ptr("azureuser"), - }, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), AppLocation: to.Ptr("eastus"), - InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - AppResourceGroup: to.Ptr("{{resourcegrp}}"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), - VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP-HA"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - AdminUsername: to.Ptr("azureuser"), - OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("{{privateKey}}"), - PublicKey: to.Ptr("{{sshkey}}"), - }, - }, - }, - VMSize: to.Ptr("Standard_E4ds_v4"), - }, + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + InfrastructureConfiguration: &armworkloadssapvirtualinstance.SingleServerConfiguration{ + AppResourceGroup: to.Ptr("X00-RG"), + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), + NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ + IsSecondaryIPEnabled: to.Ptr(true), }, - CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - InstanceCount: to.Ptr[int64](1), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), - VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP-HA"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - AdminUsername: to.Ptr("azureuser"), - OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("{{privateKey}}"), - PublicKey: to.Ptr("{{sshkey}}"), - }, - }, - }, - VMSize: to.Ptr("Standard_E4ds_v4"), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + Offer: to.Ptr("RHEL-SAP"), + Publisher: to.Ptr("RedHat"), + SKU: to.Ptr("84sapha-gen2"), + Version: to.Ptr("latest"), }, - }, - DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - InstanceCount: to.Ptr[int64](1), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), - VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP-HA"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - AdminUsername: to.Ptr("azureuser"), - OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("{{privateKey}}"), - PublicKey: to.Ptr("{{sshkey}}"), - }, + OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + AdminUsername: to.Ptr("{your-username}"), + OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + PrivateKey: to.Ptr("xyz"), + PublicKey: to.Ptr("abc"), }, }, - VMSize: to.Ptr("Standard_M32ts"), }, - }, - NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ - IsSecondaryIPEnabled: to.Ptr(true), + VMSize: to.Ptr("Standard_E32ds_v4"), }, }, OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - SapFqdn: to.Ptr("sap.bpaas.com"), - }, - SoftwareConfiguration: &armworkloadssapvirtualinstance.ExternalInstallationSoftwareConfiguration{ - SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeExternal), - CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), + SapFqdn: to.Ptr("xyz.test.com"), }, }, - Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -5577,147 +5332,96 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationO // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("microsoft.workloads/sapvirtualinstances"), - // ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-18T18:25:55.240Z"); return t}()), - // CreatedBy: to.Ptr("f1bc9460-9d57-4c16-99a8-5a19378a3a93"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-18T18:50:59.194Z"); return t}()), - // LastModifiedBy: to.Ptr("f1bc9460-9d57-4c16-99a8-5a19378a3a93"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeApplication), - // }, - // Location: to.Ptr("eastus2"), - // Tags: map[string]*string{ - // "created by": to.Ptr("azureuser"), - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("aa-rg"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("azureuser"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E4ds_v4"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.SingleServerConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), + // NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ + // IsSecondaryIPEnabled: to.Ptr(true), // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), + // Offer: to.Ptr("RHEL-SAP"), // Publisher: to.Ptr("RedHat"), // SKU: to.Ptr("84sapha-gen2"), // Version: to.Ptr("latest"), // }, // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("azureuser"), + // AdminUsername: to.Ptr("{your-username}"), // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E4ds_v4"), - // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("azureuser"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), + // PublicKey: to.Ptr("abc"), // }, // }, // }, - // VMSize: to.Ptr("Standard_M32ts"), + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, // }, - // NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ - // IsSecondaryIPEnabled: to.Ptr(true), + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("xyz.test.com"), // }, // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("sap.bpaas.com"), - // }, - // SoftwareConfiguration: &armworkloadssapvirtualinstance.ExternalInstallationSoftwareConfiguration{ - // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeExternal), - // CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), - // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_SingleServer.json -func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationOnASingleServerSystem() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInfraSingleServer.json +func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForSingleServerSystem() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), InfrastructureConfiguration: &armworkloadssapvirtualinstance.SingleServerConfiguration{ AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ IsSecondaryIPEnabled: to.Ptr(true), }, SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP-HA"), + Offer: to.Ptr("RHEL-SAP"), Publisher: to.Ptr("RedHat"), SKU: to.Ptr("84sapha-gen2"), Version: to.Ptr("latest"), @@ -5725,28 +5429,25 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationO OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + { + KeyData: to.Ptr("ssh-rsa public key"), + }, + }, }, }, }, VMSize: to.Ptr("Standard_E32ds_v4"), }, }, - OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - SapFqdn: to.Ptr("xyz.test.com"), - }, - SoftwareConfiguration: &armworkloadssapvirtualinstance.ExternalInstallationSoftwareConfiguration{ - SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeExternal), - CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), - }, }, Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -5758,96 +5459,91 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationO // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.SingleServerConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ - // IsSecondaryIPEnabled: to.Ptr(true), - // }, - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.SingleServerConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + // { + // KeyData: to.Ptr("ssh-rsa public key"), + // }, + // }, + // }, // }, // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), // }, // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, - // SoftwareConfiguration: &armworkloadssapvirtualinstance.ExternalInstallationSoftwareConfiguration{ - // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeExternal), - // CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), - // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_HA_AvSet.json -func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationOnAnHaSystemWithAvailabilitySet() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInfraWithExistingFileshare.json +func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithAnExistingSapTransportDirectoryFileshare() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ InstanceCount: to.Ptr[int64](6), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP-HA"), + Offer: to.Ptr("RHEL-SAP"), Publisher: to.Ptr("RedHat"), SKU: to.Ptr("84sapha-gen2"), Version: to.Ptr("latest"), @@ -5855,8 +5551,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationO OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -5867,11 +5563,11 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationO }, }, CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - InstanceCount: to.Ptr[int64](2), + InstanceCount: to.Ptr[int64](1), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP-HA"), + Offer: to.Ptr("RHEL-SAP"), Publisher: to.Ptr("RedHat"), SKU: to.Ptr("84sapha-gen2"), Version: to.Ptr("latest"), @@ -5879,8 +5575,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationO OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -5892,11 +5588,11 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationO }, DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - InstanceCount: to.Ptr[int64](2), + InstanceCount: to.Ptr[int64](1), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP-HA"), + Offer: to.Ptr("RHEL-SAP"), Publisher: to.Ptr("RedHat"), SKU: to.Ptr("84sapha-gen2"), Version: to.Ptr("latest"), @@ -5904,8 +5600,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationO OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -5915,21 +5611,23 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationO VMSize: to.Ptr("Standard_M32ts"), }, }, - HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ - HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilitySet), + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + StorageConfiguration: &armworkloadssapvirtualinstance.StorageConfiguration{ + TransportFileShareConfiguration: &armworkloadssapvirtualinstance.MountFileShareConfiguration{ + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.FileShareConfigurationTypeMount), + ID: to.Ptr("/subscriptions/49d64d54-e888-4c46-a868-1936802b762c/resourceGroups/testrg/providers/Microsoft.Network/privateEndpoints/endpoint"), + PrivateEndpointID: to.Ptr("/subscriptions/49d64d54-e888-4c46-a868-1936802b762c/resourceGroups/testrg/providers/Microsoft.Network/privateEndpoints/endpoint"), + }, }, }, OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ SapFqdn: to.Ptr("xyz.test.com"), }, - SoftwareConfiguration: &armworkloadssapvirtualinstance.ExternalInstallationSoftwareConfiguration{ - SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeExternal), - CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), - }, }, Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -5941,145 +5639,146 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationO // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](6), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_M32ts"), + // }, + // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // StorageConfiguration: &armworkloadssapvirtualinstance.StorageConfiguration{ + // TransportFileShareConfiguration: &armworkloadssapvirtualinstance.MountFileShareConfiguration{ + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.FileShareConfigurationTypeMount), + // ID: to.Ptr("/subscriptions/49d64d54-e888-4c46-a868-1936802b762c/resourceGroups/testrg/providers/Microsoft.Network/privateEndpoints/endpoint"), + // PrivateEndpointID: to.Ptr("/subscriptions/49d64d54-e888-4c46-a868-1936802b762c/resourceGroups/testrg/providers/Microsoft.Network/privateEndpoints/endpoint"), // }, - // VMSize: to.Ptr("Standard_M32ts"), // }, // }, - // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ - // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilitySet), + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("xyz.test.com"), // }, // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, - // SoftwareConfiguration: &armworkloadssapvirtualinstance.ExternalInstallationSoftwareConfiguration{ - // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeExternal), - // CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), - // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_HA_AvZone.json -func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationOnAnHaSystemWithAvailabilityZone() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInfraWithNewFileshare.json +func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithANewSapTransportDirectoryFileshare() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ InstanceCount: to.Ptr[int64](6), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP-HA"), + Offer: to.Ptr("RHEL-SAP"), Publisher: to.Ptr("RedHat"), SKU: to.Ptr("84sapha-gen2"), Version: to.Ptr("latest"), @@ -6087,8 +5786,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationO OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -6099,11 +5798,11 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationO }, }, CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - InstanceCount: to.Ptr[int64](2), + InstanceCount: to.Ptr[int64](1), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP-HA"), + Offer: to.Ptr("RHEL-SAP"), Publisher: to.Ptr("RedHat"), SKU: to.Ptr("84sapha-gen2"), Version: to.Ptr("latest"), @@ -6111,8 +5810,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationO OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -6124,11 +5823,11 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationO }, DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - InstanceCount: to.Ptr[int64](2), + InstanceCount: to.Ptr[int64](1), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP-HA"), + Offer: to.Ptr("RHEL-SAP"), Publisher: to.Ptr("RedHat"), SKU: to.Ptr("84sapha-gen2"), Version: to.Ptr("latest"), @@ -6136,8 +5835,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationO OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -6147,21 +5846,23 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationO VMSize: to.Ptr("Standard_M32ts"), }, }, - HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ - HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + StorageConfiguration: &armworkloadssapvirtualinstance.StorageConfiguration{ + TransportFileShareConfiguration: &armworkloadssapvirtualinstance.CreateAndMountFileShareConfiguration{ + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.FileShareConfigurationTypeCreateAndMount), + ResourceGroup: to.Ptr("rgName"), + StorageAccountName: to.Ptr("storageName"), + }, }, }, OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ SapFqdn: to.Ptr("xyz.test.com"), }, - SoftwareConfiguration: &armworkloadssapvirtualinstance.ExternalInstallationSoftwareConfiguration{ - SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeExternal), - CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), - }, }, Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -6173,230 +5874,451 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationO // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](6), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_M32ts"), + // }, + // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // StorageConfiguration: &armworkloadssapvirtualinstance.StorageConfiguration{ + // TransportFileShareConfiguration: &armworkloadssapvirtualinstance.CreateAndMountFileShareConfiguration{ + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.FileShareConfigurationTypeCreateAndMount), + // ResourceGroup: to.Ptr("rgName"), + // StorageAccountName: to.Ptr("storageName"), // }, - // VMSize: to.Ptr("Standard_M32ts"), // }, // }, - // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ - // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("xyz.test.com"), // }, // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, - // SoftwareConfiguration: &armworkloadssapvirtualinstance.ExternalInstallationSoftwareConfiguration{ - // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeExternal), - // CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), - // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Install_Distributed.json -func ExampleSAPVirtualInstancesClient_BeginCreate_installSapSoftwareOnDistributedSystem() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInfraWithOsTrustedAccess.json +func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOSConfigurationWithTrustedAccessEnabled() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus2"), - Tags: map[string]*string{ - "created by": to.Ptr("azureuser"), - }, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - AppResourceGroup: to.Ptr("{{resourcegrp}}"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + AppResourceGroup: to.Ptr("X00-RG"), ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), + InstanceCount: to.Ptr[int64](6), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP-HA"), + Offer: to.Ptr("RHEL-SAP"), Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("8.2"), - Version: to.Ptr("8.2.2021091201"), + SKU: to.Ptr("84sapha-gen2"), + Version: to.Ptr("latest"), }, OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - AdminUsername: to.Ptr("azureuser"), + AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("{{privateKey}}"), - PublicKey: to.Ptr("{{sshkey}}"), + PrivateKey: to.Ptr("xyz"), + PublicKey: to.Ptr("abc"), }, }, }, - VMSize: to.Ptr("Standard_E4ds_v4"), + VMSize: to.Ptr("Standard_E32ds_v4"), }, }, CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ InstanceCount: to.Ptr[int64](1), - SubnetID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP-HA"), + Offer: to.Ptr("RHEL-SAP"), Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("8.2"), - Version: to.Ptr("8.2.2021091201"), + SKU: to.Ptr("84sapha-gen2"), + Version: to.Ptr("latest"), }, OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - AdminUsername: to.Ptr("azureuser"), + AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("{{privateKey}}"), - PublicKey: to.Ptr("{{sshkey}}"), + PrivateKey: to.Ptr("xyz"), + PublicKey: to.Ptr("abc"), }, }, }, - VMSize: to.Ptr("Standard_E4ds_v4"), + VMSize: to.Ptr("Standard_E16ds_v4"), }, }, DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), InstanceCount: to.Ptr[int64](1), - SubnetID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP-HA"), + Offer: to.Ptr("RHEL-SAP"), Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("8.2"), - Version: to.Ptr("8.2.2021091201"), + SKU: to.Ptr("84sapha-gen2"), + Version: to.Ptr("latest"), }, OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - AdminUsername: to.Ptr("azureuser"), + AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("{{privateKey}}"), - PublicKey: to.Ptr("{{sshkey}}"), + PrivateKey: to.Ptr("xyz"), + PublicKey: to.Ptr("abc"), }, }, }, VMSize: to.Ptr("Standard_M32ts"), }, }, - NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ - IsSecondaryIPEnabled: to.Ptr(true), - }, + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), }, OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - SapFqdn: to.Ptr("sap.bpaas.com"), - }, - SoftwareConfiguration: &armworkloadssapvirtualinstance.SAPInstallWithoutOSConfigSoftwareConfiguration{ - SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeSAPInstallWithoutOSConfig), - BomURL: to.Ptr("https://teststorageaccount.blob.core.windows.net/sapbits/sapfiles/boms/S41909SPS03_v0011ms/S41909SPS03_v0011ms.yaml"), - SapBitsStorageAccountID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/teststorageaccount"), - SoftwareVersion: to.Ptr("SAP S/4HANA 1909 SPS 03"), + SapFqdn: to.Ptr("xyz.test.com"), + }, + }, + Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + ManagedResourcesNetworkAccessType: to.Ptr(armworkloadssapvirtualinstance.ManagedResourcesNetworkAccessTypePrivate), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + }, + Tags: map[string]*string{}, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %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 = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](6), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), + // }, + // }, + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_E16ds_v4"), + // }, + // }, + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_M32ts"), + // }, + // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // }, + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("xyz.test.com"), + // }, + // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ManagedResourcesNetworkAccessType: to.Ptr(armworkloadssapvirtualinstance.ManagedResourcesNetworkAccessTypePrivate), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInfraWithoutFileshare.json +func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithoutASapTransportDirectoryFileshare() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ + Location: to.Ptr("westcentralus"), + Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + AppResourceGroup: to.Ptr("X00-RG"), + ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + InstanceCount: to.Ptr[int64](6), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + Offer: to.Ptr("RHEL-SAP"), + Publisher: to.Ptr("RedHat"), + SKU: to.Ptr("84sapha-gen2"), + Version: to.Ptr("latest"), + }, + OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + AdminUsername: to.Ptr("{your-username}"), + OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + PrivateKey: to.Ptr("xyz"), + PublicKey: to.Ptr("abc"), + }, + }, + }, + VMSize: to.Ptr("Standard_E32ds_v4"), + }, + }, + CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + InstanceCount: to.Ptr[int64](1), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + Offer: to.Ptr("RHEL-SAP"), + Publisher: to.Ptr("RedHat"), + SKU: to.Ptr("84sapha-gen2"), + Version: to.Ptr("latest"), + }, + OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + AdminUsername: to.Ptr("{your-username}"), + OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + PrivateKey: to.Ptr("xyz"), + PublicKey: to.Ptr("abc"), + }, + }, + }, + VMSize: to.Ptr("Standard_E16ds_v4"), + }, + }, + DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + InstanceCount: to.Ptr[int64](1), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + Offer: to.Ptr("RHEL-SAP"), + Publisher: to.Ptr("RedHat"), + SKU: to.Ptr("84sapha-gen2"), + Version: to.Ptr("latest"), + }, + OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + AdminUsername: to.Ptr("{your-username}"), + OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + PrivateKey: to.Ptr("xyz"), + PublicKey: to.Ptr("abc"), + }, + }, + }, + VMSize: to.Ptr("Standard_M32ts"), + }, + }, + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + StorageConfiguration: &armworkloadssapvirtualinstance.StorageConfiguration{ + TransportFileShareConfiguration: &armworkloadssapvirtualinstance.SkipFileShareConfiguration{ + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.FileShareConfigurationTypeSkip), + }, + }, + }, + OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + SapFqdn: to.Ptr("xyz.test.com"), }, }, Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -6408,945 +6330,2361 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_installSapSoftwareOnDistribute // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("microsoft.workloads/sapvirtualinstances"), - // ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/aa-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-18T18:25:55.240Z"); return t}()), - // CreatedBy: to.Ptr("f1bc9460-9d57-4c16-99a8-5a19378a3a93"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-18T18:50:59.194Z"); return t}()), - // LastModifiedBy: to.Ptr("f1bc9460-9d57-4c16-99a8-5a19378a3a93"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeApplication), - // }, - // Location: to.Ptr("eastus2"), - // Tags: map[string]*string{ - // "created by": to.Ptr("azureuser"), - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("aa-rg"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](6), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("azureuser"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), + // }, + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // VMSize: to.Ptr("Standard_E4ds_v4"), // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_M32ts"), // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("azureuser"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), + // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // StorageConfiguration: &armworkloadssapvirtualinstance.StorageConfiguration{ + // TransportFileShareConfiguration: &armworkloadssapvirtualinstance.SkipFileShareConfiguration{ + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.FileShareConfigurationTypeSkip), + // }, + // }, + // }, + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("xyz.test.com"), + // }, + // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInstallDS.json +func ExampleSAPVirtualInstancesClient_BeginCreate_installSapSoftwareOnDistributedSystem() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ + Location: to.Ptr("eastus2"), + Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + AppResourceGroup: to.Ptr("{{resourcegrp}}"), + ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + InstanceCount: to.Ptr[int64](2), + SubnetID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), + VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + Offer: to.Ptr("RHEL-SAP-HA"), + Publisher: to.Ptr("RedHat"), + SKU: to.Ptr("8.2"), + Version: to.Ptr("8.2.2021091201"), + }, + OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + AdminUsername: to.Ptr("azureuser"), + OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + PrivateKey: to.Ptr("{{privateKey}}"), + PublicKey: to.Ptr("{{sshkey}}"), + }, + }, + }, + VMSize: to.Ptr("Standard_E4ds_v4"), + }, + }, + CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + InstanceCount: to.Ptr[int64](1), + SubnetID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), + VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + Offer: to.Ptr("RHEL-SAP-HA"), + Publisher: to.Ptr("RedHat"), + SKU: to.Ptr("8.2"), + Version: to.Ptr("8.2.2021091201"), + }, + OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + AdminUsername: to.Ptr("azureuser"), + OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + PrivateKey: to.Ptr("{{privateKey}}"), + PublicKey: to.Ptr("{{sshkey}}"), + }, + }, + }, + VMSize: to.Ptr("Standard_E4ds_v4"), + }, + }, + DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + InstanceCount: to.Ptr[int64](1), + SubnetID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), + VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + Offer: to.Ptr("RHEL-SAP-HA"), + Publisher: to.Ptr("RedHat"), + SKU: to.Ptr("8.2"), + Version: to.Ptr("8.2.2021091201"), + }, + OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + AdminUsername: to.Ptr("azureuser"), + OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + PrivateKey: to.Ptr("{{privateKey}}"), + PublicKey: to.Ptr("{{sshkey}}"), + }, + }, + }, + VMSize: to.Ptr("Standard_M32ts"), + }, + }, + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ + IsSecondaryIPEnabled: to.Ptr(true), + }, + }, + OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + SapFqdn: to.Ptr("sap.bpaas.com"), + }, + SoftwareConfiguration: &armworkloadssapvirtualinstance.SAPInstallWithoutOSConfigSoftwareConfiguration{ + BomURL: to.Ptr("https://teststorageaccount.blob.core.windows.net/sapbits/sapfiles/boms/S41909SPS03_v0011ms/S41909SPS03_v0011ms.yaml"), + SapBitsStorageAccountID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/teststorageaccount"), + SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeSAPInstallWithoutOSConfig), + SoftwareVersion: to.Ptr("SAP S/4HANA 1909 SPS 03"), + }, + }, + Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + }, + Tags: map[string]*string{ + "created by": to.Ptr("azureuser"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %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 = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("microsoft.workloads/sapvirtualinstances"), + // ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/aa-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("eastus2"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("aa-rg"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP-HA"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("azureuser"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_E4ds_v4"), + // }, + // }, + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP-HA"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("azureuser"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_E4ds_v4"), + // }, + // }, + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP-HA"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("azureuser"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_M32ts"), + // }, + // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ + // IsSecondaryIPEnabled: to.Ptr(true), + // }, + // }, + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("sap.bpaas.com"), + // }, + // SoftwareConfiguration: &armworkloadssapvirtualinstance.SAPInstallWithoutOSConfigSoftwareConfiguration{ + // BomURL: to.Ptr("https://teststorageaccount.blob.core.windows.net/sapbits/sapfiles/boms/S41909SPS03_v0011ms/S41909SPS03_v0011ms.yaml"), + // SapBitsStorageAccountID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/teststorageaccount"), + // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeSAPInstallWithoutOSConfig), + // SoftwareVersion: to.Ptr("SAP S/4HANA 1909 SPS 03"), + // }, + // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationInProgress), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-18T18:25:55.2406546Z"); return t}()), + // CreatedBy: to.Ptr("f1bc9460-9d57-4c16-99a8-5a19378a3a93"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeApplication), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-18T18:50:59.1945444Z"); return t}()), + // LastModifiedBy: to.Ptr("f1bc9460-9d57-4c16-99a8-5a19378a3a93"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeApplication), + // }, + // Tags: map[string]*string{ + // "created by": to.Ptr("azureuser"), + // }, + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInstallSingleServer.json +func ExampleSAPVirtualInstancesClient_BeginCreate_installSapSoftwareOnSingleServerSystem() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ + Location: to.Ptr("eastus2"), + Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + InfrastructureConfiguration: &armworkloadssapvirtualinstance.SingleServerConfiguration{ + AppResourceGroup: to.Ptr("test-rg"), + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), + SubnetID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/testsubnet"), + VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + Offer: to.Ptr("SLES-SAP"), + Publisher: to.Ptr("SUSE"), + SKU: to.Ptr("12-sp4-gen2"), + Version: to.Ptr("2022.02.01"), + }, + OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + AdminUsername: to.Ptr("azureappadmin"), + OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + PrivateKey: to.Ptr("{{privateKey}}"), + PublicKey: to.Ptr("{{sshkey}}"), + }, + }, + }, + VMSize: to.Ptr("Standard_E32ds_v4"), + }, + }, + OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + SapFqdn: to.Ptr("sap.bpaas.com"), + }, + SoftwareConfiguration: &armworkloadssapvirtualinstance.SAPInstallWithoutOSConfigSoftwareConfiguration{ + BomURL: to.Ptr("https://teststorageaccount.blob.core.windows.net/sapbits/sapfiles/boms/S41909SPS03_v0011ms/S41909SPS03_v0011ms.yaml"), + SapBitsStorageAccountID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/teststorageaccount"), + SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeSAPInstallWithoutOSConfig), + SoftwareVersion: to.Ptr("SAP S/4HANA 1909 SPS 03"), + }, + }, + Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + }, + Tags: map[string]*string{}, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %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 = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("microsoft.workloads/sapvirtualinstances"), + // ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/aa-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("eastus2"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("aa-rg"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP-HA"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("azureuser"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_E4ds_v4"), + // }, + // }, + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP-HA"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("azureuser"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_E4ds_v4"), + // }, + // }, + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP-HA"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("azureuser"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_M32ts"), + // }, + // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ + // IsSecondaryIPEnabled: to.Ptr(true), + // }, + // }, + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("sap.bpaas.com"), + // }, + // SoftwareConfiguration: &armworkloadssapvirtualinstance.SAPInstallWithoutOSConfigSoftwareConfiguration{ + // BomURL: to.Ptr("https://teststorageaccount.blob.core.windows.net/sapbits/sapfiles/boms/S41909SPS03_v0011ms/S41909SPS03_v0011ms.yaml"), + // SapBitsStorageAccountID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/teststorageaccount"), + // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeSAPInstallWithoutOSConfig), + // SoftwareVersion: to.Ptr("SAP S/4HANA 1909 SPS 03"), + // }, + // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationInProgress), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-18T18:25:55.2406546Z"); return t}()), + // CreatedBy: to.Ptr("f1bc9460-9d57-4c16-99a8-5a19378a3a93"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeApplication), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-18T18:50:59.1945444Z"); return t}()), + // LastModifiedBy: to.Ptr("f1bc9460-9d57-4c16-99a8-5a19378a3a93"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeApplication), + // }, + // Tags: map[string]*string{ + // "created by": to.Ptr("azureuser"), + // }, + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateRegisterSapSolutions.json +func ExampleSAPVirtualInstancesClient_BeginCreate_registerExistingSapSystemAsVirtualInstanceForSapSolutions() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ + Location: to.Ptr("northeurope"), + Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + Configuration: &armworkloadssapvirtualinstance.DiscoveryConfiguration{ + CentralServerVMID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDiscovery), + }, + Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + }, + Tags: map[string]*string{ + "createdby": to.Ptr("abc@microsoft.com"), + "test": to.Ptr("abc"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %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 = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("Q20"), + // Type: to.Ptr("microsoft.workloads/sapvirtualinstances"), + // ID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/Q20"), + // Location: to.Ptr("northeurope"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DiscoveryConfiguration{ + // AppLocation: to.Ptr("westeurope"), + // CentralServerVMID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg-infra/providers/Microsoft.Compute/virtualMachines/q20ascsvm0"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDiscovery), + // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ + // Name: to.Ptr("mrg-Q20-5b0097"), + // }, + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-27T08:22:52.3318907Z"); return t}()), + // CreatedBy: to.Ptr("abc@microsoft.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-27T11:44:17.9310503Z"); return t}()), + // LastModifiedBy: to.Ptr("abc@microsoft.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateRegisterSapSolutionsCustom.json +func ExampleSAPVirtualInstancesClient_BeginCreate_registerExistingSapSystemAsVirtualInstanceForSapSolutionsWithOptionalCustomizations() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ + Location: to.Ptr("northeurope"), + Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + Configuration: &armworkloadssapvirtualinstance.DiscoveryConfiguration{ + CentralServerVMID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDiscovery), + ManagedRgStorageAccountName: to.Ptr("q20saacssgrs"), + }, + Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + }, + Tags: map[string]*string{ + "createdby": to.Ptr("abc@microsoft.com"), + "test": to.Ptr("abc"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %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 = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("Q20"), + // Type: to.Ptr("microsoft.workloads/sapvirtualinstances"), + // ID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/Q20"), + // Location: to.Ptr("northeurope"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DiscoveryConfiguration{ + // AppLocation: to.Ptr("westeurope"), + // CentralServerVMID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg-infra/providers/Microsoft.Compute/virtualMachines/q20ascsvm0"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDiscovery), + // ManagedRgStorageAccountName: to.Ptr("q20saacssgrs"), + // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ + // Name: to.Ptr("mrg-Q20-5b0097"), + // }, + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-27T08:22:52.3318907Z"); return t}()), + // CreatedBy: to.Ptr("abc@microsoft.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-27T11:44:17.9310503Z"); return t}()), + // LastModifiedBy: to.Ptr("abc@microsoft.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateRegisterWithTrustedAccess.json +func ExampleSAPVirtualInstancesClient_BeginCreate_registerWithTrustedAccessEnabled() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ + Location: to.Ptr("northeurope"), + Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + Configuration: &armworkloadssapvirtualinstance.DiscoveryConfiguration{ + CentralServerVMID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDiscovery), + }, + Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), + ManagedResourcesNetworkAccessType: to.Ptr(armworkloadssapvirtualinstance.ManagedResourcesNetworkAccessTypePrivate), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + }, + Tags: map[string]*string{ + "createdby": to.Ptr("abc@microsoft.com"), + "test": to.Ptr("abc"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %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 = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("Q20"), + // Type: to.Ptr("microsoft.workloads/sapvirtualinstances"), + // ID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/Q20"), + // Location: to.Ptr("northeurope"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DiscoveryConfiguration{ + // AppLocation: to.Ptr("westeurope"), + // CentralServerVMID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg-infra/providers/Microsoft.Compute/virtualMachines/q20ascsvm0"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDiscovery), + // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ + // Name: to.Ptr("mrg-Q20-5b0097"), + // }, + // ManagedResourcesNetworkAccessType: to.Ptr(armworkloadssapvirtualinstance.ManagedResourcesNetworkAccessTypePrivate), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-27T08:22:52.3318907Z"); return t}()), + // CreatedBy: to.Ptr("abc@microsoft.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-27T11:44:17.9310503Z"); return t}()), + // LastModifiedBy: to.Ptr("abc@microsoft.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapVirtualInstances_Delete.json +func ExampleSAPVirtualInstancesClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("6d875e77-e412-4d7d-9af4-8895278b4443", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginDelete(ctx, "test-rg", "X00", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: 2024-09-01/SapVirtualInstances_Get.json +func ExampleSAPVirtualInstancesClient_Get_sapVirtualInstancesGet() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSAPVirtualInstancesClient().Get(ctx, "test-rg", "X00", 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 = armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](10), + // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId3"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + // { + // KeyData: to.Ptr("ssh-rsa public key"), + // }, + // }, + // }, // }, // }, + // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // VMSize: to.Ptr("Standard_E4ds_v4"), // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId1"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + // { + // KeyData: to.Ptr("ssh-rsa public key"), + // }, + // }, + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("azureuser"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), + // }, + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId2"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + // { + // KeyData: to.Ptr("ssh-rsa public key"), + // }, + // }, + // }, // }, // }, + // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // VMSize: to.Ptr("Standard_M32ts"), // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), // }, - // NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ - // IsSecondaryIPEnabled: to.Ptr(true), + // SoftwareConfiguration: &armworkloadssapvirtualinstance.ServiceInitiatedSoftwareConfiguration{ + // BomURL: to.Ptr("https://myaccount.blob.core.windows.net/mycontainer/myblob"), + // SapBitsStorageAccountID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/ajgupt-test/providers/Microsoft.Storage/storageAccounts/ajguptsavnet"), + // SapFqdn: to.Ptr("sapsystem.contoso.net"), + // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeServiceInitiated), + // SoftwareVersion: to.Ptr("SAP S/4HANA 2020 FPS01"), // }, // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("sap.bpaas.com"), - // }, - // SoftwareConfiguration: &armworkloadssapvirtualinstance.SAPInstallWithoutOSConfigSoftwareConfiguration{ - // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeSAPInstallWithoutOSConfig), - // BomURL: to.Ptr("https://teststorageaccount.blob.core.windows.net/sapbits/sapfiles/boms/S41909SPS03_v0011ms/S41909SPS03_v0011ms.yaml"), - // SapBitsStorageAccountID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/teststorageaccount"), - // SoftwareVersion: to.Ptr("SAP S/4HANA 1909 SPS 03"), + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ + // Name: to.Ptr("mrg-x00-6d875e77-e412-4d7d-9af4-8895278b4443"), // }, + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationInProgress), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Install_SingleServer.json -func ExampleSAPVirtualInstancesClient_BeginCreate_installSapSoftwareOnSingleServerSystem() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_GetAcssInstallationBlocked.json +func ExampleSAPVirtualInstancesClient_Get_sapVirtualInstancesGetWithAcssInstallationBlocked() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus2"), - Tags: map[string]*string{}, - Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - AppLocation: to.Ptr("eastus"), - InfrastructureConfiguration: &armworkloadssapvirtualinstance.SingleServerConfiguration{ - AppResourceGroup: to.Ptr("test-rg"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), - SubnetID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/testsubnet"), - VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("SLES-SAP"), - Publisher: to.Ptr("SUSE"), - SKU: to.Ptr("12-sp4-gen2"), - Version: to.Ptr("2022.02.01"), - }, - OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - AdminUsername: to.Ptr("azureappadmin"), - OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("{{privateKey}}"), - PublicKey: to.Ptr("{{sshkey}}"), - }, - }, - }, - VMSize: to.Ptr("Standard_E32ds_v4"), - }, - }, - OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - SapFqdn: to.Ptr("sap.bpaas.com"), - }, - SoftwareConfiguration: &armworkloadssapvirtualinstance.SAPInstallWithoutOSConfigSoftwareConfiguration{ - SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeSAPInstallWithoutOSConfig), - BomURL: to.Ptr("https://teststorageaccount.blob.core.windows.net/sapbits/sapfiles/boms/S41909SPS03_v0011ms/S41909SPS03_v0011ms.yaml"), - SapBitsStorageAccountID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/teststorageaccount"), - SoftwareVersion: to.Ptr("SAP S/4HANA 1909 SPS 03"), - }, - }, - Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), - SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - }, - }, nil) + res, err := clientFactory.NewSAPVirtualInstancesClient().Get(ctx, "test-rg", "X00", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("microsoft.workloads/sapvirtualinstances"), - // ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/aa-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-18T18:25:55.240Z"); return t}()), - // CreatedBy: to.Ptr("f1bc9460-9d57-4c16-99a8-5a19378a3a93"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-18T18:50:59.194Z"); return t}()), - // LastModifiedBy: to.Ptr("f1bc9460-9d57-4c16-99a8-5a19378a3a93"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeApplication), - // }, - // Location: to.Ptr("eastus2"), - // Tags: map[string]*string{ - // "created by": to.Ptr("azureuser"), - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("aa-rg"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("azureuser"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](10), + // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId3"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/galleries/testgallery/images/rhelimagetest/versions/0.0.1"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + // { + // KeyData: to.Ptr("ssh-rsa public key"), + // }, + // }, + // }, // }, // }, + // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // VMSize: to.Ptr("Standard_E4ds_v4"), // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("azureuser"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId1"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/galleries/testgallery/images/rhelimagetest/versions/0.0.1"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + // { + // KeyData: to.Ptr("ssh-rsa public key"), + // }, + // }, + // }, // }, // }, + // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // VMSize: to.Ptr("Standard_E4ds_v4"), // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("azureuser"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId2"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/galleries/testgallery/images/rhelimagetest/versions/0.0.1"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + // { + // KeyData: to.Ptr("ssh-rsa public key"), + // }, + // }, + // }, // }, // }, + // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // VMSize: to.Ptr("Standard_M32ts"), // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), // }, - // NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ - // IsSecondaryIPEnabled: to.Ptr(true), + // SoftwareConfiguration: &armworkloadssapvirtualinstance.ServiceInitiatedSoftwareConfiguration{ + // BomURL: to.Ptr("https://myaccount.blob.core.windows.net/mycontainer/myblob"), + // SapBitsStorageAccountID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/ajgupt-test/providers/Microsoft.Storage/storageAccounts/ajguptsavnet"), + // SapFqdn: to.Ptr("sapsystem.contoso.net"), + // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeServiceInitiated), + // SoftwareVersion: to.Ptr("SAP S/4HANA 2020 FPS01"), // }, // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("sap.bpaas.com"), - // }, - // SoftwareConfiguration: &armworkloadssapvirtualinstance.SAPInstallWithoutOSConfigSoftwareConfiguration{ - // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeSAPInstallWithoutOSConfig), - // BomURL: to.Ptr("https://teststorageaccount.blob.core.windows.net/sapbits/sapfiles/boms/S41909SPS03_v0011ms/S41909SPS03_v0011ms.yaml"), - // SapBitsStorageAccountID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/teststorageaccount"), - // SoftwareVersion: to.Ptr("SAP S/4HANA 1909 SPS 03"), + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ + // Name: to.Ptr("mrg-x00-6d875e77-e412-4d7d-9af4-8895278b4443"), // }, + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateACSSInstallationBlocked), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationInProgress), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_Discover_CustomMrgStorageAccountName.json -func ExampleSAPVirtualInstancesClient_BeginCreate_registerExistingSapSystemAsVirtualInstanceForSapSolutionsWithOptionalCustomizations() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_InvokeAvailabilityZoneDetails_eastus.json +func ExampleSAPVirtualInstancesClient_GetAvailabilityZoneDetails_sapAvailabilityZoneDetailsInEastUs() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("northeurope"), - Tags: map[string]*string{ - "createdby": to.Ptr("abc@microsoft.com"), - "test": to.Ptr("abc"), - }, - Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - Configuration: &armworkloadssapvirtualinstance.DiscoveryConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDiscovery), - CentralServerVMID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), - ManagedRgStorageAccountName: to.Ptr("q20saacssgrs"), - }, - Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), - SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - }, + res, err := clientFactory.NewSAPVirtualInstancesClient().GetAvailabilityZoneDetails(ctx, "eastus", armworkloadssapvirtualinstance.SAPAvailabilityZoneDetailsRequest{ + AppLocation: to.Ptr("eastus"), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - res, err := poller.PollUntilDone(ctx, nil) + // 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 = armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetAvailabilityZoneDetailsResponse{ + // SAPAvailabilityZoneDetailsResult: &armworkloadssapvirtualinstance.SAPAvailabilityZoneDetailsResult{ + // AvailabilityZonePairs: []*armworkloadssapvirtualinstance.SAPAvailabilityZonePair{ + // { + // ZoneA: to.Ptr[int64](1), + // ZoneB: to.Ptr[int64](2), + // }, + // }, + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapVirtualInstances_InvokeAvailabilityZoneDetails_northeurope.json +func ExampleSAPVirtualInstancesClient_GetAvailabilityZoneDetails_sapAvailabilityZoneDetailsInNorthEurope() { + cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSAPVirtualInstancesClient().GetAvailabilityZoneDetails(ctx, "northeurope", armworkloadssapvirtualinstance.SAPAvailabilityZoneDetailsRequest{ + AppLocation: to.Ptr("northeurope"), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + }, 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("Q20"), - // Type: to.Ptr("microsoft.workloads/sapvirtualinstances"), - // ID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/Q20"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-27T08:22:52.331Z"); return t}()), - // CreatedBy: to.Ptr("abc@microsoft.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-27T11:44:17.931Z"); return t}()), - // LastModifiedBy: to.Ptr("abc@microsoft.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("northeurope"), - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DiscoveryConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDiscovery), - // AppLocation: to.Ptr("westeurope"), - // CentralServerVMID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg-infra/providers/Microsoft.Compute/virtualMachines/q20ascsvm0"), - // ManagedRgStorageAccountName: to.Ptr("q20saacssgrs"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetAvailabilityZoneDetailsResponse{ + // SAPAvailabilityZoneDetailsResult: &armworkloadssapvirtualinstance.SAPAvailabilityZoneDetailsResult{ + // AvailabilityZonePairs: []*armworkloadssapvirtualinstance.SAPAvailabilityZonePair{ + // { + // ZoneA: to.Ptr[int64](2), + // ZoneB: to.Ptr[int64](3), + // }, // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ - // Name: to.Ptr("mrg-Q20-5b0097"), + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapVirtualInstances_InvokeDiskConfigurations_NonProd.json +func ExampleSAPVirtualInstancesClient_GetDiskConfigurations_sapDiskConfigurationsForInputEnvironmentNonProd() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSAPVirtualInstancesClient().GetDiskConfigurations(ctx, "centralus", armworkloadssapvirtualinstance.SAPDiskConfigurationsRequest{ + AppLocation: to.Ptr("eastus"), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + DbVMSKU: to.Ptr("Standard_M32ts"), + }, 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 = armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetDiskConfigurationsResponse{ + // SAPDiskConfigurationsResult: &armworkloadssapvirtualinstance.SAPDiskConfigurationsResult{ + // VolumeConfigurations: map[string]*armworkloadssapvirtualinstance.SAPDiskConfiguration{ + // "hana/data": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ + // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // Count: to.Ptr[int64](4), + // SizeGB: to.Ptr[int64](128), + // }, + // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](128), + // MinimumSupportedDiskCount: to.Ptr[int64](4), + // MaximumSupportedDiskCount: to.Ptr[int64](5), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](100), + // DiskTier: to.Ptr("P10"), + // }, + // }, + // }, + // "hana/log": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ + // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // Count: to.Ptr[int64](3), + // SizeGB: to.Ptr[int64](128), + // }, + // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](128), + // MinimumSupportedDiskCount: to.Ptr[int64](3), + // MaximumSupportedDiskCount: to.Ptr[int64](5), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](100), + // DiskTier: to.Ptr("P10"), + // }, + // }, + // }, + // "hana/shared": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ + // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // Count: to.Ptr[int64](1), + // SizeGB: to.Ptr[int64](256), + // }, + // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](256), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](1100), + // MbpsReadWrite: to.Ptr[int64](125), + // DiskTier: to.Ptr("P15"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](512), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](2300), + // MbpsReadWrite: to.Ptr[int64](150), + // DiskTier: to.Ptr("P20"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](1024), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](5000), + // MbpsReadWrite: to.Ptr[int64](200), + // DiskTier: to.Ptr("P30"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](2048), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](7500), + // MbpsReadWrite: to.Ptr[int64](250), + // DiskTier: to.Ptr("P40"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](4096), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](7500), + // MbpsReadWrite: to.Ptr[int64](250), + // DiskTier: to.Ptr("P50"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // SizeGB: to.Ptr[int64](256), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](60), + // DiskTier: to.Ptr("E15"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // SizeGB: to.Ptr[int64](512), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](60), + // DiskTier: to.Ptr("E20"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // SizeGB: to.Ptr[int64](1024), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](60), + // DiskTier: to.Ptr("E30"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // SizeGB: to.Ptr[int64](2048), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](60), + // DiskTier: to.Ptr("E40"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // SizeGB: to.Ptr[int64](4096), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](60), + // DiskTier: to.Ptr("E50"), + // }, + // }, + // }, + // "usr/sap": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ + // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // Count: to.Ptr[int64](1), + // SizeGB: to.Ptr[int64](128), + // }, + // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](128), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](100), + // DiskTier: to.Ptr("P10"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](256), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](1100), + // MbpsReadWrite: to.Ptr[int64](125), + // DiskTier: to.Ptr("P10"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](512), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](2300), + // MbpsReadWrite: to.Ptr[int64](150), + // DiskTier: to.Ptr("P10"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // SizeGB: to.Ptr[int64](128), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](60), + // DiskTier: to.Ptr("E10"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // SizeGB: to.Ptr[int64](256), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](60), + // DiskTier: to.Ptr("E15"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // SizeGB: to.Ptr[int64](512), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](60), + // DiskTier: to.Ptr("E20"), + // }, + // }, + // }, + // "os": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ + // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // Count: to.Ptr[int64](1), + // SizeGB: to.Ptr[int64](64), + // }, + // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](64), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](240), + // MbpsReadWrite: to.Ptr[int64](50), + // DiskTier: to.Ptr("P6"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](128), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](100), + // DiskTier: to.Ptr("P10"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // SizeGB: to.Ptr[int64](64), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](60), + // DiskTier: to.Ptr("P6"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // SizeGB: to.Ptr[int64](128), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](60), + // DiskTier: to.Ptr("P10"), + // }, + // }, + // }, + // "backup": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ + // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // Count: to.Ptr[int64](2), + // SizeGB: to.Ptr[int64](256), + // }, + // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // SizeGB: to.Ptr[int64](128), + // MinimumSupportedDiskCount: to.Ptr[int64](0), + // MaximumSupportedDiskCount: to.Ptr[int64](6), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](60), + // DiskTier: to.Ptr("E10"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // SizeGB: to.Ptr[int64](256), + // MinimumSupportedDiskCount: to.Ptr[int64](0), + // MaximumSupportedDiskCount: to.Ptr[int64](6), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](60), + // DiskTier: to.Ptr("E15"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // SizeGB: to.Ptr[int64](512), + // MinimumSupportedDiskCount: to.Ptr[int64](0), + // MaximumSupportedDiskCount: to.Ptr[int64](6), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](60), + // DiskTier: to.Ptr("E20"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](128), + // MinimumSupportedDiskCount: to.Ptr[int64](0), + // MaximumSupportedDiskCount: to.Ptr[int64](6), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](100), + // DiskTier: to.Ptr("P10"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](256), + // MinimumSupportedDiskCount: to.Ptr[int64](0), + // MaximumSupportedDiskCount: to.Ptr[int64](6), + // IopsReadWrite: to.Ptr[int64](1100), + // MbpsReadWrite: to.Ptr[int64](125), + // DiskTier: to.Ptr("P15"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](512), + // MinimumSupportedDiskCount: to.Ptr[int64](0), + // MaximumSupportedDiskCount: to.Ptr[int64](6), + // IopsReadWrite: to.Ptr[int64](2300), + // MbpsReadWrite: to.Ptr[int64](150), + // DiskTier: to.Ptr("P20"), + // }, + // }, + // }, // }, - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_Discover.json -func ExampleSAPVirtualInstancesClient_BeginCreate_registerExistingSapSystemAsVirtualInstanceForSapSolutions() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_InvokeDiskConfigurations_Prod.json +func ExampleSAPVirtualInstancesClient_GetDiskConfigurations_sapDiskConfigurationsForInputEnvironmentProd() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("northeurope"), - Tags: map[string]*string{ - "createdby": to.Ptr("abc@microsoft.com"), - "test": to.Ptr("abc"), - }, - Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - Configuration: &armworkloadssapvirtualinstance.DiscoveryConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDiscovery), - CentralServerVMID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), - }, - Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), - SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - }, + res, err := clientFactory.NewSAPVirtualInstancesClient().GetDiskConfigurations(ctx, "centralus", armworkloadssapvirtualinstance.SAPDiskConfigurationsRequest{ + AppLocation: to.Ptr("eastus"), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + DbVMSKU: to.Ptr("Standard_M32ts"), }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("Q20"), - // Type: to.Ptr("microsoft.workloads/sapvirtualinstances"), - // ID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/Q20"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-27T08:22:52.331Z"); return t}()), - // CreatedBy: to.Ptr("abc@microsoft.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-27T11:44:17.931Z"); return t}()), - // LastModifiedBy: to.Ptr("abc@microsoft.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("northeurope"), - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DiscoveryConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDiscovery), - // AppLocation: to.Ptr("westeurope"), - // CentralServerVMID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg-infra/providers/Microsoft.Compute/virtualMachines/q20ascsvm0"), - // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ - // Name: to.Ptr("mrg-Q20-5b0097"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetDiskConfigurationsResponse{ + // SAPDiskConfigurationsResult: &armworkloadssapvirtualinstance.SAPDiskConfigurationsResult{ + // VolumeConfigurations: map[string]*armworkloadssapvirtualinstance.SAPDiskConfiguration{ + // "hana/data": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ + // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // Count: to.Ptr[int64](4), + // SizeGB: to.Ptr[int64](128), + // }, + // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](128), + // MinimumSupportedDiskCount: to.Ptr[int64](4), + // MaximumSupportedDiskCount: to.Ptr[int64](5), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](100), + // DiskTier: to.Ptr("P10"), + // }, + // }, + // }, + // "hana/log": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ + // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // Count: to.Ptr[int64](3), + // SizeGB: to.Ptr[int64](128), + // }, + // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](128), + // MinimumSupportedDiskCount: to.Ptr[int64](3), + // MaximumSupportedDiskCount: to.Ptr[int64](5), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](100), + // DiskTier: to.Ptr("P10"), + // }, + // }, + // }, + // "hana/shared": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ + // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // Count: to.Ptr[int64](1), + // SizeGB: to.Ptr[int64](256), + // }, + // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](256), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](1100), + // MbpsReadWrite: to.Ptr[int64](125), + // DiskTier: to.Ptr("P15"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](512), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](2300), + // MbpsReadWrite: to.Ptr[int64](150), + // DiskTier: to.Ptr("P20"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](1024), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](5000), + // MbpsReadWrite: to.Ptr[int64](200), + // DiskTier: to.Ptr("P30"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](2048), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](7500), + // MbpsReadWrite: to.Ptr[int64](250), + // DiskTier: to.Ptr("P40"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](4096), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](7500), + // MbpsReadWrite: to.Ptr[int64](250), + // DiskTier: to.Ptr("P50"), + // }, + // }, + // }, + // "usr/sap": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ + // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // Count: to.Ptr[int64](1), + // SizeGB: to.Ptr[int64](128), + // }, + // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](128), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](100), + // DiskTier: to.Ptr("P10"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](256), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](1100), + // MbpsReadWrite: to.Ptr[int64](125), + // DiskTier: to.Ptr("P10"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](512), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](2300), + // MbpsReadWrite: to.Ptr[int64](150), + // DiskTier: to.Ptr("P10"), + // }, + // }, + // }, + // "os": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ + // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // Count: to.Ptr[int64](1), + // SizeGB: to.Ptr[int64](64), + // }, + // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](64), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](240), + // MbpsReadWrite: to.Ptr[int64](50), + // DiskTier: to.Ptr("P6"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](128), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](100), + // DiskTier: to.Ptr("P10"), + // }, + // }, + // }, + // "backup": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ + // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // Count: to.Ptr[int64](2), + // SizeGB: to.Ptr[int64](256), + // }, + // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](128), + // MinimumSupportedDiskCount: to.Ptr[int64](0), + // MaximumSupportedDiskCount: to.Ptr[int64](6), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](100), + // DiskTier: to.Ptr("P10"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](256), + // MinimumSupportedDiskCount: to.Ptr[int64](0), + // MaximumSupportedDiskCount: to.Ptr[int64](6), + // IopsReadWrite: to.Ptr[int64](1100), + // MbpsReadWrite: to.Ptr[int64](125), + // DiskTier: to.Ptr("P15"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](512), + // MinimumSupportedDiskCount: to.Ptr[int64](0), + // MaximumSupportedDiskCount: to.Ptr[int64](6), + // IopsReadWrite: to.Ptr[int64](2300), + // MbpsReadWrite: to.Ptr[int64](150), + // DiskTier: to.Ptr("P20"), + // }, + // }, + // }, // }, - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_Discover_TrustedAccessEnable.json -func ExampleSAPVirtualInstancesClient_BeginCreate_registerWithTrustedAccessEnabled() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_InvokeSapSupportedSku_Distributed.json +func ExampleSAPVirtualInstancesClient_GetSapSupportedSKU_sapSupportedSkUsForDistributedNonHaEnvironment() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("northeurope"), - Tags: map[string]*string{ - "createdby": to.Ptr("abc@microsoft.com"), - "test": to.Ptr("abc"), - }, - Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - Configuration: &armworkloadssapvirtualinstance.DiscoveryConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDiscovery), - CentralServerVMID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), - }, - Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), - ManagedResourcesNetworkAccessType: to.Ptr(armworkloadssapvirtualinstance.ManagedResourcesNetworkAccessTypePrivate), - SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - }, + res, err := clientFactory.NewSAPVirtualInstancesClient().GetSapSupportedSKU(ctx, "centralus", armworkloadssapvirtualinstance.SAPSupportedSKUsRequest{ + AppLocation: to.Ptr("eastus"), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("Q20"), - // Type: to.Ptr("microsoft.workloads/sapvirtualinstances"), - // ID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/Q20"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-27T08:22:52.331Z"); return t}()), - // CreatedBy: to.Ptr("abc@microsoft.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-27T11:44:17.931Z"); return t}()), - // LastModifiedBy: to.Ptr("abc@microsoft.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("northeurope"), - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DiscoveryConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDiscovery), - // AppLocation: to.Ptr("westeurope"), - // CentralServerVMID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg-infra/providers/Microsoft.Compute/virtualMachines/q20ascsvm0"), - // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ - // Name: to.Ptr("mrg-Q20-5b0097"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetSapSupportedSKUResponse{ + // SAPSupportedResourceSKUsResult: &armworkloadssapvirtualinstance.SAPSupportedResourceSKUsResult{ + // SupportedSKUs: []*armworkloadssapvirtualinstance.SAPSupportedSKU{ + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(false), + // VMSKU: to.Ptr("Standard_E4ds_v4"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(false), + // VMSKU: to.Ptr("Standard_E8ds_v4"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(false), + // VMSKU: to.Ptr("Standard_E16ds_v4"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(false), + // VMSKU: to.Ptr("Standard_E20ds_v4"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(false), + // VMSKU: to.Ptr("Standard_E32ds_v4"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(false), + // VMSKU: to.Ptr("Standard_E48ds_v4"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(false), + // VMSKU: to.Ptr("Standard_E64ds_v4"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M32Is"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M32ts"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M64Is"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M64ms"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M64s"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M128ms"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M128s"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M208ms_v2"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M208s_v2"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M416ms_v2"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M416s_v2"), + // }, // }, - // ManagedResourcesNetworkAccessType: to.Ptr(armworkloadssapvirtualinstance.ManagedResourcesNetworkAccessTypePrivate), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Get_ACSSInstallationBlocked.json -func ExampleSAPVirtualInstancesClient_Get_sapVirtualInstancesGetWithAcssInstallationBlocked() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_InvokeSapSupportedSku_DistributedHA_AvSet.json +func ExampleSAPVirtualInstancesClient_GetSapSupportedSKU_sapSupportedSkUsForDistributedHaEnvironmentWithAvailabilitySet() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewSAPVirtualInstancesClient().Get(ctx, "test-rg", "X00", nil) + res, err := clientFactory.NewSAPVirtualInstancesClient().GetSapSupportedSKU(ctx, "centralus", armworkloadssapvirtualinstance.SAPSupportedSKUsRequest{ + AppLocation: to.Ptr("eastus"), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilitySet), + }, 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](10), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId3"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/galleries/testgallery/images/rhelimagetest/versions/0.0.1"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_D8s_v3"), - // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId1"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/galleries/testgallery/images/rhelimagetest/versions/0.0.1"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_D8s_v3"), - // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId2"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/galleries/testgallery/images/rhelimagetest/versions/0.0.1"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_D8s_v3"), - // }, - // }, + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetSapSupportedSKUResponse{ + // SAPSupportedResourceSKUsResult: &armworkloadssapvirtualinstance.SAPSupportedResourceSKUsResult{ + // SupportedSKUs: []*armworkloadssapvirtualinstance.SAPSupportedSKU{ + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(false), + // VMSKU: to.Ptr("Standard_E4ds_v4"), // }, - // SoftwareConfiguration: &armworkloadssapvirtualinstance.ServiceInitiatedSoftwareConfiguration{ - // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeServiceInitiated), - // BomURL: to.Ptr("https://myaccount.blob.core.windows.net/mycontainer/myblob"), - // SapBitsStorageAccountID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/ajgupt-test/providers/Microsoft.Storage/storageAccounts/ajguptsavnet"), - // SapFqdn: to.Ptr("sapsystem.contoso.net"), - // SoftwareVersion: to.Ptr("SAP S/4HANA 2020 FPS01"), + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(false), + // VMSKU: to.Ptr("Standard_E8ds_v4"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(false), + // VMSKU: to.Ptr("Standard_E16ds_v4"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(false), + // VMSKU: to.Ptr("Standard_E20ds_v4"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(false), + // VMSKU: to.Ptr("Standard_E32ds_v4"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(false), + // VMSKU: to.Ptr("Standard_E48ds_v4"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(false), + // VMSKU: to.Ptr("Standard_E64ds_v4"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M32Is"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M32ts"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M64Is"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M64ms"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M64s"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M128ms"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M128s"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M208ms_v2"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M208s_v2"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M416ms_v2"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M416s_v2"), // }, // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ - // Name: to.Ptr("mrg-x00-6d875e77-e412-4d7d-9af4-8895278b4443"), - // }, - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateACSSInstallationBlocked), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Get.json -func ExampleSAPVirtualInstancesClient_Get_sapVirtualInstancesGet() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_InvokeSapSupportedSku_DistributedHA_AvZone.json +func ExampleSAPVirtualInstancesClient_GetSapSupportedSKU_sapSupportedSkusForHaWithAvailabilityZone() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewSAPVirtualInstancesClient().Get(ctx, "test-rg", "X00", nil) + res, err := clientFactory.NewSAPVirtualInstancesClient().GetSapSupportedSKU(ctx, "centralus", armworkloadssapvirtualinstance.SAPSupportedSKUsRequest{ + AppLocation: to.Ptr("eastus"), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), + }, 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](10), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId3"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_D8s_v3"), - // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId1"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_D8s_v3"), - // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId2"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_D8s_v3"), - // }, - // }, + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetSapSupportedSKUResponse{ + // SAPSupportedResourceSKUsResult: &armworkloadssapvirtualinstance.SAPSupportedResourceSKUsResult{ + // SupportedSKUs: []*armworkloadssapvirtualinstance.SAPSupportedSKU{ + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_E32ds_v4"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_E48ds_v4"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_E64ds_v4"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M32Is"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M32ts"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M64Is"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M64ms"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M64s"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M128ms"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M128s"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M208ms_v2"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M208s_v2"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M416ms_v2"), // }, - // SoftwareConfiguration: &armworkloadssapvirtualinstance.ServiceInitiatedSoftwareConfiguration{ - // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeServiceInitiated), - // BomURL: to.Ptr("https://myaccount.blob.core.windows.net/mycontainer/myblob"), - // SapBitsStorageAccountID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/ajgupt-test/providers/Microsoft.Storage/storageAccounts/ajguptsavnet"), - // SapFqdn: to.Ptr("sapsystem.contoso.net"), - // SoftwareVersion: to.Ptr("SAP S/4HANA 2020 FPS01"), + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M416s_v2"), // }, // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ - // Name: to.Ptr("mrg-x00-6d875e77-e412-4d7d-9af4-8895278b4443"), - // }, - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_TrustedAccessEnable_Update.json -func ExampleSAPVirtualInstancesClient_BeginUpdate_sapVirtualInstancesTrustedAccessEnableUpdate() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_InvokeSapSupportedSku_SingleServer.json +func ExampleSAPVirtualInstancesClient_GetSapSupportedSKU_sapSupportedSkUsForSingleServer() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginUpdate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.UpdateSAPVirtualInstanceRequest{ - Identity: &armworkloadssapvirtualinstance.UserAssignedServiceIdentity{ - Type: to.Ptr(armworkloadssapvirtualinstance.ManagedServiceIdentityTypeNone), - }, - Properties: &armworkloadssapvirtualinstance.UpdateSAPVirtualInstanceProperties{ - ManagedResourcesNetworkAccessType: to.Ptr(armworkloadssapvirtualinstance.ManagedResourcesNetworkAccessTypePrivate), - }, - Tags: map[string]*string{ - "key1": to.Ptr("svi1"), - }, + res, err := clientFactory.NewSAPVirtualInstancesClient().GetSapSupportedSKU(ctx, "centralus", armworkloadssapvirtualinstance.SAPSupportedSKUsRequest{ + AppLocation: to.Ptr("eastus"), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("svi1"), - // }, - // Identity: &armworkloadssapvirtualinstance.UserAssignedServiceIdentity{ - // Type: to.Ptr(armworkloadssapvirtualinstance.ManagedServiceIdentityTypeNone), - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), - // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ - // Name: to.Ptr("mrg-x00-6d875e77-e412-4d7d-9af4-8895278b4443"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetSapSupportedSKUResponse{ + // SAPSupportedResourceSKUsResult: &armworkloadssapvirtualinstance.SAPSupportedResourceSKUsResult{ + // SupportedSKUs: []*armworkloadssapvirtualinstance.SAPSupportedSKU{ + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(false), + // VMSKU: to.Ptr("Standard_E32ds_v4"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(false), + // VMSKU: to.Ptr("Standard_E48ds_v4"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(false), + // VMSKU: to.Ptr("Standard_E64ds_v4"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M32ts"), + // }, // }, - // ManagedResourcesNetworkAccessType: to.Ptr(armworkloadssapvirtualinstance.ManagedResourcesNetworkAccessTypePrivate), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateInfrastructureDeploymentPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusStarting), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Update.json -func ExampleSAPVirtualInstancesClient_BeginUpdate_sapVirtualInstancesUpdate() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_InvokeSizingRecommendations_S4HANA_Distributed.json +func ExampleSAPVirtualInstancesClient_GetSizingRecommendations_sapSizingRecommendationsForNonHaDistributedSystem() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginUpdate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.UpdateSAPVirtualInstanceRequest{ - Identity: &armworkloadssapvirtualinstance.UserAssignedServiceIdentity{ - Type: to.Ptr(armworkloadssapvirtualinstance.ManagedServiceIdentityTypeNone), - }, - Tags: map[string]*string{ - "key1": to.Ptr("svi1"), - }, + res, err := clientFactory.NewSAPVirtualInstancesClient().GetSizingRecommendations(ctx, "centralus", armworkloadssapvirtualinstance.SAPSizingRecommendationRequest{ + AppLocation: to.Ptr("eastus"), + Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + Saps: to.Ptr[int64](20000), + DbMemory: to.Ptr[int64](1024), + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + DbScaleMethod: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseScaleMethodScaleUp), }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - res, err := poller.PollUntilDone(ctx, nil) + // 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 = armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetSizingRecommendationsResponse{ + // ThreeTierRecommendationResult: &armworkloadssapvirtualinstance.ThreeTierRecommendationResult{ + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // ApplicationServerVMSKU: to.Ptr("Standard_E8ds_v4"), + // ApplicationServerInstanceCount: to.Ptr[int64](2), + // CentralServerVMSKU: to.Ptr("Standard_E4ds_v4"), + // CentralServerInstanceCount: to.Ptr[int64](1), + // DbVMSKU: to.Ptr("Standard_M64s"), + // DatabaseInstanceCount: to.Ptr[int64](1), + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapVirtualInstances_InvokeSizingRecommendations_S4HANA_HA_AvSet.json +func ExampleSAPVirtualInstancesClient_GetSizingRecommendations_sapSizingRecommendationsForHaWithAvailabilitySet() { + cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSAPVirtualInstancesClient().GetSizingRecommendations(ctx, "centralus", armworkloadssapvirtualinstance.SAPSizingRecommendationRequest{ + AppLocation: to.Ptr("eastus"), + Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + Saps: to.Ptr[int64](75000), + DbMemory: to.Ptr[int64](1024), + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + DbScaleMethod: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseScaleMethodScaleUp), + HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilitySet), + }, 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("svi1"), - // }, - // Identity: &armworkloadssapvirtualinstance.UserAssignedServiceIdentity{ - // Type: to.Ptr(armworkloadssapvirtualinstance.ManagedServiceIdentityTypeNone), - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), - // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ - // Name: to.Ptr("mrg-x00-6d875e77-e412-4d7d-9af4-8895278b4443"), - // }, - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateInfrastructureDeploymentPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusStarting), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetSizingRecommendationsResponse{ + // ThreeTierRecommendationResult: &armworkloadssapvirtualinstance.ThreeTierRecommendationResult{ + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // ApplicationServerVMSKU: to.Ptr("Standard_E16ds_v4"), + // ApplicationServerInstanceCount: to.Ptr[int64](3), + // CentralServerVMSKU: to.Ptr("Standard_E8ds_v4"), + // CentralServerInstanceCount: to.Ptr[int64](2), + // DbVMSKU: to.Ptr("Standard_M64s"), + // DatabaseInstanceCount: to.Ptr[int64](2), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Delete.json -func ExampleSAPVirtualInstancesClient_BeginDelete() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_InvokeSizingRecommendations_S4HANA_HA_AvZone.json +func ExampleSAPVirtualInstancesClient_GetSizingRecommendations_sapSizingRecommendationsForHaWithAvailabilityZone() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginDelete(ctx, "test-rg", "X00", nil) + res, err := clientFactory.NewSAPVirtualInstancesClient().GetSizingRecommendations(ctx, "centralus", armworkloadssapvirtualinstance.SAPSizingRecommendationRequest{ + AppLocation: to.Ptr("eastus"), + Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + Saps: to.Ptr[int64](75000), + DbMemory: to.Ptr[int64](1024), + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + DbScaleMethod: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseScaleMethodScaleUp), + HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - _, err = poller.PollUntilDone(ctx, nil) + // 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 = armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetSizingRecommendationsResponse{ + // ThreeTierRecommendationResult: &armworkloadssapvirtualinstance.ThreeTierRecommendationResult{ + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // ApplicationServerVMSKU: to.Ptr("Standard_E8ds_v4"), + // ApplicationServerInstanceCount: to.Ptr[int64](6), + // CentralServerVMSKU: to.Ptr("Standard_E4ds_v4"), + // CentralServerInstanceCount: to.Ptr[int64](2), + // DbVMSKU: to.Ptr("Standard_M64s"), + // DatabaseInstanceCount: to.Ptr[int64](2), + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapVirtualInstances_InvokeSizingRecommendations_S4HANA_SingleServer.json +func ExampleSAPVirtualInstancesClient_GetSizingRecommendations_sapSizingRecommendationsForSingleServer() { + cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSAPVirtualInstancesClient().GetSizingRecommendations(ctx, "centralus", armworkloadssapvirtualinstance.SAPSizingRecommendationRequest{ + AppLocation: to.Ptr("eastus"), + Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), + Saps: to.Ptr[int64](60000), + DbMemory: to.Ptr[int64](2000), + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + DbScaleMethod: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseScaleMethodScaleUp), + }, 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 = armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetSizingRecommendationsResponse{ + // SingleServerRecommendationResult: &armworkloadssapvirtualinstance.SingleServerRecommendationResult{ + // VMSKU: to.Ptr("Standard_M128s"), + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_ListByResourceGroup.json +// Generated from example definition: 2024-09-01/SapVirtualInstances_ListByResourceGroup.json func ExampleSAPVirtualInstancesClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("6d875e77-e412-4d7d-9af4-8895278b4443", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -7361,259 +8699,244 @@ func ExampleSAPVirtualInstancesClient_NewListByResourceGroupPager() { _ = 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.SAPVirtualInstanceList = armworkloadssapvirtualinstance.SAPVirtualInstanceList{ - // Value: []*armworkloadssapvirtualinstance.SAPVirtualInstance{ - // { - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](10), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId3"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // page = armworkloadssapvirtualinstance.SAPVirtualInstancesClientListByResourceGroupResponse{ + // SAPVirtualInstanceListResult: armworkloadssapvirtualinstance.SAPVirtualInstanceListResult{ + // Value: []*armworkloadssapvirtualinstance.SAPVirtualInstance{ + // { + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](10), + // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId3"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId1"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId1"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId2"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId2"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // VMSize: to.Ptr("Standard_D8s_v3"), // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // }, + // SoftwareConfiguration: &armworkloadssapvirtualinstance.ServiceInitiatedSoftwareConfiguration{ + // BomURL: to.Ptr("https://myaccount.blob.core.windows.net/mycontainer/myblob"), + // SapBitsStorageAccountID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/ajgupt-test/providers/Microsoft.Storage/storageAccounts/ajguptsavnet"), + // SapFqdn: to.Ptr("sapsystem.contoso.net"), + // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeServiceInitiated), + // SoftwareVersion: to.Ptr("SAP S/4HANA 2020 FPS01"), // }, // }, - // SoftwareConfiguration: &armworkloadssapvirtualinstance.ServiceInitiatedSoftwareConfiguration{ - // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeServiceInitiated), - // BomURL: to.Ptr("https://myaccount.blob.core.windows.net/mycontainer/myblob"), - // SapBitsStorageAccountID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/ajgupt-test/providers/Microsoft.Storage/storageAccounts/ajguptsavnet"), - // SapFqdn: to.Ptr("sapsystem.contoso.net"), - // SoftwareVersion: to.Ptr("SAP S/4HANA 2020 FPS01"), + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ + // Name: to.Ptr("mrg-x00-6d875e77-e412-4d7d-9af4-8895278b4443"), // }, + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ - // Name: to.Ptr("mrg-x00-6d875e77-e412-4d7d-9af4-8895278b4443"), + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), - // }, - // }, - // { - // Name: to.Ptr("X01"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X01"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](10), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId3"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // { + // Name: to.Ptr("X01"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X01"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](10), + // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId3"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId1"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId1"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId2"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId2"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // VMSize: to.Ptr("Standard_D8s_v3"), // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // }, + // SoftwareConfiguration: &armworkloadssapvirtualinstance.ServiceInitiatedSoftwareConfiguration{ + // BomURL: to.Ptr("https://myaccount.blob.core.windows.net/mycontainer/myblob"), + // SapBitsStorageAccountID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/ajgupt-test/providers/Microsoft.Storage/storageAccounts/ajguptsavnet"), + // SapFqdn: to.Ptr("sapsystem.contoso.net"), + // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeServiceInitiated), + // SoftwareVersion: to.Ptr("SAP S/4HANA 2020 FPS01"), // }, // }, - // SoftwareConfiguration: &armworkloadssapvirtualinstance.ServiceInitiatedSoftwareConfiguration{ - // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeServiceInitiated), - // BomURL: to.Ptr("https://myaccount.blob.core.windows.net/mycontainer/myblob"), - // SapBitsStorageAccountID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/ajgupt-test/providers/Microsoft.Storage/storageAccounts/ajguptsavnet"), - // SapFqdn: to.Ptr("sapsystem.contoso.net"), - // SoftwareVersion: to.Ptr("SAP S/4HANA 2020 FPS01"), - // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), // }, - // }}, + // }, + // }, // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_ListBySubscription.json +// Generated from example definition: 2024-09-01/SapVirtualInstances_ListBySubscription.json func ExampleSAPVirtualInstancesClient_NewListBySubscriptionPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("6d875e77-e412-4d7d-9af4-8895278b4443", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -7628,263 +8951,323 @@ func ExampleSAPVirtualInstancesClient_NewListBySubscriptionPager() { _ = 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.SAPVirtualInstanceList = armworkloadssapvirtualinstance.SAPVirtualInstanceList{ - // Value: []*armworkloadssapvirtualinstance.SAPVirtualInstance{ - // { - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](10), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId3"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // page = armworkloadssapvirtualinstance.SAPVirtualInstancesClientListBySubscriptionResponse{ + // SAPVirtualInstanceListResult: armworkloadssapvirtualinstance.SAPVirtualInstanceListResult{ + // Value: []*armworkloadssapvirtualinstance.SAPVirtualInstance{ + // { + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](10), + // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId3"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId1"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId1"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId2"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId2"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // VMSize: to.Ptr("Standard_D8s_v3"), // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // }, + // SoftwareConfiguration: &armworkloadssapvirtualinstance.ServiceInitiatedSoftwareConfiguration{ + // BomURL: to.Ptr("https://myaccount.blob.core.windows.net/mycontainer/myblob"), + // SapBitsStorageAccountID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/ajgupt-test/providers/Microsoft.Storage/storageAccounts/ajguptsavnet"), + // SapFqdn: to.Ptr("sapsystem.contoso.net"), + // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeServiceInitiated), + // SoftwareVersion: to.Ptr("SAP S/4HANA 2020 FPS01"), // }, // }, - // SoftwareConfiguration: &armworkloadssapvirtualinstance.ServiceInitiatedSoftwareConfiguration{ - // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeServiceInitiated), - // BomURL: to.Ptr("https://myaccount.blob.core.windows.net/mycontainer/myblob"), - // SapBitsStorageAccountID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/ajgupt-test/providers/Microsoft.Storage/storageAccounts/ajguptsavnet"), - // SapFqdn: to.Ptr("sapsystem.contoso.net"), - // SoftwareVersion: to.Ptr("SAP S/4HANA 2020 FPS01"), + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ + // Name: to.Ptr("mrg-x00-6d875e77-e412-4d7d-9af4-8895278b4443"), // }, + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ - // Name: to.Ptr("mrg-x00-6d875e77-e412-4d7d-9af4-8895278b4443"), + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), - // }, - // }, - // { - // Name: to.Ptr("X01"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X01"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](10), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId3"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // { + // Name: to.Ptr("X01"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X01"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](10), + // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId3"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId1"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId1"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId2"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId2"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // VMSize: to.Ptr("Standard_D8s_v3"), // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // }, + // SoftwareConfiguration: &armworkloadssapvirtualinstance.ServiceInitiatedSoftwareConfiguration{ + // BomURL: to.Ptr("https://myaccount.blob.core.windows.net/mycontainer/myblob"), + // SapBitsStorageAccountID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/ajgupt-test/providers/Microsoft.Storage/storageAccounts/ajguptsavnet"), + // SapFqdn: to.Ptr("sapsystem.contoso.net"), + // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeServiceInitiated), + // SoftwareVersion: to.Ptr("SAP S/4HANA 2020 FPS01"), // }, // }, - // SoftwareConfiguration: &armworkloadssapvirtualinstance.ServiceInitiatedSoftwareConfiguration{ - // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeServiceInitiated), - // BomURL: to.Ptr("https://myaccount.blob.core.windows.net/mycontainer/myblob"), - // SapBitsStorageAccountID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/ajgupt-test/providers/Microsoft.Storage/storageAccounts/ajguptsavnet"), - // SapFqdn: to.Ptr("sapsystem.contoso.net"), - // SoftwareVersion: to.Ptr("SAP S/4HANA 2020 FPS01"), - // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), // }, - // }}, + // }, + // }, // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Start.json -func ExampleSAPVirtualInstancesClient_BeginStart_startTheSapSystem() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_Start.json +func ExampleSAPVirtualInstancesClient_BeginStart_sapVirtualInstancesStart() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginStart(ctx, "test-rg", "X00", &SAPVirtualInstancesClientBeginStartOptions{ + body: &armworkloadssapvirtualinstance.StartRequest{ + StartVM: to.Ptr(true), + }}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %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 = armworkloadssapvirtualinstance.SAPVirtualInstancesClientStartResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("1e4193c3-206e-4916-b124-1da16175eb0e"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/operations/locations/centralus/1e4193c3-206e-4916-b124-1da16175eb0e"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapVirtualInstances_StartWithInfraOperations.json +func ExampleSAPVirtualInstancesClient_BeginStart_sapVirtualInstancesStartWithInfraOperations() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginStart(ctx, "test-rg", "X00", &SAPVirtualInstancesClientBeginStartOptions{ + body: &armworkloadssapvirtualinstance.StartRequest{ + StartVM: to.Ptr(true), + }}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %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 = armworkloadssapvirtualinstance.SAPVirtualInstancesClientStartResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("1e4193c3-206e-4916-b124-1da16175eb0e"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/operations/locations/centralus/1e4193c3-206e-4916-b124-1da16175eb0e"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapVirtualInstances_SoftStop.json +func ExampleSAPVirtualInstancesClient_BeginStop_softStopOfSapVirtualInstancesStop() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginStart(ctx, "test-rg", "X00", &armworkloadssapvirtualinstance.SAPVirtualInstancesClientBeginStartOptions{Body: nil}) + poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginStop(ctx, "test-rg", "X00", &SAPVirtualInstancesClientBeginStopOptions{ + body: &armworkloadssapvirtualinstance.StopRequest{ + SoftStopTimeoutSeconds: to.Ptr[int64](300), + }}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -7895,30 +9278,33 @@ func ExampleSAPVirtualInstancesClient_BeginStart_startTheSapSystem() { // 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.OperationStatusResult = armworkloadssapvirtualinstance.OperationStatusResult{ - // Name: to.Ptr("1e4193c3-206e-4916-b124-1da16175eb0e"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/operations/locations/centralus/1e4193c3-206e-4916-b124-1da16175eb0e"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientStopResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("1e4193c3-206e-4916-b124-1da16175eb0e"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/operations/locations/centralus/1e4193c3-206e-4916-b124-1da16175eb0e"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), + // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Start_WithInfraOperations.json -func ExampleSAPVirtualInstancesClient_BeginStart_startTheVirtualMachinesAndTheSapSystem() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_SoftStopVMAndSystem.json +func ExampleSAPVirtualInstancesClient_BeginStop_softStopTheVirtualMachineSAndTheSapSystemOnIt() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginStart(ctx, "test-rg", "X00", &armworkloadssapvirtualinstance.SAPVirtualInstancesClientBeginStartOptions{Body: &armworkloadssapvirtualinstance.StartRequest{ - StartVM: to.Ptr(true), - }, - }) + poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginStop(ctx, "test-rg", "X00", &SAPVirtualInstancesClientBeginStopOptions{ + body: &armworkloadssapvirtualinstance.StopRequest{ + DeallocateVM: to.Ptr(true), + SoftStopTimeoutSeconds: to.Ptr[int64](300), + }}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -7929,30 +9315,32 @@ func ExampleSAPVirtualInstancesClient_BeginStart_startTheVirtualMachinesAndTheSa // 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.OperationStatusResult = armworkloadssapvirtualinstance.OperationStatusResult{ - // Name: to.Ptr("1e4193c3-206e-4916-b124-1da16175eb0e"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/operations/locations/centralus/1e4193c3-206e-4916-b124-1da16175eb0e"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientStopResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("1e4193c3-206e-4916-b124-1da16175eb0e"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/operations/locations/centralus/1e4193c3-206e-4916-b124-1da16175eb0e"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), + // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Stop.json +// Generated from example definition: 2024-09-01/SapVirtualInstances_Stop.json func ExampleSAPVirtualInstancesClient_BeginStop_sapVirtualInstancesStop() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginStop(ctx, "test-rg", "X00", &armworkloadssapvirtualinstance.SAPVirtualInstancesClientBeginStopOptions{Body: &armworkloadssapvirtualinstance.StopRequest{ - SoftStopTimeoutSeconds: to.Ptr[int64](0), - }, - }) + poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginStop(ctx, "test-rg", "X00", &SAPVirtualInstancesClientBeginStopOptions{ + body: &armworkloadssapvirtualinstance.StopRequest{ + SoftStopTimeoutSeconds: to.Ptr[int64](0), + }}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -7963,31 +9351,144 @@ func ExampleSAPVirtualInstancesClient_BeginStop_sapVirtualInstancesStop() { // 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.OperationStatusResult = armworkloadssapvirtualinstance.OperationStatusResult{ - // Name: to.Ptr("1e4193c3-206e-4916-b124-1da16175eb0e"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/operations/locations/centralus/1e4193c3-206e-4916-b124-1da16175eb0e"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientStopResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("1e4193c3-206e-4916-b124-1da16175eb0e"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/operations/locations/centralus/1e4193c3-206e-4916-b124-1da16175eb0e"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), + // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Stop_WithInfraOperations.json +// Generated from example definition: 2024-09-01/SapVirtualInstances_StopVMAndSystem.json func ExampleSAPVirtualInstancesClient_BeginStop_stopTheVirtualMachineSAndTheSapSystemOnIt() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginStop(ctx, "test-rg", "X00", &SAPVirtualInstancesClientBeginStopOptions{ + body: &armworkloadssapvirtualinstance.StopRequest{ + DeallocateVM: to.Ptr(true), + SoftStopTimeoutSeconds: to.Ptr[int64](0), + }}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %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 = armworkloadssapvirtualinstance.SAPVirtualInstancesClientStopResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("1e4193c3-206e-4916-b124-1da16175eb0e"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/operations/locations/centralus/1e4193c3-206e-4916-b124-1da16175eb0e"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapVirtualInstances_Update.json +func ExampleSAPVirtualInstancesClient_BeginUpdate_sapVirtualInstancesUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginUpdate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.UpdateSAPVirtualInstanceRequest{ + Identity: &armworkloadssapvirtualinstance.SAPVirtualInstanceIdentity{ + Type: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceIdentityTypeNone), + }, + Properties: &armworkloadssapvirtualinstance.UpdateSAPVirtualInstanceProperties{}, + Tags: map[string]*string{ + "key1": to.Ptr("svi1"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %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 = armworkloadssapvirtualinstance.SAPVirtualInstancesClientUpdateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Identity: &armworkloadssapvirtualinstance.SAPVirtualInstanceIdentity{ + // Type: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceIdentityTypeNone), + // }, + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), + // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ + // Name: to.Ptr("mrg-x00-6d875e77-e412-4d7d-9af4-8895278b4443"), + // }, + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateInfrastructureDeploymentPending), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusStarting), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // "key1": to.Ptr("svi1"), + // }, + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapVirtualInstances_UpdateTrustedAccess.json +func ExampleSAPVirtualInstancesClient_BeginUpdate_sapVirtualInstancesTrustedAccessEnableUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginStop(ctx, "test-rg", "X00", &armworkloadssapvirtualinstance.SAPVirtualInstancesClientBeginStopOptions{Body: &armworkloadssapvirtualinstance.StopRequest{ - DeallocateVM: to.Ptr(true), - SoftStopTimeoutSeconds: to.Ptr[int64](0), - }, - }) + poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginUpdate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.UpdateSAPVirtualInstanceRequest{ + Identity: &armworkloadssapvirtualinstance.SAPVirtualInstanceIdentity{ + Type: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceIdentityTypeNone), + }, + Properties: &armworkloadssapvirtualinstance.UpdateSAPVirtualInstanceProperties{ + ManagedResourcesNetworkAccessType: to.Ptr(armworkloadssapvirtualinstance.ManagedResourcesNetworkAccessTypePrivate), + }, + Tags: map[string]*string{ + "key1": to.Ptr("svi1"), + }, + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -7998,11 +9499,41 @@ func ExampleSAPVirtualInstancesClient_BeginStop_stopTheVirtualMachineSAndTheSapS // 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.OperationStatusResult = armworkloadssapvirtualinstance.OperationStatusResult{ - // Name: to.Ptr("1e4193c3-206e-4916-b124-1da16175eb0e"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/operations/locations/centralus/1e4193c3-206e-4916-b124-1da16175eb0e"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientUpdateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Identity: &armworkloadssapvirtualinstance.SAPVirtualInstanceIdentity{ + // Type: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceIdentityTypeNone), + // }, + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), + // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ + // Name: to.Ptr("mrg-x00-6d875e77-e412-4d7d-9af4-8895278b4443"), + // }, + // ManagedResourcesNetworkAccessType: to.Ptr(armworkloadssapvirtualinstance.ManagedResourcesNetworkAccessTypePrivate), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateInfrastructureDeploymentPending), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusStarting), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // "key1": to.Ptr("svi1"), + // }, + // }, // } } diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/time_rfc3339.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/time_rfc3339.go index 09e8f6ac88ee..8bb5d8bfeb1d 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/time_rfc3339.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/time_rfc3339.go @@ -1,10 +1,6 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armworkloadssapvirtualinstance @@ -60,6 +56,9 @@ func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } tzOffset := tzOffsetRegex.Match(data) hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") var layout string diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/tsp-location.yaml b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/tsp-location.yaml new file mode 100644 index 000000000000..1c7fac7d6ee1 --- /dev/null +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/workloads/Workloads.SAPVirtualInstance.Management +commit: df55cd8178ddd870dbd0c3b1e25c80e3ff48826c +repo: Azure/azure-rest-api-specs +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/workloads_client.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/workloads_client.go deleted file mode 100644 index 41f67e9e5343..000000000000 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/workloads_client.go +++ /dev/null @@ -1,309 +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 armworkloadssapvirtualinstance - -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" -) - -// WorkloadsClient contains the methods for the WorkloadsClient group. -// Don't use this type directly, use NewWorkloadsClient() instead. -type WorkloadsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewWorkloadsClient creates a new instance of WorkloadsClient 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 NewWorkloadsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkloadsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &WorkloadsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// SAPAvailabilityZoneDetails - Get the recommended SAP Availability Zone Pair Details for your region. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-10-01-preview -// - location - The name of Azure region. -// - options - WorkloadsClientSAPAvailabilityZoneDetailsOptions contains the optional parameters for the WorkloadsClient.SAPAvailabilityZoneDetails -// method. -func (client *WorkloadsClient) SAPAvailabilityZoneDetails(ctx context.Context, location string, options *WorkloadsClientSAPAvailabilityZoneDetailsOptions) (WorkloadsClientSAPAvailabilityZoneDetailsResponse, error) { - var err error - const operationName = "WorkloadsClient.SAPAvailabilityZoneDetails" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.sapAvailabilityZoneDetailsCreateRequest(ctx, location, options) - if err != nil { - return WorkloadsClientSAPAvailabilityZoneDetailsResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return WorkloadsClientSAPAvailabilityZoneDetailsResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return WorkloadsClientSAPAvailabilityZoneDetailsResponse{}, err - } - resp, err := client.sapAvailabilityZoneDetailsHandleResponse(httpResp) - return resp, err -} - -// sapAvailabilityZoneDetailsCreateRequest creates the SAPAvailabilityZoneDetails request. -func (client *WorkloadsClient) sapAvailabilityZoneDetailsCreateRequest(ctx context.Context, location string, options *WorkloadsClientSAPAvailabilityZoneDetailsOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getAvailabilityZoneDetails" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if location == "" { - return nil, errors.New("parameter location cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) - 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 options != nil && options.SAPAvailabilityZoneDetails != nil { - if err := runtime.MarshalAsJSON(req, *options.SAPAvailabilityZoneDetails); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// sapAvailabilityZoneDetailsHandleResponse handles the SAPAvailabilityZoneDetails response. -func (client *WorkloadsClient) sapAvailabilityZoneDetailsHandleResponse(resp *http.Response) (WorkloadsClientSAPAvailabilityZoneDetailsResponse, error) { - result := WorkloadsClientSAPAvailabilityZoneDetailsResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SAPAvailabilityZoneDetailsResult); err != nil { - return WorkloadsClientSAPAvailabilityZoneDetailsResponse{}, err - } - return result, nil -} - -// SAPDiskConfigurations - Get the SAP Disk Configuration Layout prod/non-prod SAP System. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-10-01-preview -// - location - The name of Azure region. -// - options - WorkloadsClientSAPDiskConfigurationsOptions contains the optional parameters for the WorkloadsClient.SAPDiskConfigurations -// method. -func (client *WorkloadsClient) SAPDiskConfigurations(ctx context.Context, location string, options *WorkloadsClientSAPDiskConfigurationsOptions) (WorkloadsClientSAPDiskConfigurationsResponse, error) { - var err error - const operationName = "WorkloadsClient.SAPDiskConfigurations" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.sapDiskConfigurationsCreateRequest(ctx, location, options) - if err != nil { - return WorkloadsClientSAPDiskConfigurationsResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return WorkloadsClientSAPDiskConfigurationsResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return WorkloadsClientSAPDiskConfigurationsResponse{}, err - } - resp, err := client.sapDiskConfigurationsHandleResponse(httpResp) - return resp, err -} - -// sapDiskConfigurationsCreateRequest creates the SAPDiskConfigurations request. -func (client *WorkloadsClient) sapDiskConfigurationsCreateRequest(ctx context.Context, location string, options *WorkloadsClientSAPDiskConfigurationsOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getDiskConfigurations" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if location == "" { - return nil, errors.New("parameter location cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) - 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 options != nil && options.SAPDiskConfigurations != nil { - if err := runtime.MarshalAsJSON(req, *options.SAPDiskConfigurations); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// sapDiskConfigurationsHandleResponse handles the SAPDiskConfigurations response. -func (client *WorkloadsClient) sapDiskConfigurationsHandleResponse(resp *http.Response) (WorkloadsClientSAPDiskConfigurationsResponse, error) { - result := WorkloadsClientSAPDiskConfigurationsResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SAPDiskConfigurationsResult); err != nil { - return WorkloadsClientSAPDiskConfigurationsResponse{}, err - } - return result, nil -} - -// SAPSizingRecommendations - Get SAP sizing recommendations by providing input SAPS for application tier and memory required -// for database tier -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-10-01-preview -// - location - The name of Azure region. -// - options - WorkloadsClientSAPSizingRecommendationsOptions contains the optional parameters for the WorkloadsClient.SAPSizingRecommendations -// method. -func (client *WorkloadsClient) SAPSizingRecommendations(ctx context.Context, location string, options *WorkloadsClientSAPSizingRecommendationsOptions) (WorkloadsClientSAPSizingRecommendationsResponse, error) { - var err error - const operationName = "WorkloadsClient.SAPSizingRecommendations" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.sapSizingRecommendationsCreateRequest(ctx, location, options) - if err != nil { - return WorkloadsClientSAPSizingRecommendationsResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return WorkloadsClientSAPSizingRecommendationsResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return WorkloadsClientSAPSizingRecommendationsResponse{}, err - } - resp, err := client.sapSizingRecommendationsHandleResponse(httpResp) - return resp, err -} - -// sapSizingRecommendationsCreateRequest creates the SAPSizingRecommendations request. -func (client *WorkloadsClient) sapSizingRecommendationsCreateRequest(ctx context.Context, location string, options *WorkloadsClientSAPSizingRecommendationsOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getSizingRecommendations" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if location == "" { - return nil, errors.New("parameter location cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) - 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 options != nil && options.SAPSizingRecommendation != nil { - if err := runtime.MarshalAsJSON(req, *options.SAPSizingRecommendation); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// sapSizingRecommendationsHandleResponse handles the SAPSizingRecommendations response. -func (client *WorkloadsClient) sapSizingRecommendationsHandleResponse(resp *http.Response) (WorkloadsClientSAPSizingRecommendationsResponse, error) { - result := WorkloadsClientSAPSizingRecommendationsResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result); err != nil { - return WorkloadsClientSAPSizingRecommendationsResponse{}, err - } - return result, nil -} - -// SAPSupportedSKU - Get a list of SAP supported SKUs for ASCS, Application and Database tier. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-10-01-preview -// - location - The name of Azure region. -// - options - WorkloadsClientSAPSupportedSKUOptions contains the optional parameters for the WorkloadsClient.SAPSupportedSKU -// method. -func (client *WorkloadsClient) SAPSupportedSKU(ctx context.Context, location string, options *WorkloadsClientSAPSupportedSKUOptions) (WorkloadsClientSAPSupportedSKUResponse, error) { - var err error - const operationName = "WorkloadsClient.SAPSupportedSKU" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.sapSupportedSKUCreateRequest(ctx, location, options) - if err != nil { - return WorkloadsClientSAPSupportedSKUResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return WorkloadsClientSAPSupportedSKUResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return WorkloadsClientSAPSupportedSKUResponse{}, err - } - resp, err := client.sapSupportedSKUHandleResponse(httpResp) - return resp, err -} - -// sapSupportedSKUCreateRequest creates the SAPSupportedSKU request. -func (client *WorkloadsClient) sapSupportedSKUCreateRequest(ctx context.Context, location string, options *WorkloadsClientSAPSupportedSKUOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getSapSupportedSku" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if location == "" { - return nil, errors.New("parameter location cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) - 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 options != nil && options.SAPSupportedSKU != nil { - if err := runtime.MarshalAsJSON(req, *options.SAPSupportedSKU); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// sapSupportedSKUHandleResponse handles the SAPSupportedSKU response. -func (client *WorkloadsClient) sapSupportedSKUHandleResponse(resp *http.Response) (WorkloadsClientSAPSupportedSKUResponse, error) { - result := WorkloadsClientSAPSupportedSKUResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SAPSupportedResourceSKUsResult); err != nil { - return WorkloadsClientSAPSupportedSKUResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/workloads_client_example_test.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/workloads_client_example_test.go deleted file mode 100644 index 6df69bcbd252..000000000000 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/workloads_client_example_test.go +++ /dev/null @@ -1,1194 +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 armworkloadssapvirtualinstance_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPSizingRecommendations_S4HANA_Distributed.json -func ExampleWorkloadsClient_SAPSizingRecommendations_sapSizingRecommendationsS4HanaDistributed() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkloadsClient().SAPSizingRecommendations(ctx, "centralus", &armworkloadssapvirtualinstance.WorkloadsClientSAPSizingRecommendationsOptions{SAPSizingRecommendation: 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 = armworkloadssapvirtualinstance.WorkloadsClientSAPSizingRecommendationsResponse{ - // SAPSizingRecommendationResultClassification: &armworkloadssapvirtualinstance.ThreeTierRecommendationResult{ - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServerInstanceCount: to.Ptr[int64](2), - // ApplicationServerVMSKU: to.Ptr("Standard_E8ds_v4"), - // CentralServerInstanceCount: to.Ptr[int64](1), - // CentralServerVMSKU: to.Ptr("Standard_E4ds_v4"), - // DatabaseInstanceCount: to.Ptr[int64](1), - // DbVMSKU: to.Ptr("Standard_M64s"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPSizingRecommendations_S4HANA_HA_AvSet.json -func ExampleWorkloadsClient_SAPSizingRecommendations_sapSizingRecommendationsS4HanaDistributedHaAvSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkloadsClient().SAPSizingRecommendations(ctx, "centralus", &armworkloadssapvirtualinstance.WorkloadsClientSAPSizingRecommendationsOptions{SAPSizingRecommendation: 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 = armworkloadssapvirtualinstance.WorkloadsClientSAPSizingRecommendationsResponse{ - // SAPSizingRecommendationResultClassification: &armworkloadssapvirtualinstance.ThreeTierRecommendationResult{ - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServerInstanceCount: to.Ptr[int64](3), - // ApplicationServerVMSKU: to.Ptr("Standard_E16ds_v4"), - // CentralServerInstanceCount: to.Ptr[int64](2), - // CentralServerVMSKU: to.Ptr("Standard_E8ds_v4"), - // DatabaseInstanceCount: to.Ptr[int64](2), - // DbVMSKU: to.Ptr("Standard_M64s"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPSizingRecommendations_S4HANA_HA_AvZone.json -func ExampleWorkloadsClient_SAPSizingRecommendations_sapSizingRecommendationsS4HanaDistributedHaAvZone() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkloadsClient().SAPSizingRecommendations(ctx, "centralus", &armworkloadssapvirtualinstance.WorkloadsClientSAPSizingRecommendationsOptions{SAPSizingRecommendation: 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 = armworkloadssapvirtualinstance.WorkloadsClientSAPSizingRecommendationsResponse{ - // SAPSizingRecommendationResultClassification: &armworkloadssapvirtualinstance.ThreeTierRecommendationResult{ - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServerInstanceCount: to.Ptr[int64](6), - // ApplicationServerVMSKU: to.Ptr("Standard_E8ds_v4"), - // CentralServerInstanceCount: to.Ptr[int64](2), - // CentralServerVMSKU: to.Ptr("Standard_E4ds_v4"), - // DatabaseInstanceCount: to.Ptr[int64](2), - // DbVMSKU: to.Ptr("Standard_M64s"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPSizingRecommendations_S4HANA_SingleServer.json -func ExampleWorkloadsClient_SAPSizingRecommendations_sapSizingRecommendationsS4HanaSingleServer() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkloadsClient().SAPSizingRecommendations(ctx, "centralus", &armworkloadssapvirtualinstance.WorkloadsClientSAPSizingRecommendationsOptions{SAPSizingRecommendation: 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 = armworkloadssapvirtualinstance.WorkloadsClientSAPSizingRecommendationsResponse{ - // SAPSizingRecommendationResultClassification: &armworkloadssapvirtualinstance.SingleServerRecommendationResult{ - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), - // VMSKU: to.Ptr("Standard_M128s"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPSupportedSkus_Distributed.json -func ExampleWorkloadsClient_SAPSupportedSKU_sapSupportedSkusDistributed() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkloadsClient().SAPSupportedSKU(ctx, "centralus", &armworkloadssapvirtualinstance.WorkloadsClientSAPSupportedSKUOptions{SAPSupportedSKU: 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.SAPSupportedResourceSKUsResult = armworkloadssapvirtualinstance.SAPSupportedResourceSKUsResult{ - // SupportedSKUs: []*armworkloadssapvirtualinstance.SAPSupportedSKU{ - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E4ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E8ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E16ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E20ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E32ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E48ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E64ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M32Is"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M32ts"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M64Is"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M64ms"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M64s"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M128ms"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M128s"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M208ms_v2"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M208s_v2"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M416ms_v2"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M416s_v2"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPSupportedSkus_DistributedHA_AvSet.json -func ExampleWorkloadsClient_SAPSupportedSKU_sapSupportedSkusDistributedHaAvSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkloadsClient().SAPSupportedSKU(ctx, "centralus", &armworkloadssapvirtualinstance.WorkloadsClientSAPSupportedSKUOptions{SAPSupportedSKU: 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.SAPSupportedResourceSKUsResult = armworkloadssapvirtualinstance.SAPSupportedResourceSKUsResult{ - // SupportedSKUs: []*armworkloadssapvirtualinstance.SAPSupportedSKU{ - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E4ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E8ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E16ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E20ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E32ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E48ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E64ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M32Is"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M32ts"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M64Is"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M64ms"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M64s"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M128ms"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M128s"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M208ms_v2"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M208s_v2"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M416ms_v2"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M416s_v2"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPSupportedSkus_DistributedHA_AvZone.json -func ExampleWorkloadsClient_SAPSupportedSKU_sapSupportedSkusDistributedHaAvZone() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkloadsClient().SAPSupportedSKU(ctx, "centralus", &armworkloadssapvirtualinstance.WorkloadsClientSAPSupportedSKUOptions{SAPSupportedSKU: 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.SAPSupportedResourceSKUsResult = armworkloadssapvirtualinstance.SAPSupportedResourceSKUsResult{ - // SupportedSKUs: []*armworkloadssapvirtualinstance.SAPSupportedSKU{ - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_E32ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_E48ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_E64ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M32Is"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M32ts"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M64Is"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M64ms"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M64s"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M128ms"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M128s"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M208ms_v2"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M208s_v2"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M416ms_v2"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M416s_v2"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPSupportedSkus_SingleServer.json -func ExampleWorkloadsClient_SAPSupportedSKU_sapSupportedSkusSingleServer() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkloadsClient().SAPSupportedSKU(ctx, "centralus", &armworkloadssapvirtualinstance.WorkloadsClientSAPSupportedSKUOptions{SAPSupportedSKU: 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.SAPSupportedResourceSKUsResult = armworkloadssapvirtualinstance.SAPSupportedResourceSKUsResult{ - // SupportedSKUs: []*armworkloadssapvirtualinstance.SAPSupportedSKU{ - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E32ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E48ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E64ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M32ts"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPDiskConfigurations_NonProd.json -func ExampleWorkloadsClient_SAPDiskConfigurations_sapDiskConfigurationsNonProd() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkloadsClient().SAPDiskConfigurations(ctx, "centralus", &armworkloadssapvirtualinstance.WorkloadsClientSAPDiskConfigurationsOptions{SAPDiskConfigurations: 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.SAPDiskConfigurationsResult = armworkloadssapvirtualinstance.SAPDiskConfigurationsResult{ - // VolumeConfigurations: map[string]*armworkloadssapvirtualinstance.SAPDiskConfiguration{ - // "backup": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ - // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](2), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ - // { - // DiskTier: to.Ptr("E10"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](6), - // MbpsReadWrite: to.Ptr[int64](60), - // MinimumSupportedDiskCount: to.Ptr[int64](0), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("E15"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](6), - // MbpsReadWrite: to.Ptr[int64](60), - // MinimumSupportedDiskCount: to.Ptr[int64](0), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("E20"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](6), - // MbpsReadWrite: to.Ptr[int64](60), - // MinimumSupportedDiskCount: to.Ptr[int64](0), - // SizeGB: to.Ptr[int64](512), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](6), - // MbpsReadWrite: to.Ptr[int64](100), - // MinimumSupportedDiskCount: to.Ptr[int64](0), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P15"), - // IopsReadWrite: to.Ptr[int64](1100), - // MaximumSupportedDiskCount: to.Ptr[int64](6), - // MbpsReadWrite: to.Ptr[int64](125), - // MinimumSupportedDiskCount: to.Ptr[int64](0), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P20"), - // IopsReadWrite: to.Ptr[int64](2300), - // MaximumSupportedDiskCount: to.Ptr[int64](6), - // MbpsReadWrite: to.Ptr[int64](150), - // MinimumSupportedDiskCount: to.Ptr[int64](0), - // SizeGB: to.Ptr[int64](512), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }}, - // }, - // "hana/data": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ - // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](4), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](5), - // MbpsReadWrite: to.Ptr[int64](100), - // MinimumSupportedDiskCount: to.Ptr[int64](4), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }}, - // }, - // "hana/log": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ - // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](3), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](5), - // MbpsReadWrite: to.Ptr[int64](100), - // MinimumSupportedDiskCount: to.Ptr[int64](3), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }}, - // }, - // "hana/shared": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ - // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ - // { - // DiskTier: to.Ptr("P15"), - // IopsReadWrite: to.Ptr[int64](1100), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](125), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P20"), - // IopsReadWrite: to.Ptr[int64](2300), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](150), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](512), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P30"), - // IopsReadWrite: to.Ptr[int64](5000), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](200), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](1024), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P40"), - // IopsReadWrite: to.Ptr[int64](7500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](250), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](2048), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P50"), - // IopsReadWrite: to.Ptr[int64](7500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](250), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](4096), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("E15"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](60), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("E20"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](60), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](512), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("E30"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](60), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](1024), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("E40"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](60), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](2048), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("E50"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](60), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](4096), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }}, - // }, - // "os": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ - // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](64), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ - // { - // DiskTier: to.Ptr("P6"), - // IopsReadWrite: to.Ptr[int64](240), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](50), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](64), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](100), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P6"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](60), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](64), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](60), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }}, - // }, - // "usr/sap": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ - // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](100), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](1100), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](125), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](2300), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](150), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](512), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("E10"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](60), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("E15"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](60), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("E20"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](60), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](512), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPDiskConfigurations_Prod.json -func ExampleWorkloadsClient_SAPDiskConfigurations_sapDiskConfigurationsProd() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkloadsClient().SAPDiskConfigurations(ctx, "centralus", &armworkloadssapvirtualinstance.WorkloadsClientSAPDiskConfigurationsOptions{SAPDiskConfigurations: 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.SAPDiskConfigurationsResult = armworkloadssapvirtualinstance.SAPDiskConfigurationsResult{ - // VolumeConfigurations: map[string]*armworkloadssapvirtualinstance.SAPDiskConfiguration{ - // "backup": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ - // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](2), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](6), - // MbpsReadWrite: to.Ptr[int64](100), - // MinimumSupportedDiskCount: to.Ptr[int64](0), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P15"), - // IopsReadWrite: to.Ptr[int64](1100), - // MaximumSupportedDiskCount: to.Ptr[int64](6), - // MbpsReadWrite: to.Ptr[int64](125), - // MinimumSupportedDiskCount: to.Ptr[int64](0), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P20"), - // IopsReadWrite: to.Ptr[int64](2300), - // MaximumSupportedDiskCount: to.Ptr[int64](6), - // MbpsReadWrite: to.Ptr[int64](150), - // MinimumSupportedDiskCount: to.Ptr[int64](0), - // SizeGB: to.Ptr[int64](512), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }}, - // }, - // "hana/data": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ - // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](4), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](5), - // MbpsReadWrite: to.Ptr[int64](100), - // MinimumSupportedDiskCount: to.Ptr[int64](4), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }}, - // }, - // "hana/log": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ - // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](3), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](5), - // MbpsReadWrite: to.Ptr[int64](100), - // MinimumSupportedDiskCount: to.Ptr[int64](3), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }}, - // }, - // "hana/shared": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ - // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ - // { - // DiskTier: to.Ptr("P15"), - // IopsReadWrite: to.Ptr[int64](1100), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](125), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P20"), - // IopsReadWrite: to.Ptr[int64](2300), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](150), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](512), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P30"), - // IopsReadWrite: to.Ptr[int64](5000), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](200), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](1024), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P40"), - // IopsReadWrite: to.Ptr[int64](7500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](250), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](2048), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P50"), - // IopsReadWrite: to.Ptr[int64](7500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](250), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](4096), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }}, - // }, - // "os": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ - // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](64), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ - // { - // DiskTier: to.Ptr("P6"), - // IopsReadWrite: to.Ptr[int64](240), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](50), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](64), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](100), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }}, - // }, - // "usr/sap": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ - // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](100), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](1100), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](125), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](2300), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](150), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](512), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPAvailabilityZoneDetails_eastus.json -func ExampleWorkloadsClient_SAPAvailabilityZoneDetails_sapAvailabilityZoneDetailsEastus() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkloadsClient().SAPAvailabilityZoneDetails(ctx, "centralus", &armworkloadssapvirtualinstance.WorkloadsClientSAPAvailabilityZoneDetailsOptions{SAPAvailabilityZoneDetails: 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.SAPAvailabilityZoneDetailsResult = armworkloadssapvirtualinstance.SAPAvailabilityZoneDetailsResult{ - // AvailabilityZonePairs: []*armworkloadssapvirtualinstance.SAPAvailabilityZonePair{ - // { - // ZoneA: to.Ptr[int64](1), - // ZoneB: to.Ptr[int64](2), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPAvailabilityZoneDetails_northeurope.json -func ExampleWorkloadsClient_SAPAvailabilityZoneDetails_sapAvailabilityZoneDetailsNortheurope() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkloadsClient().SAPAvailabilityZoneDetails(ctx, "centralus", &armworkloadssapvirtualinstance.WorkloadsClientSAPAvailabilityZoneDetailsOptions{SAPAvailabilityZoneDetails: 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.SAPAvailabilityZoneDetailsResult = armworkloadssapvirtualinstance.SAPAvailabilityZoneDetailsResult{ - // AvailabilityZonePairs: []*armworkloadssapvirtualinstance.SAPAvailabilityZonePair{ - // { - // ZoneA: to.Ptr[int64](2), - // ZoneB: to.Ptr[int64](3), - // }}, - // } -}