From 3a44c5318b717163b4df09551dce2f8c34c8fc54 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 15 Nov 2024 02:10:54 +0000 Subject: [PATCH] CodeGen from PR 31543 in Azure/azure-rest-api-specs Merge c34f1b8956a2f9e73f819b91cecbafb0ac20e378 into 6bab1a8cc4ea7b5368da89f2a00f15027392e703 --- .../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 +- .../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 + .../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 | 117 + .../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 +- .../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 +- .../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 +- .../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 -- 240 files changed, 22230 insertions(+), 11097 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/{workloadssapvirtualinstance/armworkloadssapvirtualinstance => commonedgesitemanageroperations/armcommonedgesitemanageroperations}/operations_client.go (84%) 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/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/{workloadssapvirtualinstance/armworkloadssapvirtualinstance => 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 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 create mode 100644 sdk/resourcemanager/durabletask/armdurabletask/fake/operations_server.go 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 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 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..b9d05d924b57 --- /dev/null +++ b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 0.1.0 (2024-11-15) +### 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/workloadssapvirtualinstance/armworkloadssapvirtualinstance/operations_client.go b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/operations_client.go similarity index 84% rename from sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/operations_client.go rename to sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/operations_client.go index b8bc3adcba32..ac7ee1e62067 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/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 armworkloadssapvirtualinstance +package armcommonedgesitemanageroperations 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 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.Workloads/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-10-01-preview") + 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..bef45c469c80 --- /dev/null +++ b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/edge/Microsoft.Edge.Management +commit: 2194181c3afaff6de9996b273c1f0d749f85b7b0 +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..9544e7c2f216 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-15) +### 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..8f923ec534b4 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: 2194181c3afaff6de9996b273c1f0d749f85b7b0 repo: Azure/azure-rest-api-specs -additionalDirectories: +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..cdd7d0073366 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 0.1.0 (2024-11-15) +### 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/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/operations_server.go b/sdk/resourcemanager/contoso/armcontoso/fake/operations_server.go similarity index 56% rename from sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/operations_server.go rename to sdk/resourcemanager/contoso/armcontoso/fake/operations_server.go index 1848d7f7e300..c33444bdc46a 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/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/workloadssapvirtualinstance/armworkloadssapvirtualinstance" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/contoso/armcontoso" "net/http" ) -// OperationsServer is a fake server for instances of the armworkloadssapvirtualinstance.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 *armworkloadssapvirtualinstance.OperationsClientListOptions) (resp azfake.PagerResponder[armworkloadssapvirtualinstance.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 armworkloadssapvirtualinstance.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[armworkloadssapvirtualinstance.OperationsClientListResponse]](), + newListPager: newTracker[azfake.PagerResponder[armcontoso.OperationsClientListResponse]](), } } -// OperationsServerTransport connects instances of armworkloadssapvirtualinstance.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[armworkloadssapvirtualinstance.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 *armworkloadssapvirtualinstance.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..266f0277e8f8 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/contosowidgetmanager/Contoso.Management +commit: 2194181c3afaff6de9996b273c1f0d749f85b7b0 +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..4dafc2c1aaaf --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 0.1.0 (2024-11-15) +### 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/durabletask/armdurabletask/fake/operations_server.go b/sdk/resourcemanager/durabletask/armdurabletask/fake/operations_server.go new file mode 100644 index 000000000000..d147c87663ca --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/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/durabletask/armdurabletask" + "net/http" +) + +// 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 *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 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[armdurabletask.OperationsClientListResponse]](), + } +} + +// 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[armdurabletask.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 *armdurabletask.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/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..a2002152dfd3 --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/durabletask/DurableTask.Management +commit: 2194181c3afaff6de9996b273c1f0d749f85b7b0 +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..9028048e5162 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-15) +### 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..fb2780ce88f3 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: 2194181c3afaff6de9996b273c1f0d749f85b7b0 +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..6e6f4b829cc7 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-15) +### 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..aa352a93668d 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: 2194181c3afaff6de9996b273c1f0d749f85b7b0 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..b5c36425af38 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-15) +### 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..10a70fbe7751 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: 2194181c3afaff6de9996b273c1f0d749f85b7b0 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..9d14010d1d1a 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-15) +### 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..4bafb58212bb 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: 2194181c3afaff6de9996b273c1f0d749f85b7b0 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..488da99f6945 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-15) +### 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..2ba27b3a872b 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: 2194181c3afaff6de9996b273c1f0d749f85b7b0 repo: Azure/azure-rest-api-specs -additionalDirectories: +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..71a499944e10 --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 0.1.0 (2024-11-15) +### 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..81d3186483c1 --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/edge/Microsoft.Edge.Sites.Management +commit: 2194181c3afaff6de9996b273c1f0d749f85b7b0 +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..b1eea077c7d5 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-15) +### 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..b18776f661d4 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: 2194181c3afaff6de9996b273c1f0d749f85b7b0 repo: Azure/azure-rest-api-specs -additionalDirectories: +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..ea0435d27f2f 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-15) +### 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..95dc68785a27 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: 2194181c3afaff6de9996b273c1f0d749f85b7b0 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..65ac184b694e 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-15) +### 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..6a680c14bf24 --- /dev/null +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/workloads/Workloads.SAPVirtualInstance.Management +commit: 2194181c3afaff6de9996b273c1f0d749f85b7b0 +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), - // }}, - // } -}